Detect missing operation definitions #283
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" | |
jobs: | |
missing-optypes: | |
name: Check for missing op type definitions | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
outputs: | |
should_notify: ${{ steps.check_status.outputs.result }} | |
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: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: "poetry" | |
- name: Update the project dependencies | |
run: poetry -C tests update | |
- name: Run the missing op types test | |
id: check_missing_optypes | |
run: poetry -C tests run -- cargo test --test integration -- --ignored missing_optypes | |
- name: Set output flags | |
id: check_status | |
if: always() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const outcome = ${{ steps.check_missing_optypes.outcome != 'success' }}; | |
console.log(`The outcome is: ${outcome}`); | |
return outcome | |
result-encoding: string | |
notify-slack: | |
uses: CQCL/hugrverse-actions/.github/workflows/slack-notifier.yml@main | |
needs: missing-optypes | |
if: ${{ needs.missing-optypes.outputs.should_notify == 'true' && ( github.event_name == 'schedule' || github.event_name == 'push' ) }} | |
with: | |
channel-id: 'C040CRWH9FF' | |
slack-message: | | |
⚠️ `tket-json-rs` is missing OpType definitions. | |
See <https://github.com/CQCL/tket-json-rs/actions/runs/${{ github.run_id }}|the failing check> for more info. | |
# Rate-limit the message to once per week | |
timeout-minutes: 10080 | |
# A repository variable used to store the last message timestamp. | |
timeout-variable: "MISSING_OPS_MSG_SENT" | |
secrets: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
GITHUB_PAT: ${{ secrets.HUGRBOT_PAT }} |