ci: Make an issue when ops are missing, instead of messaging slack #296
Workflow file for this run
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: Detect missing operation definitions | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
schedule: | ||
# 08:00 daily | ||
- cron: '0 8 * * *' | ||
env: | ||
CARGO_TERM_COLOR: always | ||
SCCACHE_GHA_ENABLED: "true" | ||
RUSTC_WRAPPER: "sccache" | ||
# Pinned version for the uv package manager | ||
UV_VERSION: "0.5.1" | ||
UV_FROZEN: 1 | ||
jobs: | ||
missing-optypes: | ||
name: Check for missing op type definitions | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
outputs: | ||
should_notify: ${{ steps.check_missing_optypes.outputs.fail }} | ||
diagnostic: ${{ steps.check_missing_optypes.outputs.diagnostic }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: mozilla-actions/sccache-action@v0.0.6 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt, clippy | ||
- name: Set up uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
version: ${{ env.UV_VERSION }} | ||
enable-cache: true | ||
- name: Run the missing op types test | ||
id: check_missing_optypes | ||
run: | | ||
set +e | ||
uv run -- cargo test --test integration -- --ignored missing_optypes --nocapture --test-threads=1 > missing_optypes.txt | ||
if [ $? -eq 0 ]; then | ||
echo "The test passed." | ||
echo "fail=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "The test failed with error code $?." | ||
echo | ||
cat missing_optypes.txt | ||
echo "fail=true" >> $GITHUB_OUTPUT | ||
fi | ||
echo "diagnostic=$(cat missing_optypes.txt)" >> $GITHUB_OUTPUT | ||
create-issue: | ||
uses: CQCL/hugrverse-actions/.github/workflows/create-issue.yml@main | ||
Check failure on line 60 in .github/workflows/missing-ops.yml GitHub Actions / .github/workflows/missing-ops.ymlInvalid workflow file
|
||
needs: missing-optypes | ||
if: ${{ needs.missing-optypes.outputs.should_notify == 'true' && ( github.event_name == 'schedule' || github.event_name == 'push' ) }} | ||
with: | ||
title: "`tket-json-rs` is missing OpType definitions." | ||
body: | | ||
⚠️ `tket-json-rs` is missing OpType definitions. | ||
``` | ||
$DIAGNOSTIC | ||
``` | ||
See [https://github.com/CQCL/tket-json-rs/actions/runs/${{ github.run_id }}](the failing check) for more info. | ||
unique-label: "missing-ops" | ||
other-labels: "bug" | ||
secrets: | ||
GITHUB_PAT: ${{ secrets.HUGRBOT_PAT }} | ||
DIAGNOSTIC: ${{ needs.missing-optypes.outputs.diagnostic }} |