Skip to content

Commit 2b78b1e

Browse files
authored
Merge pull request #3 from per1234/split-ci
Split repository's CI workflow into functional parts.
2 parents ef24872 + f4649e1 commit 2b78b1e

File tree

2 files changed

+69
-11
lines changed

2 files changed

+69
-11
lines changed

.github/workflows/lint-python.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Lint Python code
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/lint-python.yml'
7+
- 'compilesketches/**.py'
8+
9+
push:
10+
paths:
11+
- '.github/workflows/lint-python.yml'
12+
- 'compilesketches/**.py'
13+
14+
# Scheduled trigger checks for workflow failures resulting from updates to the linting tools
15+
schedule:
16+
# run every Tuesday at 3 AM UTC
17+
- cron: "0 3 * * 2"
18+
19+
# workflow_dispatch event allows the workflow to be triggered manually
20+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
21+
workflow_dispatch:
22+
23+
# repository_dispatch event allows the workflow to be triggered via the GitHub API
24+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
25+
repository_dispatch:
26+
27+
jobs:
28+
lint:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v1
37+
with:
38+
python-version: '3.8.5'
39+
40+
- name: Install flake8
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install --quiet flake8
44+
pip install --quiet pep8-naming
45+
46+
- name: Lint with flake8
47+
env:
48+
PYTHON_PROJECT_PATH: ${GITHUB_WORKSPACE}/compilesketches
49+
run: |
50+
flake8 --config "${{ env.PYTHON_PROJECT_PATH }}/.flake8" --show-source "${{ env.PYTHON_PROJECT_PATH }}"

.github/workflows/libraries_compile-examples.yml renamed to .github/workflows/test-python.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
name: libraries/compile-examples workflow
1+
name: Test Python code
22

33
on:
44
pull_request:
55
paths:
6-
- '.github/workflows/libraries_compile-examples.yml'
7-
- 'libraries/compile-examples/**'
6+
- '.github/workflows/test-python.yml'
7+
- 'compilesketches/**'
88

99
push:
1010
paths:
11-
- '.github/workflows/libraries_compile-examples.yml'
12-
- 'libraries/compile-examples/**'
11+
- '.github/workflows/test-python.yml'
12+
- 'compilesketches/**'
13+
14+
# The actions/setup-python action will periodically break the workflow by dropping the Python version we have pinned
15+
# Better to catch that before it causes confusion for a contributor
16+
schedule:
17+
# run every Tuesday at 3 AM UTC
18+
- cron: "0 3 * * 2"
19+
20+
# workflow_dispatch event allows the workflow to be triggered manually
21+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
22+
workflow_dispatch:
23+
24+
# repository_dispatch event allows the workflow to be triggered via the GitHub API
25+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
26+
repository_dispatch:
1327

1428
jobs:
1529
test:
@@ -33,12 +47,6 @@ jobs:
3347
python -m pip install --upgrade pip
3448
pip install --requirement "${{ env.PYTHON_PROJECT_TESTS_PATH }}/requirements.txt"
3549
36-
- name: Lint with flake8
37-
run: |
38-
pip install --quiet flake8
39-
pip install --quiet pep8-naming
40-
flake8 --config "${{ env.PYTHON_PROJECT_PATH }}/.flake8" --show-source "${{ env.PYTHON_PROJECT_PATH }}"
41-
4250
- name: Run Python unit tests and report code coverage
4351
run: |
4452
export PYTHONPATH="${{ env.PYTHON_PROJECT_PATH }}"

0 commit comments

Comments
 (0)