Skip to content

Commit 09c1fbb

Browse files
authored
ci: consolidate workflow logic (#5)
1 parent 8d5db9d commit 09c1fbb

File tree

8 files changed

+106
-68
lines changed

8 files changed

+106
-68
lines changed

.github/actions/setup/action.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Setup
2+
inputs:
3+
github-token:
4+
required: true
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Set up Python
9+
uses: actions/setup-python@v4
10+
with:
11+
python-version: '3.12'
12+
- name: Set up poetry
13+
uses: abatilo/actions-poetry@v2
14+
with:
15+
poetry-version: '2.1.1'
16+
- name: Install dependencies
17+
shell: bash
18+
run: poetry install --all-extras
19+
- name: Lint
20+
shell: bash
21+
run: poetry run poe lint

.github/workflows/ci.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- '**.md'
8+
jobs:
9+
test:
10+
name: Test
11+
uses: ./.github/workflows/test.yaml
12+
tag:
13+
name: Tag
14+
needs: test
15+
permissions:
16+
contents: write
17+
uses: ./.github/workflows/tag.yaml
18+
# TODO: Publish to Pypi.

.github/workflows/ci.yml

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

.github/workflows/pr-metadata.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ jobs:
1919
task_types: '["build","chore","ci","deps","docs","feat","fix","perf","refactor","revert","test"]'
2020
add_scope_label: true
2121
token: ${{ secrets.GITHUB_TOKEN }}
22-

.github/workflows/pr.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: PR
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- '**.md'
8+
jobs:
9+
test:
10+
name: Test
11+
uses: ./.github/workflows/test.yaml

.github/workflows/pr.yml

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

.github/workflows/tag.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Tag
2+
on:
3+
workflow_call:
4+
outputs:
5+
new-version:
6+
value: ${{ jobs.tag.outputs.new-version }}
7+
new-major-version:
8+
value: ${{ jobs.tag.outputs.new-major-version }}
9+
jobs:
10+
tag:
11+
name: Tag
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
outputs:
16+
new-version: ${{ steps.bump-version.outputs.new_version }}
17+
new-major-version: ${{ steps.extract-major-version.outputs.version }}
18+
steps:
19+
- name: Check out
20+
uses: actions/checkout@v4
21+
- name: Bump version and create tag
22+
id: bump-version
23+
uses: mathieudutour/[email protected]
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
- name: Extract major version
27+
id: extract-major-version
28+
if: steps.bump-version.outputs.new_version != ''
29+
run:
30+
echo "version=${PACKAGE_VERSION%%.*}" >>"$GITHUB_OUTPUT"
31+
env:
32+
PACKAGE_VERSION: ${{ steps.bump-version.outputs.new_version }}

.github/workflows/test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test
2+
on:
3+
workflow_call:
4+
inputs:
5+
timeout-minutes:
6+
required: false
7+
type: number
8+
default: 3
9+
jobs:
10+
test:
11+
name: Test
12+
timeout-minutes: ${{ inputs.timeout-minutes }}
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
steps:
17+
- name: Check out
18+
uses: actions/checkout@v4
19+
- name: Set up
20+
uses: ./.github/actions/setup
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Test
24+
run: poetry run pytest

0 commit comments

Comments
 (0)