This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
89 lines (80 loc) · 2.73 KB
/
ci.yml
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
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
# Managed by bors
- auto
# Run nightly checks to detect possible breakage due to upstream rustc changes
schedule:
- cron: '0 0 * * *'
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
toolchain:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
include:
- toolchain: x86_64-unknown-linux-gnu
builder: ubuntu-latest
os: linux
- toolchain: x86_64-apple-darwin
builder: macos-latest
os: macos
- toolchain: x86_64-pc-windows-msvc
builder: windows-latest
os: windows
name: nightly - ${{ matrix.toolchain }}
runs-on: ${{ matrix.builder }}
steps:
- uses: actions/checkout@v3
- name: Setup latest nightly toolchain
run: bash ci/setup-toolchain.sh
if: github.event_name == 'schedule'
- name: Run tests
run: sh ci/run.sh ${{ matrix.os }}
create_issue:
runs-on: ubuntu-latest
# the combination of these two lines seems to do the "if build_and_test failed, run this one"
needs: build_and_test
if: always() && github.event_name == 'schedule' && needs.build_and_test.result == 'failure'
permissions:
issues: write
steps:
- name: Create an issue
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
readarray -t exists < <(gh issue list --state open --label nightly-CI-failed --json number --jq '.[].number' --repo "$GITHUB_REPOSITORY")
if [[ -n "${exists[@]}" ]]; then
echo "Not opening another issue, already have ${#exists[@]} issue(s), latest at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/issues/${exists[0]}."
else
cat << EOF | gh issue create \
--label nightly-CI-failed \
--title "Nightly CI run failed" \
--repo "$GITHUB_REPOSITORY" \
--body-file -
The nightly CI run on $(date +%F) seems to have failed.
- Check the logs at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}
- Update to the latest 'rustc-nightly' if necessary
- Investigate test run failures if any
EOF
fi
# https://forge.rust-lang.org/infra/docs/bors.html#adding-a-new-repository-to-bors
build_result:
name: bors build finished
runs-on: ubuntu-latest
needs: ["build_and_test"]
steps:
- name: Mark the job as successful
run: exit 0
if: success()
- name: Mark the job as unsuccessful
run: exit 1
if: "!success()"