1name: CI (bors)
2
3on:
4  push:
5    branches:
6      - auto-libc
7      - try
8
9jobs:
10  docker_linux_tier1:
11    name: Docker Linux Tier1
12    runs-on: ubuntu-18.04
13    strategy:
14      fail-fast: true
15      matrix:
16        target: [
17          i686-unknown-linux-gnu,
18          x86_64-unknown-linux-gnu,
19        ]
20    steps:
21      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
22        with:
23          github_token: "${{ secrets.GITHUB_TOKEN }}"
24      - uses: actions/checkout@v2
25      - name: Setup Rust toolchain
26        run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
27      - name: Execute run-docker.sh
28        run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}
29
30  macos:
31    name: macOS
32    runs-on: macos-10.15
33    strategy:
34      fail-fast: true
35      matrix:
36        target: [
37          x86_64-apple-darwin,
38        ]
39    steps:
40      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
41        with:
42          github_token: "${{ secrets.GITHUB_TOKEN }}"
43      - uses: actions/checkout@v2
44      - name: Setup Rust toolchain
45        run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
46      - name: Execute run.sh
47        run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
48
49  windows:
50    name: Windows
51    runs-on: windows-2019
52    env:
53      OS: windows
54    strategy:
55      fail-fast: true
56      matrix:
57        include:
58          - target: x86_64-pc-windows-gnu
59            env:
60              ARCH_BITS: 64
61              ARCH: x86_64
62          - target: x86_64-pc-windows-msvc
63          # Disabled because broken:
64          #  https://github.com/rust-lang/libc/issues/1592
65          #- target: i686-pc-windows-gnu
66          #  env:
67          #    ARCH_BITS: 32
68          #    ARCH: i686
69          - target: i686-pc-windows-msvc
70    steps:
71      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
72        with:
73          github_token: "${{ secrets.GITHUB_TOKEN }}"
74      - uses: actions/checkout@v2
75      - name: Setup Rust toolchain
76        run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
77        shell: bash
78      - name: Execute run.sh
79        run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}
80        shell: bash
81
82  style_check:
83    name: Style check
84    runs-on: ubuntu-18.04
85    strategy:
86      fail-fast: true
87    steps:
88      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
89        with:
90          github_token: "${{ secrets.GITHUB_TOKEN }}"
91      - uses: actions/checkout@v2
92      - name: Setup Rust toolchain
93        run: sh ./ci/install-rust.sh
94      - name: Check style
95        run: sh ci/style.sh
96
97  docker_linux_tier2:
98    name: Docker Linux Tier2
99    needs: [docker_linux_tier1, style_check]
100    runs-on: ubuntu-18.04
101    strategy:
102      fail-fast: true
103      max-parallel: 12
104      matrix:
105        target: [
106          aarch64-linux-android,
107          aarch64-unknown-linux-gnu,
108          aarch64-unknown-linux-musl,
109          arm-linux-androideabi,
110          arm-unknown-linux-gnueabihf,
111          arm-unknown-linux-musleabihf,
112          # FIXME: Disabled because currently broken, see:
113          # https://github.com/rust-lang/libc/issues/1591
114          # asmjs-unknown-emscripten,
115          i686-linux-android,
116          i686-unknown-linux-musl,
117          mips-unknown-linux-gnu,
118          mips-unknown-linux-musl,
119          mips64-unknown-linux-gnuabi64,
120          mips64el-unknown-linux-gnuabi64,
121          mipsel-unknown-linux-musl,
122          powerpc-unknown-linux-gnu,
123          powerpc64-unknown-linux-gnu,
124          powerpc64le-unknown-linux-gnu,
125          s390x-unknown-linux-gnu,
126          riscv64gc-unknown-linux-gnu,
127          # FIXME: Figure out why this is disabled.
128          #wasm32-wasi,
129          sparc64-unknown-linux-gnu,
130          wasm32-unknown-emscripten,
131          x86_64-linux-android,
132          x86_64-unknown-linux-gnux32,
133          x86_64-unknown-linux-musl,
134          # FIXME: It seems some items in `src/unix/mod.rs`
135          # aren't defined on redox actually.
136          # x86_64-unknown-redox,
137        ]
138    steps:
139      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
140        with:
141          github_token: "${{ secrets.GITHUB_TOKEN }}"
142      - uses: actions/checkout@v2
143      - name: Setup Rust toolchain
144        run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh
145      - name: Execute run-docker.sh
146        run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}
147
148  # devkitpro's pacman needs to be connected from Docker.
149  docker_switch:
150    name: Docker Switch
151    needs: [docker_linux_tier1, style_check]
152    runs-on: ubuntu-18.04
153    strategy:
154      fail-fast: true
155    steps:
156      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
157        with:
158          github_token: "${{ secrets.GITHUB_TOKEN }}"
159      - uses: actions/checkout@v2
160      - name: Setup Rust toolchain
161        run: sh ./ci/install-rust.sh
162      - name: Execute run-docker.sh
163        run: LIBC_CI=1 sh ./ci/run-docker.sh switch
164
165  build_channels_linux:
166    name: Build Channels Linux
167    needs: docker_linux_tier2
168    runs-on: ubuntu-18.04
169    env:
170      OS: linux
171    strategy:
172      fail-fast: true
173      max-parallel: 5
174      matrix:
175        toolchain: [
176          stable,
177          beta,
178          nightly,
179          1.13.0,
180          1.19.0,
181          1.24.0,
182          1.25.0,
183          1.30.0,
184        ]
185    steps:
186      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
187        with:
188          github_token: "${{ secrets.GITHUB_TOKEN }}"
189      - uses: actions/checkout@v2
190      - name: Setup Rust toolchain
191        run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
192      - name: Execute build.sh
193        run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
194
195  build_channels_macos:
196    name: Build Channels macOS
197    needs: macos
198    runs-on: macos-10.15
199    env:
200      OS: macos
201    strategy:
202      fail-fast: true
203      max-parallel: 4
204      matrix:
205        toolchain: [
206          stable,
207          beta,
208          nightly,
209          1.13.0,
210          1.19.0,
211          1.24.0,
212          1.25.0,
213          1.30.0,
214        ]
215    steps:
216      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
217        with:
218          github_token: "${{ secrets.GITHUB_TOKEN }}"
219      - uses: actions/checkout@v2
220      - name: Setup Rust toolchain
221        run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
222      - name: Execute build.sh
223        run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
224
225  semver_linux:
226    name: Semver Linux
227    needs: build_channels_linux
228    runs-on: ubuntu-18.04
229    strategy:
230      fail-fast: true
231    steps:
232      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
233        with:
234          github_token: "${{ secrets.GITHUB_TOKEN }}"
235      - uses: actions/checkout@v2
236      - name: Setup Rust toolchain
237        # FIXME: Pin nightly version to make semverver compilable.
238        run: TOOLCHAIN=nightly-2020-06-18 sh ./ci/install-rust.sh
239      - name: Check breaking changes
240        run: sh ci/semver.sh linux
241
242  semver_macos:
243    name: Semver macOS
244    needs: build_channels_macos
245    runs-on: macos-10.15
246    strategy:
247      fail-fast: true
248    steps:
249      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
250        with:
251          github_token: "${{ secrets.GITHUB_TOKEN }}"
252      - uses: actions/checkout@v2
253      - name: Setup Rust toolchain
254        # FIXME: Pin nightly version to make semverver compilable.
255        run: TOOLCHAIN=nightly-2020-06-18 sh ./ci/install-rust.sh
256      - name: Check breaking changes
257        run: sh ci/semver.sh macos
258
259  docs:
260    name: Generate documentation
261    runs-on: ubuntu-18.04
262    needs: docker_linux_tier2
263    strategy:
264      fail-fast: true
265    steps:
266      - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
267        with:
268          github_token: "${{ secrets.GITHUB_TOKEN }}"
269      - uses: actions/checkout@v2
270      - name: Setup Rust toolchain
271        run: sh ./ci/install-rust.sh
272      - name: Generate documentation
273        run: LIBC_CI=1 sh ci/dox.sh
274
275  # These jobs doesn't actually test anything, but they're only used to tell
276  # bors the build completed, as there is no practical way to detect when a
277  # workflow is successful listening to webhooks only.
278  #
279  # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
280
281  end_success:
282    name: bors build finished
283    if: github.event.pusher.name == 'bors' && success()
284    runs-on: ubuntu-18.04
285    needs: [
286      docker_linux_tier1,
287      docker_linux_tier2,
288      macos,
289      windows,
290      style_check,
291      docker_switch,
292      build_channels_linux,
293      build_channels_macos,
294      semver_linux,
295      semver_macos,
296      docs,
297    ]
298
299    steps:
300      - name: Mark the job as successful
301        run: exit 0
302
303  end_failure:
304    name: bors build finished
305    if: github.event.pusher.name == 'bors' && (failure() || cancelled())
306    runs-on: ubuntu-18.04
307    needs: [
308      docker_linux_tier1,
309      docker_linux_tier2,
310      macos,
311      windows,
312      style_check,
313      docker_switch,
314      build_channels_linux,
315      build_channels_macos,
316      semver_linux,
317      semver_macos,
318      docs,
319    ]
320
321    steps:
322      - name: Mark the job as a failure
323        run: exit 1
324