This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
CI #1796
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()" |