Skip to content

Commit ff654d1

Browse files
authored
Merge pull request #13 from foundation-model-stack/ci/organize-workflows
[ci]: Restructure GitHub workflows
2 parents fb29817 + 7f69d56 commit ff654d1

File tree

15 files changed

+507
-99
lines changed

15 files changed

+507
-99
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Free Disk Space'
2+
description: 'Frees disk space on the runner'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Print disk space before cleanup
7+
run: |
8+
df -h
9+
shell: bash
10+
- name: Free Disk Space Linux
11+
if: runner.os == 'Linux'
12+
run: |
13+
sudo docker rmi "$(docker image ls -aq)" >/dev/null 2>&1 || true
14+
sudo rm -rf \
15+
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
16+
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
17+
/usr/lib/jvm || true
18+
sudo apt install aptitude -y >/dev/null 2>&1
19+
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
20+
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
21+
sudo apt-get autoremove -y >/dev/null 2>&1
22+
sudo apt-get autoclean -y >/dev/null 2>&1
23+
shell: bash
24+
- name: Print disk space after cleanup
25+
run: |
26+
df -h
27+
shell: bash
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Since dependabot cannot update workflows using docker,
2+
# we use this indirection since dependabot can update this file.
3+
FROM rhysd/actionlint:1.7.4@sha256:82244e1db1c60d82c7792180a48dd0bcb838370bb589d53ff132503fc9485868

.github/workflows/actionlint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Lint GitHub Actions workflows
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
- "release-**"
7+
paths:
8+
- '.github/workflows/*.ya?ml'
9+
- '.github/workflows/actionlint.*' # This workflow
10+
pull_request:
11+
branches:
12+
- "main"
13+
- "release-**"
14+
paths:
15+
- '.github/workflows/*.ya?ml'
16+
- '.github/workflows/actionlint.*' # This workflow
17+
18+
env:
19+
LC_ALL: en_US.UTF-8
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
actionlint:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: "Harden Runner"
33+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
34+
with:
35+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
36+
37+
- name: "Checkout"
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
fetch-depth: 0
41+
42+
- name: "Download actionlint"
43+
run: |
44+
docker build --tag actionlint - < .github/workflows/actionlint.dockerfile
45+
46+
- name: "Check workflow files"
47+
run: |
48+
echo "::add-matcher::.github/workflows/matchers/actionlint.json"
49+
docker run --volume="${PWD}:/repo" --workdir=/repo actionlint -color

.github/workflows/coverage.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/coverage.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "release-**"
8+
paths:
9+
- '**.py'
10+
- 'pyproject.toml'
11+
- 'tox.ini'
12+
- '.github/workflows/coverage.yml' # This workflow
13+
pull_request:
14+
branches:
15+
- "main"
16+
- "release-**"
17+
paths:
18+
- '**.py'
19+
- 'pyproject.toml'
20+
- 'tox.ini'
21+
- '.github/workflows/coverage.yml' # This workflow
22+
23+
env:
24+
LC_ALL: en_US.UTF-8
25+
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
permissions:
31+
contents: read
32+
33+
jobs:
34+
coverage:
35+
# Disable until runner with Nvidia GPU available
36+
if: false
37+
runs-on: ubuntu-latest
38+
name: "coverage: ${{ matrix.coverage.name }}"
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
coverage:
43+
- name: "coverage"
44+
commands: |
45+
tox -e coverage
46+
47+
steps:
48+
- name: "Harden Runner"
49+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
50+
with:
51+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
52+
53+
- name: "Checkout"
54+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55+
with:
56+
# https://github.com/actions/checkout/issues/249
57+
fetch-depth: 0
58+
59+
- name: Setup Python 3.11
60+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
61+
with:
62+
python-version: 3.11
63+
cache: pip
64+
cache-dependency-path: |
65+
**/pyproject.toml
66+
67+
- name: "Install tox"
68+
run: |
69+
python -m pip install --upgrade pip
70+
python -m pip install tox tox-gh
71+
72+
- name: "${{ matrix.coverage.name }}"
73+
run: |
74+
${{ matrix.coverage.commands }}

.github/workflows/format.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "release-**"
8+
paths:
9+
- '**.py'
10+
- 'pyproject.toml'
11+
- 'tox.ini'
12+
- .pylintrc
13+
- '.github/workflows/lint.yml' # This workflow
14+
pull_request:
15+
branches:
16+
- "main"
17+
- "release-**"
18+
paths:
19+
- '**.py'
20+
- 'pyproject.toml'
21+
- 'tox.ini'
22+
- .pylintrc
23+
- '.github/workflows/lint.yml' # This workflow
24+
25+
env:
26+
LC_ALL: en_US.UTF-8
27+
28+
defaults:
29+
run:
30+
shell: bash
31+
32+
permissions:
33+
contents: read
34+
35+
jobs:
36+
lint:
37+
runs-on: ubuntu-latest
38+
name: "lint: ${{ matrix.lint.name }}"
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
lint:
43+
- name: "fmt"
44+
commands: |
45+
tox -e fmt
46+
- name: "pylint"
47+
commands: |
48+
echo "::add-matcher::.github/workflows/matchers/pylint.json"
49+
tox -e lint
50+
51+
steps:
52+
- name: "Harden Runner"
53+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
54+
with:
55+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
56+
57+
- name: "Checkout"
58+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
with:
60+
# https://github.com/actions/checkout/issues/249
61+
fetch-depth: 0
62+
63+
- name: Setup Python 3.11
64+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
65+
with:
66+
python-version: 3.11
67+
cache: pip
68+
cache-dependency-path: |
69+
**/pyproject.toml
70+
71+
- name: "Install tox"
72+
run: |
73+
python -m pip install --upgrade pip
74+
python -m pip install tox tox-gh
75+
76+
- name: "${{ matrix.lint.name }}"
77+
run: |
78+
${{ matrix.lint.commands }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}
18+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "pylint-error",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"message": 4,
13+
"code": 5
14+
}
15+
]
16+
},
17+
{
18+
"owner": "pylint-warning",
19+
"severity": "warning",
20+
"pattern": [
21+
{
22+
"regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$",
23+
"file": 1,
24+
"line": 2,
25+
"column": 3,
26+
"message": 4,
27+
"code": 5
28+
}
29+
]
30+
}
31+
]
32+
}
33+

0 commit comments

Comments
 (0)