Skip to content

Commit b3e9a55

Browse files
committed
github: Add PR/CI workflows to test the actions
1 parent 60e0436 commit b3e9a55

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

.github/workflows/CI.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
test_actions:
13+
name: Test actions
14+
uses: ./.github/workflows/test_actions.yml

.github/workflows/PR.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
run_ci:
17+
name: Run CI
18+
uses: ./.github/workflows/CI.yml

.github/workflows/test_actions.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Test actions
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
test_check_project_version:
9+
name: Test check-project-version
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out repo
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
- name: Set up Python
15+
uses: ./setup-python
16+
- name: Set up Poetry
17+
uses: ./setup-poetry
18+
- name: Create project with version 1.0.0
19+
run: |
20+
poetry new test-project
21+
poetry version 1.0.0 -C test-project
22+
- name: Check version == 1.0.0
23+
uses: ./check-project-version
24+
with:
25+
project-directory: test-project
26+
expected-version: 1.0.0
27+
- name: Create a notice about the expected failure
28+
run: echo "::notice title=Notice::The next step is expected to fail."
29+
- name: Check version == 1.0.1 (expected to fail)
30+
id: expected-failure
31+
continue-on-error: true
32+
uses: ./check-project-version
33+
with:
34+
project-directory: test-project
35+
expected-version: 1.0.1
36+
- name: Error if the previous step didn't fail
37+
if: steps.expected-failure.conclusion != 'failure'
38+
run: |
39+
echo "::error title=Test Failure::The previous step did not fail as expected."
40+
exit 1
41+
test_update_project_version:
42+
name: Test update-project-version
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Check out repo
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
- name: Set up Python
48+
uses: ./setup-python
49+
- name: Set up Poetry
50+
uses: ./setup-poetry
51+
- name: Create project with version 1.0.0
52+
run: |
53+
poetry new test-project
54+
poetry version 1.0.0 -C test-project
55+
- name: Update version to 1.0.1
56+
uses: ./update-project-version
57+
with:
58+
project-directory: test-project
59+
create-pull-request: false
60+
version-rule: patch
61+
use-dev-suffix: false
62+
- name: Check version == 1.0.1
63+
uses: ./check-project-version
64+
with:
65+
project-directory: test-project
66+
expected-version: 1.0.1
67+
- name: Update version to 1.0.2.dev0
68+
uses: ./update-project-version
69+
with:
70+
project-directory: test-project
71+
create-pull-request: false
72+
- name: Check version == 1.0.2.dev0
73+
uses: ./check-project-version
74+
with:
75+
project-directory: test-project
76+
expected-version: 1.0.2.dev0
77+
- name: Update version to 1.0.2.dev1
78+
uses: ./update-project-version
79+
with:
80+
project-directory: test-project
81+
create-pull-request: false
82+
- name: Check version == 1.0.2.dev1
83+
uses: ./check-project-version
84+
with:
85+
project-directory: test-project
86+
expected-version: 1.0.2.dev1

0 commit comments

Comments
 (0)