Skip to content

Commit 891cb63

Browse files
committed
updates CI
1 parent d1050ee commit 891cb63

File tree

3 files changed

+139
-55
lines changed

3 files changed

+139
-55
lines changed

Diff for: .github/file-filters.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
dependencies: &dependencies
2+
- 'pdm.lock'
3+
- 'pyproject.toml'
4+
5+
actions: &actions
6+
- added|modified: './.github/**/*'
7+
8+
python: &python
9+
- added|modified: 'src/**'
10+
- added|modified: 'tests/**'
11+
- added|modified: '.pre-commit-config.yaml'
12+
13+
changelog:
14+
- 'CHANGELOG.md'
15+
16+
run_tests: &tests
17+
- *actions
18+
- *python
19+
- *dependencies
20+
- 'tox.ini'
21+
22+
package:
23+
- *tests
24+
- *dependencies
25+
26+
docs:
27+
- added|modified: './docs/**/*'
28+
- modified: './src/birder/config/__init__.py'
29+
- modified: './github/workflows/docs.yml'
30+
- modified: './github/file-filters.yml'

Diff for: .github/workflows/docs.yml

+74-55
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,90 @@
11
name: "Documentation"
22

33
on:
4-
push:
5-
branches:
6-
- develop
7-
- master
8-
schedule:
9-
- cron: "37 23 * * 2"
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
schedule:
9+
- cron: "37 23 * * 2"
1010

1111
permissions:
12-
contents: read
13-
pages: write
14-
id-token: write
12+
contents: read
13+
pages: write
14+
id-token: write
1515

1616
concurrency:
17-
group: "pages"
18-
cancel-in-progress: false
17+
group: "pages"
18+
cancel-in-progress: false
1919

2020
jobs:
21-
generate:
22-
name: Generate
23-
# if: needs.changes.outputs.docs == 'true'
24-
# needs: changes
25-
runs-on: ubuntu-latest
26-
env:
27-
PYTHONPATH: src/
28-
steps:
29-
- uses: actions/checkout@v4
21+
changes:
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 1
24+
defaults:
25+
run:
26+
shell: bash
27+
outputs:
28+
run_tests: ${{ steps.changes.outputs.docs }}
29+
steps:
30+
- name: Checkout code
31+
uses: actions/[email protected]
32+
- id: changes
33+
name: Check for file changes
34+
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
35+
with:
36+
base: ${{ github.ref }}
37+
token: ${{ github.token }}
38+
filters: .github/file-filters.yml
3039

31-
- name: Set up Python
32-
uses: actions/setup-python@v4
33-
with:
34-
python-version: "3.12"
40+
generate:
41+
name: Generate
42+
if: needs.changes.outputs.docs == 'true'
43+
needs: changes
44+
runs-on: ubuntu-latest
45+
env:
46+
PYTHONPATH: src/
47+
steps:
48+
- uses: actions/checkout@v4
3549

36-
- uses: yezz123/setup-uv@v4
50+
- name: Set up Python
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: "3.12"
3754

38-
- uses: actions/cache/restore@v4
39-
id: restore-cache
40-
with:
41-
path: .venv
42-
key: ${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
55+
- uses: yezz123/setup-uv@v4
4356

44-
- name: Install dependencies
45-
run: uv sync --only-group docs
57+
- uses: actions/cache/restore@v4
58+
id: restore-cache
59+
with:
60+
path: .venv
61+
key: ${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
4662

47-
- name: Build Doc
48-
run: .venv/bin/mkdocs build -d ./docs/output
63+
- name: Install dependencies
64+
run: uv sync --only-group docs
4965

50-
- uses: actions/cache/save@v4
51-
id: cache
52-
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
53-
with:
54-
path: .venv
55-
key: ${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
56-
- name: Upload artifact
57-
uses: actions/upload-pages-artifact@v3
58-
with:
59-
path: ./docs/output
66+
- name: Build Doc
67+
run: .venv/bin/mkdocs build -d ./docs/output
6068

61-
# Deployment job
62-
deploy:
63-
needs: generate
64-
environment:
65-
name: github-pages
66-
url: ${{ steps.deployment.outputs.page_url }}
67-
runs-on: ubuntu-latest
68-
steps:
69-
- name: Deploy to GitHub Pages
70-
id: deployment
71-
uses: actions/deploy-pages@v4
69+
- uses: actions/cache/save@v4
70+
id: cache
71+
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
72+
with:
73+
path: .venv
74+
key: ${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
75+
- name: Upload artifact
76+
uses: actions/upload-pages-artifact@v3
77+
with:
78+
path: ./docs/output
79+
80+
# Deployment job
81+
deploy:
82+
needs: generate
83+
environment:
84+
name: github-pages
85+
url: ${{ steps.deployment.outputs.page_url }}
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Deploy to GitHub Pages
89+
id: deployment
90+
uses: actions/deploy-pages@v4

Diff for: .github/workflows/test.yml

+35
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,29 @@ on:
1010
- cron: "0 8 * * *"
1111

1212
jobs:
13+
changes:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 1
16+
defaults:
17+
run:
18+
shell: bash
19+
outputs:
20+
run_tests: ${{ steps.changes.outputs.run_tests }}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/[email protected]
24+
- id: changes
25+
name: Check for file changes
26+
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
27+
with:
28+
base: ${{ github.ref }}
29+
token: ${{ github.token }}
30+
filters: .github/file-filters.yml
31+
1332
lint:
33+
needs: [ changes ]
34+
if: needs.changes.outputs.run_tests == 'true'
35+
1436
runs-on: ubuntu-latest
1537
steps:
1638
- uses: actions/checkout@v2
@@ -22,8 +44,21 @@ jobs:
2244
- name: Lint with flake8
2345
run: |
2446
pre-commit run --all
47+
pkg_meta:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v2
51+
- uses: actions/setup-python@v2
2552

53+
- name: Install dependencies
54+
run: |
55+
python -m pip install --upgrade pip tox
56+
- name: Lint with flake8
57+
run: |
58+
tox -e pkg_meta
2659
test:
60+
needs: [ changes ]
61+
if: needs.changes.outputs.run_tests == 'true'
2762
services:
2863
redis:
2964
image: redis

0 commit comments

Comments
 (0)