-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (118 loc) · 3.31 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
workflow_call:
inputs:
kind:
required: false
type: string
default: dev
package_command:
required: false
type: string
description: Command used to build python package
default: >-
python -m
build
-C--global-option=egg_info
-C--global-option=--tag-build=+dev$(git rev-parse --short HEAD)
--wheel
--outdir dist/
jobs:
get-changed-files:
name: Get Changed Files
runs-on: ubuntu-latest
permissions:
contents: read # for dorny/paths-filter to fetch a list of changed files
pull-requests: read # for dorny/paths-filter to read pull requests
outputs:
changed-files: ${{ toJSON(steps.changed-files.outputs) }}
steps:
- uses: actions/checkout@v4
- name: Get Changed Files
id: changed-files
uses: dorny/paths-filter@v3
with:
token: ${{ github.token }}
list-files: json
filters: |
repo:
- added|modified:
- '**'
deleted:
- deleted:
- '**'
pre-commit:
name: Pre-Commit
uses: ./.github/workflows/pre-commit-action.yml
needs:
- get-changed-files
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
test:
name: Test
needs:
- get-changed-files
uses: ./.github/workflows/test-action.yml
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
build-python-package:
name: Python Package
uses: ./.github/workflows/package-action.yml
needs:
- pre-commit
- test
with:
kind: "${{ inputs.kind }}"
cmd: "${{ inputs.package_command }}"
test-python-package:
name: Test Python Package
needs:
- get-changed-files
uses: ./.github/workflows/test-package-action.yml
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
deploy-python-package:
name: Deploy Python Package
uses: ./.github/workflows/deploy-package-action.yml
if: ${{ inputs.kind == 'release' && success() }}
needs:
- pre-commit
- test
- test-python-package
- build-python-package
create-release:
name: Create Github Release
uses: ./.github/workflows/github-release.yml
if: ${{ inputs.kind == 'release' && success() }}
needs:
- build-python-package
- deploy-python-package
with:
version: ${{ needs.build-python-package.outputs.version }}
set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
# on a pull request instead of requiring all
name: Set the CI Pipeline Exit Status
runs-on: ubuntu-latest
if: always()
needs:
- pre-commit
- test
- deploy-python-package
- create-release
steps:
- name: Get workflow information
id: get-workflow-info
uses: technote-space/workflow-conclusion-action@v3
- name: Set Pipeline Exit Status
shell: bash
run: |
if [ "${{ steps.get-workflow-info.outputs.conclusion }}" != "success" ]; then
exit 1
else
exit 0
fi
- name: Done
if: always()
run:
echo "All workflows finished"