Nightly tests on main #141
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: Nightly tests on main | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
CARGO_TERM_COLOR: always | |
# Disable incremental compilation. | |
# | |
# Incremental compilation is useful as part of an edit-build-test-edit cycle, | |
# as it lets the compiler avoid recompiling code that hasn't changed. However, | |
# on CI, we're not making small edits; we're almost always building the entire | |
# project from scratch. Thus, incremental compilation on CI actually | |
# introduces *additional* overhead to support making future builds | |
# faster...but no future builds will ever occur in any given CI environment. | |
# | |
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow | |
# for details. | |
CARGO_INCREMENTAL: 0 | |
# Allow more retries for network requests in cargo (downloading crates) and | |
# rustup (installing toolchains). This should help to reduce flaky CI failures | |
# from transient network timeouts or other issues. | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
# Don't emit giant backtraces in the CI logs. | |
RUST_BACKTRACE: short | |
jobs: | |
linux_exhaustive: | |
runs-on: buildjet-16vcpu-ubuntu-2204 | |
env: | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: sudo apt-get install -y pkg-config libssl-dev | |
- uses: actions-rs/toolchain@v1 | |
- uses: taiki-e/install-action@nextest | |
- uses: Swatinem/rust-cache@v2 | |
- name: Linux Tests | |
id: tests | |
run: | | |
cargo nextest run --profile ci --workspace --cargo-profile dev-ci --run-ignored all | |
continue-on-error: true | |
- name: Benches build successfully | |
id: benches | |
run: | | |
cargo bench --no-run --profile dev-ci | |
continue-on-error: true | |
- name: Linux Doc Tests | |
id: doctests | |
run: | | |
cargo test --doc --workspace --profile dev-ci | |
continue-on-error: true | |
- name: Gather status in a single variable | |
if: steps.tests.outcome == 'success' && steps.benches.outcome == 'success' && steps.doctests.outcome == 'success' | |
run: echo "status=true" >> $GITHUB_ENV | |
- name: Debug | |
run: | | |
echo ${{ steps.tests.outcome }} | |
echo ${{ steps.benches.outcome }} | |
echo ${{ steps.doctests.outcome }} | |
echo ${{ env.status }} | |
- name: Amend MESSAGE for tests | |
if: steps.tests.outcome != 'success' | |
run: echo "MESSAGE=${{ env.MESSAGE }} Exhaustive test run failed in https://github.com/lurk-lab/lurk-rs/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV | |
- name: Amend MESSAGE for benches | |
if: steps.benches.outcome != 'success' | |
run: echo "MESSAGE=${{ env.MESSAGE }} Bench compilation failed in https://github.com/lurk-lab/lurk-rs/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV | |
- name: Amend MESSAGE for doctests | |
if: steps.doctests.outcome != 'success' | |
run: echo "MESSAGE=${{ env.MESSAGE }} Doc test run failed in https://github.com/lurk-lab/lurk-rs/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV | |
- name: Find the last report issue open | |
id: last_issue | |
uses: micalevisk/last-issue-action@v2 | |
with: | |
state: open | |
labels: | | |
nightly | |
automated issue | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Close last report open issue | |
if: env.status == 'true' && steps.last_issue.outputs.has-found == 'true' | |
uses: peter-evans/close-issue@v3 | |
with: | |
issue-number: ${{ steps.last_issue.outputs.issue-number }} | |
comment: "All nightly tests succeeded" | |
- name: Update last report open issue | |
if: env.status != 'true' && steps.last_issue.outputs.has-found == 'true' | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
issue-number: ${{ steps.last_issue.outputs.issue-number }} | |
body: ${{ env.MESSAGE }} | |
edit-mode: replace | |
- name: Create file for issue | |
if: env.status != 'true' && steps.last_issue.outputs.has-found == 'false' | |
run: echo "${{ env.MESSAGE }}" > ./_body.md | |
- name: Create issue from report | |
if: env.status != 'true' && steps.last_issue.outputs.has-found == 'false' | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: Nightly run failed | |
content-filepath: ./_body.md | |
labels: | | |
nightly | |
automated issue | |