Skip to content

Commit b22bf57

Browse files
author
Darius Neațu
committed
[beman-tidy] CI flows: split in run_linter, run_tests, build_and_install, run_beman_tidy_on_exemplar
1 parent f13fd92 commit b22bf57

3 files changed

Lines changed: 53 additions & 10 deletions

File tree

.github/workflows/beman-tidy.yml

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

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

55
on:
66
push:
77
branches:
88
- main
99
pull_request:
10+
workflow_call:
1011
workflow_dispatch:
1112
schedule:
1213
- cron: '0 5 * * *' # 08:00AM EEST (@neatudarius' timezone) -> 05:00AM UTC
1314

1415
jobs:
15-
run_tests:
16+
run_linter:
1617
runs-on: ubuntu-latest
1718
defaults:
1819
run:
@@ -32,6 +33,22 @@ jobs:
3233
run: |
3334
uv run ruff check --diff
3435
36+
run_tests:
37+
runs-on: ubuntu-latest
38+
defaults:
39+
run:
40+
working-directory: tools/beman-tidy
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Install uv
46+
uses: astral-sh/setup-uv@v5
47+
48+
- name: Sync environment
49+
run: |
50+
uv sync
51+
3552
- name: Run tests
3653
run: |
3754
uv run pytest tests/ -v
@@ -59,13 +76,36 @@ jobs:
5976
python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall
6077
beman-tidy --help
6178
79+
run_on_exemplar:
80+
runs-on: ubuntu-latest
81+
defaults:
82+
run:
83+
working-directory: tools/beman-tidy
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
88+
- name: Install uv
89+
uses: astral-sh/setup-uv@v5
90+
91+
- name: Sync environment
92+
run: |
93+
uv sync
94+
95+
- name: Build and install beman-tidy
96+
run: |
97+
uv clean
98+
uv build
99+
python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall
100+
beman-tidy --help
101+
62102
- name: Run installed beman-tidy on exemplar repo
63103
run: |
64104
git clone https://github.com/bemanproject/exemplar.git
65105
cd exemplar/ # Testing that beman-tidy can be run from any path, e.g. from the exemplar repo.
66106
beman-tidy --verbose --require-all .
67107
68108
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
109+
needs: [run_linter, run_tests, build_and_install, run_on_exemplar]
110+
if: failure() && (github.event_name == 'workflow_call' || github.event_name == 'schedule')
111+
uses: ./.github/workflows/reusable-beman-create-issue-when-fault.yml

.github/workflows/reusable-beman-create-issue-when-fault.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
name: 'Beman issue creation workflow'
44
on:
55
workflow_call:
6+
workflow_dispatch:
67
jobs:
78
create-issue:
89
runs-on: ubuntu-latest
@@ -11,17 +12,17 @@ jobs:
1112
- uses: actions/checkout@v4
1213
- name: Create issue
1314
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**
15+
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] infra repo CI job failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')
16+
body="**CI job failure Report**
1617
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
1718
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
1819
- **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+
The scheduled job triggered by cron has failed.
2021
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."
2122
if [[ $issue_num -eq -1 ]]; then
22-
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
23+
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] infra repo CI job failure" --body "$body" --assignee ${{ github.actor }}
2324
else
2425
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
2526
fi
2627
env:
27-
GH_TOKEN: ${{ github.token }}
28+
GH_TOKEN: ${{ github.token }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
44

5+
[![beman-tidy tests](https://github.com/bemanproject/infra/actions/workflows/beman-tidy.yml/badge.svg)](https://github.com/bemanproject/infra/actions/workflows/beman-tidy.yml)
6+
57
This repository contains the infrastructure for The Beman Project. This is NOT a library repository, so it does not
68
respect the usual structure of a Beman library repository nor The Beman Standard!
79

0 commit comments

Comments
 (0)