-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (77 loc) · 2.58 KB
/
missing-ops.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
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/[email protected]
- 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@ab/slack-notifier
needs: missing-optypes
if: ${{ needs.missing-optypes.outputs.should_notify == 'true' }}
with:
channel-id: 'C04SHCL4FKP'
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.
# An unique identifier for the message type, to use in rate limiting.
message-label: "missing-op"
# Rate-limit the message to once per week
timeout-minutes: 10080
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
# This is required since `missing-optypes` is set to continue-on-error,
# and we want to ultimately fail the check after notifying.
fail-on-missing-optypes:
name: Fail the build on missing op types
runs-on: ubuntu-latest
needs: [missing-optypes, notify-slack]
if: ${{ needs.missing-optypes.outputs.should_notify == 'true' }}
steps:
- name: Fail the build
run: exit 1