Skip to content

Commit 5099f7f

Browse files
authored
Add repo configuration and replace tj-actions/changed-files (#4546)
1 parent 4d56258 commit 5099f7f

File tree

6 files changed

+50
-38
lines changed

6 files changed

+50
-38
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
branches: [ main ]
1717
paths:
1818
- '.github/workflows/codeql-analysis.yml'
19+
- 'repo-config.yml'
1920
- 'scripts/*.py'
2021
- 'pyproject.toml'
2122
- 'poetry.lock'
@@ -34,6 +35,7 @@ on:
3435
- 'main'
3536
paths:
3637
- '.github/workflows/codeql-analysis.yml'
38+
- 'repo-config.yml'
3739
- 'scripts/*.py'
3840
- 'pyproject.toml'
3941
- 'poetry.lock'
@@ -59,20 +61,20 @@ jobs:
5961

6062
outputs:
6163
matrix: ${{ steps.set-matrix.outputs.matrix }}
62-
changed-files: ${{ steps.changed-files.outputs.all_changed_files }}
64+
changed-files: ${{ steps.changed-files.outputs.files }}
6365
steps:
6466
- uses: actions/checkout@v4
6567
with:
6668
fetch-depth: 2
6769

6870
- name: Get changed code files
6971
id: changed-files
70-
uses: tj-actions/changed-files@v45
72+
uses: yumemi-inc/changed-files@v3
7173

7274
- name: List all relevant changed files
73-
if: steps.changed-files.outputs.any_changed == 'true'
75+
if: steps.changed-files.outputs.exists == 'true'
7476
env:
75-
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
77+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.files }}
7678
run: |
7779
for file in ${ALL_CHANGED_FILES}; do
7880
echo "$file was changed"
@@ -82,7 +84,7 @@ jobs:
8284
- name: Get CodeQL Languages
8385
id: set-matrix
8486
run: |
85-
matrix=$(python scripts/get_codeql_languages.py --event ${{ github.event_name}} ${{ steps.changed-files.outputs.all_changed_files }})
87+
matrix=$(python scripts/get_codeql_languages.py --event ${{ github.event_name}} ${{ steps.changed-files.outputs.files }})
8688
echo "${matrix}"
8789
echo "matrix={\"include\": ${matrix}}" >> $GITHUB_OUTPUT
8890
@@ -122,15 +124,21 @@ jobs:
122124
if: ${{ github.event_name == 'pull_request' }}
123125
run: rm -f ${{ matrix.paths-ignore }}
124126

127+
- name: Read repo config
128+
uses: pietrobolcato/[email protected]
129+
id: repo-config
130+
with:
131+
config: repo-config.yml
132+
125133
- name: Set up Python
126134
uses: actions/setup-python@v5
127135
with:
128-
python-version: "3.11"
136+
python-version: "${{ steps.repo-config.outputs['python-version'] }}"
129137

130138
- name: Run Poetry Image
131139
uses: abatilo/actions-poetry@v3
132140
with:
133-
poetry-version: "2.1.1"
141+
poetry-version: "${{ steps.repo-config.outputs['poetry-version'] }}"
134142

135143
- name: Install Dependencies
136144
run: poetry install

.github/workflows/readme.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
paths:
1010
- 'archive/**'
1111
- '.glotter.yml'
12+
- 'repo-config.yml'
1213
- '.github/workflows/readme.yml'
1314
- 'pyproject.toml'
1415
- 'poetry.lock'
@@ -17,26 +18,25 @@ jobs:
1718
readme:
1819
name: "README Generation"
1920

20-
strategy:
21-
fail-fast: true
22-
matrix:
23-
python-version: ["3.11"]
24-
poetry-version: ["2.1.1"]
25-
os: [ubuntu-latest]
26-
27-
runs-on: ${{ matrix.os }}
21+
runs-on: ubuntu-latest
2822
steps:
2923
- uses: actions/checkout@v4
30-
24+
25+
- name: Read repo config
26+
uses: pietrobolcato/[email protected]
27+
id: repo-config
28+
with:
29+
config: repo-config.yml
30+
3131
- name: Set up Python
3232
uses: actions/setup-python@v5
3333
with:
34-
python-version: ${{ matrix.python-version }}
34+
python-version: "${{ steps.repo-config.outputs['python-version'] }}"
3535

3636
- name: Run Poetry Image
3737
uses: abatilo/actions-poetry@v3
3838
with:
39-
poetry-version: ${{ matrix.poetry-version }}
39+
poetry-version: "${{ steps.repo-config.outputs['poetry-version'] }}"
4040

4141
- name: Install Dependencies
4242
run: poetry install

.github/workflows/test-suite.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- 'archive/**'
1010
- '.glotter.yml'
11+
- 'repo-config.yml'
1112
- '.github/workflows/test-suite.yml'
1213
- 'pyproject.toml'
1314
- 'poetry.lock'
@@ -28,31 +29,31 @@ jobs:
2829
runs-on: ubuntu-latest
2930

3031
outputs:
31-
status: ${{ steps.changed-files.outputs.any_changed }}
32-
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
32+
status: ${{ steps.changed-files.outputs.exists }}
33+
changed_files: ${{ steps.changed-files.outputs.files }}
3334
steps:
3435
- uses: actions/checkout@v4
3536
with:
3637
fetch-depth: 2
3738

3839
- name: Get changed code files
3940
id: changed-files
40-
uses: tj-actions/changed-files@v45
41+
uses: yumemi-inc/changed-files@v3
4142
with:
42-
files: |
43+
patterns: |
4344
archive/**
4445
.glotter.yml
46+
repo-config.yml
4547
.github/workflows/test-suite.yml
4648
pyproject.toml
4749
poetry.lock
4850
scripts/run_tests.py
49-
files_ignore: |
50-
**/*.md
51+
!**/*.md
5152
5253
- name: List all relevant changed files
53-
if: steps.changed-files.outputs.any_changed == 'true'
54+
if: steps.changed-files.outputs.exists == 'true'
5455
env:
55-
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
56+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.files }}
5657
run: |
5758
for file in ${ALL_CHANGED_FILES}; do
5859
echo "$file was changed"
@@ -64,29 +65,27 @@ jobs:
6465
needs: changed-files
6566
if: needs.changed-files.outputs.status == 'true' || ${{ github.event_name == 'schedule' }}
6667

67-
strategy:
68-
fail-fast: true
69-
matrix:
70-
python-version: ["3.11"]
71-
poetry-version: ["2.1.1"]
72-
os: [ubuntu-latest]
73-
num_batches: [6]
74-
75-
runs-on: ${{ matrix.os }}
68+
runs-on: ubuntu-latest
7669
steps:
7770
- uses: actions/checkout@v4
7871
with:
7972
fetch-depth: 2
8073

74+
- name: Read repo config
75+
uses: pietrobolcato/[email protected]
76+
id: repo-config
77+
with:
78+
config: repo-config.yml
79+
8180
- name: Set up Python
8281
uses: actions/setup-python@v5
8382
with:
84-
python-version: ${{ matrix.python-version }}
83+
python-version: "${{ steps.repo-config.outputs['python-version'] }}"
8584

8685
- name: Run Poetry Image
8786
uses: abatilo/actions-poetry@v3
8887
with:
89-
poetry-version: ${{ matrix.poetry-version }}
88+
poetry-version: "${{ steps.repo-config.outputs['poetry-version'] }}"
9089

9190
- name: Install Dependencies
9291
run: poetry install
@@ -97,7 +96,7 @@ jobs:
9796
- name: Download Docker images, Test Appropriate Sample Programs, Remove Docker Images
9897
run: poetry run python scripts/run_tests.py
9998
--event ${{ github.event_name }}
100-
--num-batches ${{ matrix.num_batches }}
99+
--num-batches ${{ steps.repo-config.outputs['num-batches'] }}
101100
--parallel
102101
--remove
103102
${{ needs.changed-files.outputs.changed_files }}

repo-config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
poetry-version: "2.1.1"
2+
python-version: "3.11"
3+
num-batches: 6

scripts/get_codeql_languages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class LanguageInfo:
3333
}
3434
ALL_CODEQL_LANGUAGES_FILES = {
3535
".github/workflows/codeql-analysis.yml",
36+
"repo-config.yml",
3637
"scripts/get_codeql_languages.py",
3738
"scripts/build_codeql_language.py",
3839
"pyproject.toml",

scripts/run_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
RUN_EVERYTHING_PATHS = {
1414
Path(".glotter.yml"),
15+
Path("repo-config.yml"),
1516
Path("pyproject.toml"),
1617
Path("poetry.lock"),
1718
Path(".github/workflows/test-suite.yml"),

0 commit comments

Comments
 (0)