Skip to content

Commit f13fd92

Browse files
author
Darius Neațu
committed
[beman-tidy] CI flows should build, install and run beman-tidy
1 parent 4e4f283 commit f13fd92

2 files changed

Lines changed: 65 additions & 3 deletions

File tree

.github/workflows/beman-tidy.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
22

3-
name: beman-tidy tests
3+
name: beman-tidy lint, testing and installing
44

55
on:
66
push:
77
branches:
88
- main
99
pull_request:
1010
workflow_dispatch:
11+
schedule:
12+
- cron: '0 5 * * *' # 08:00AM EEST (@neatudarius' timezone) -> 05:00AM UTC
1113

1214
jobs:
13-
tests:
15+
run_tests:
1416
runs-on: ubuntu-latest
1517
defaults:
1618
run:
@@ -28,9 +30,42 @@ jobs:
2830
2931
- name: Run linter
3032
run: |
31-
echo "Running linter"
3233
uv run ruff check --diff
3334
3435
- name: Run tests
3536
run: |
3637
uv run pytest tests/ -v
38+
39+
build_and_install:
40+
runs-on: ubuntu-latest
41+
defaults:
42+
run:
43+
working-directory: tools/beman-tidy
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v5
50+
51+
- name: Sync environment
52+
run: |
53+
uv sync
54+
55+
- name: Build and install beman-tidy
56+
run: |
57+
uv clean
58+
uv build
59+
python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall
60+
beman-tidy --help
61+
62+
- name: Run installed beman-tidy on exemplar repo
63+
run: |
64+
git clone https://github.com/bemanproject/exemplar.git
65+
cd exemplar/ # Testing that beman-tidy can be run from any path, e.g. from the exemplar repo.
66+
beman-tidy --verbose --require-all .
67+
68+
create-issue-when-fault:
69+
needs: [run_tests, build_and_install]
70+
if: failure() && github.event.schedule == '0 5 * * *' # 08:00AM EEST (@neatudarius' timezone) -> 05:00AM UTC
71+
uses: ./.github/workflows/reusable-beman-create-issue-when-fault.yml
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2+
3+
name: 'Beman issue creation workflow'
4+
on:
5+
workflow_call:
6+
jobs:
7+
create-issue:
8+
runs-on: ubuntu-latest
9+
steps:
10+
# See https://github.com/cli/cli/issues/5075
11+
- uses: actions/checkout@v4
12+
- name: Create issue
13+
run: |
14+
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')
15+
body="**Build-and-Test Failure Report**
16+
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
17+
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
18+
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
19+
The scheduled build-and-test triggered by cron has failed.
20+
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."
21+
if [[ $issue_num -eq -1 ]]; then
22+
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
23+
else
24+
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
25+
fi
26+
env:
27+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)