summaryrefslogtreecommitdiff
path: root/.github/workflows/continuous-integration-workflow.yml
blob: ce3bff7b81a7bbcec33bae88880cbeeb14481a91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: CI

on:
  push:
  pull_request:

jobs:
  crosstool:
    runs-on: ${{ matrix.host }}
    strategy:
      matrix:
        host: [ "ubuntu-latest", "macos-10.15" ]
    steps:
      - name: "clone"
        uses: actions/checkout@v2
      - name: "prereq Linux"
        if: ${{ runner.os == 'Linux' }}
        run: |
          sudo apt-get install -y gperf help2man libtool-bin
      - name: "prereq macOS"
        if: ${{ runner.os == 'macOS' }}
        run: |
          brew install autoconf automake bash binutils gawk gnu-sed \
               gnu-tar help2man make ncurses
      - name: "build ct-ng"
        run: |
          if [ "$RUNNER_OS" == "macOS" ]; then
            export PATH="$PATH:/usr/local/opt/binutils/bin"
            export CPPFLAGS="-I/usr/local/opt/ncurses/include -I/usr/local/opt/gettext/include"
            export LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/gettext/lib"
          fi
          ./bootstrap
          ./configure --prefix=$PWD/.local/
          make
          make install
          tar -cf ct-ng.tar .local/
      - name: "upload ct-ng"
        uses: actions/upload-artifact@v2
        with:
          name: crosstool.${{ matrix.host }}
          path: ct-ng.tar
      - name: "upload config.log"
        uses: actions/upload-artifact@v2
        with:
          name: config.log.${{ matrix.host }}
          path: config.log
        if: ${{ always() }}

  tarballs:
    needs: crosstool
    runs-on: ${{ matrix.host }}
    strategy:
      matrix:
        host: [ "ubuntu-latest" ]
    steps:
      - name: "download ct-ng"
        uses: actions/download-artifact@v2
        with:
          name: crosstool.${{ matrix.host }}
      - name: "extract ct-ng"
        run: |
          tar -xf ct-ng.tar
      - name: "prereq Linux"
        if: ${{ runner.os == 'Linux' }}
        run: |
          sudo apt-get install -y gperf help2man libtool-bin
          echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
      - name: "ct-ng source"
        run: |
          mkdir -p src
          for sample in aarch64-unknown-linux-gnu arm-picolibc-eabi \
                arm-unknown-linux-musleabi armv6-nommu-linux-uclibcgnueabi; do \
                ct-ng $sample; \
                sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config; \
                sed -i -e '/CT_LOCAL_TARBALLS_DIR/s/HOME/CT_TOP_DIR/' .config; \
                sed -i -e '/CT_PREFIX_DIR/s/HOME/CT_TOP_DIR/' .config; \
                sed -i -e 's/^.*CT_COMP_TOOLS_BISON.*$/CT_COMP_TOOLS_BISON=y/' .config; \
                sed -i -e 's/^.*CT_COMP_TOOLS_M4.*$/CT_COMP_TOOLS_M4=y/' .config; \
                sed -i -e 's/^.*CT_COMP_TOOLS_MAKE.*$/CT_COMP_TOOLS_MAKE=y/' .config; \
                ct-ng olddefconfig; \
                ct-ng source; \
          done
          tar -cvf src.tar src
      - name: "upload sources"
        uses: actions/upload-artifact@v2
        with:
          name: src.tar
          path: src.tar

  toolchains:
    needs: [ crosstool, tarballs ]
    runs-on: ${{ matrix.host }}
    strategy:
      matrix:
        host: [ "ubuntu-latest", "macos-10.15" ]
        sample:
          [
            "aarch64-unknown-linux-gnu",
            "arc-multilib-elf32",
            "arc-multilib-linux-gnu",
            "arc-multilib-linux-uclibc",
            "arm-picolibc-eabi",
            "arm-unknown-linux-gnueabi",
            "arm-unknown-linux-musleabi",
            "armv6-nommu-linux-uclibcgnueabi",
            "avr",
            "i686-w64-mingw32",
            "mips-unknown-elf",
            "mips-unknown-linux-gnu",
            "mips64-unknown-linux-gnu",
            "powerpc-unknown-linux-gnu",
            "powerpc64-unknown-linux-gnu",
            "riscv32-unknown-elf",
            "riscv64-unknown-elf",
            "s390-unknown-linux-gnu",
            "sh-unknown-elf",
            "sparc-unknown-linux-gnu",
            "x86_64-multilib-linux-uclibc",
            "x86_64-unknown-linux-gnu",
            "x86_64-w64-mingw32",
            "xtensa-fsf-linux-uclibc",
          ]
        exclude:
          # Exclude both glibc & uClibc ARC Linux toolchains as
          # there's no known use of ARC Linux toolchains on Mac,
          # and anyway glibc fails to build for ARC700,
          # see https://github.com/crosstool-ng/crosstool-ng/pull/1456#issuecomment-779150246
          - { host: "macos-10.15", sample: "arc-multilib-linux-gnu" }
          - { host: "macos-10.15", sample: "arc-multilib-linux-uclibc" }

          # Exclude mips*-*-linux-gnu because of <byteswap.h> usage in
          # elf-entry.c for linux kernel headers.  <byteswap.h> is a GNU
          # extension and doesn't exist on MacOS X
          - { host: "macos-10.15", sample: "mips-unknown-linux-gnu" }
          - { host: "macos-10.15", sample: "mips64-unknown-linux-gnu" }
    steps:
      - name: Create case sensitive workspace volume for macOS
        if: ${{ runner.os == 'macOS' }}
        run: |
          cd ..
          rmdir crosstool-ng
          hdiutil create ${HOME}/Workspace.sparseimage -volname crosstool-ng -type SPARSE -size 20g -fs HFSX
          hdiutil mount ${HOME}/Workspace.sparseimage -mountroot /Users/runner/work/crosstool-ng
          cd crosstool-ng
      - name: "download ct-ng"
        uses: actions/download-artifact@v2
        with:
          name: crosstool.${{ matrix.host }}
      - name: "extract ct-ng"
        run: |
          tar -xf ct-ng.tar
      - name: "download tarballs"
        uses: actions/download-artifact@v2
        with:
          name: src.tar
      - name: "extract tarballs"
        run: |
          tar -xvf src.tar
      - name: "prereq Linux"
        if: ${{ runner.os == 'Linux' }}
        run: |
          sudo apt-get install -y gperf help2man libtool-bin
          echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
      - name: "prereq macOS"
        if: ${{ runner.os == 'macOS' }}
        run: |
          brew install autoconf automake bash binutils gawk gnu-sed \
               gnu-tar help2man make ncurses pkg-config
          echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
      - name: "build ${{ matrix.sample }} for ${{ matrix.host }}"
        run: |
          mkdir -p src
          ct-ng ${{ matrix.sample }}
          sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config
          sed -i -e '/CT_LOCAL_TARBALLS_DIR/s/HOME/CT_TOP_DIR/' .config
          sed -i -e '/CT_PREFIX_DIR/s/HOME/CT_TOP_DIR/' .config
          ct-ng build
      - name: "upload log"
        uses: actions/upload-artifact@v2
        with:
          name: "${{ matrix.sample }}.${{ matrix.host }}.log"
          path: |
            build.log
            .config
        if: ${{ always() }}