Skip to content

Commit 1165be0

Browse files
authored
Tune CI (#213)
1 parent 639f29d commit 1165be0

File tree

4 files changed

+79
-150
lines changed

4 files changed

+79
-150
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,40 @@ name: CI
33
on:
44
push:
55
branches: [master]
6-
tags: [v*]
6+
tags: ['v*']
77
pull_request:
88
branches: [master]
9-
pull_request_target:
10-
branches: [master]
119
schedule:
1210
- cron: 0 4 * * *
11+
1312
jobs:
1413
test:
15-
name: Run tests
14+
name: All checks are passed
15+
uses: ./.github/workflows/test.yaml
16+
17+
approve:
18+
name: Approve bot PR
1619
runs-on: ubuntu-latest
17-
if: |
18-
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') ||
19-
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]')
20-
strategy:
21-
matrix:
22-
py_version: ['3.9', '3.10', '3.11', '3.12', '3.13']
20+
if: endsWith(github.actor, '[bot]')
21+
needs: test
22+
permissions:
23+
contents: write
24+
pull-requests: write
2325
steps:
24-
- name: Checkout commit
25-
uses: actions/checkout@v4
26-
with:
27-
ref: ${{ github.event.pull_request.head.sha }}
28-
- name: Install python
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: ${{ matrix.py_version }}
32-
- name: Cache packages
33-
uses: actions/cache@v4
34-
with:
35-
path: ~/.cache/pip
36-
key: ${{ runner.os }}-py-${{ matrix.py_version }}-${{ hashFiles('setup.py')
37-
}}-${{ hashFiles('requirements.txt') }}
38-
- name: Install dependencies
39-
run: make setup
40-
- name: Lint
41-
run: |
42-
echo "::add-matcher::.github/actionlint-matcher.json"
43-
make lint
44-
env:
45-
CI_LINT_RUN: 1
46-
- name: Run tests
47-
run: make test
48-
- name: Upload coverage to Codecov
49-
uses: codecov/codecov-action@v5
50-
with:
51-
files: ./.coverage.xml
52-
flags: py${{ matrix.py_version }}
53-
name: codecov
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: metadata
29+
id: metadata
30+
if: github.actor == 'dependabot[bot]'
31+
uses: dependabot/fetch-metadata@v1
32+
with:
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Enable auto-merge for bot PRs
35+
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
36+
env:
37+
PR_URL: ${{ github.event.pull_request.html_url }}
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
5440
deploy:
5541
name: Release client
5642
runs-on: ubuntu-latest

.github/workflows/remove-automerge.yml

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

.github/workflows/setup-automerge.yml

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

.github/workflows/test.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
workflow_call: {}
3+
4+
jobs:
5+
test:
6+
name: Run tests
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
py_version: ['3.9', '3.10', '3.11', '3.12', '3.13']
11+
steps:
12+
- name: Checkout commit
13+
uses: actions/checkout@v4
14+
with:
15+
ref: ${{ github.event.pull_request.head.sha }}
16+
- name: Install python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.py_version }}
20+
- name: Cache packages
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.cache/pip
24+
key: ${{ runner.os }}-py-${{ matrix.py_version }}-${{ hashFiles('setup.py')
25+
}}-${{ hashFiles('requirements.txt') }}
26+
- name: Install dependencies
27+
run: make setup
28+
- name: Lint
29+
run: |
30+
echo "::add-matcher::.github/actionlint-matcher.json"
31+
make lint
32+
env:
33+
CI_LINT_RUN: 1
34+
- name: Run tests
35+
run: make test
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v5
38+
with:
39+
files: ./.coverage.xml
40+
flags: py${{ matrix.py_version }}
41+
name: codecov
42+
43+
check:
44+
name: Check
45+
needs:
46+
- test
47+
runs-on: ubuntu-latest
48+
if: always()
49+
steps:
50+
- name: Decide whether the needed jobs succeeded or failed
51+
uses: re-actors/alls-green@release/v1
52+
with:
53+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)