File tree 4 files changed +101
-32
lines changed
4 files changed +101
-32
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : _build
3
+
4
+ on :
5
+ workflow_call :
6
+ inputs :
7
+ python_version :
8
+ description : The Python version.
9
+ type : string
10
+ required : false
11
+ default : ' 3.11'
12
+ runs_on :
13
+ description : The runner environment.
14
+ type : string
15
+ required : false
16
+ default : ubuntu-latest
17
+ outputs :
18
+ artifact_name :
19
+ description : The artifact name.
20
+ value : build-${{ github.sha }}
21
+
22
+ jobs :
23
+ build :
24
+ name : Package
25
+ runs-on : ubuntu-latest
26
+ timeout-minutes : 30
27
+ steps :
28
+ - name : Checkout
29
+ uses : actions/checkout@v3
30
+ - name : Setup
31
+ uses : ./.github/actions/setup
32
+ with :
33
+ python_version : ${{ inputs.python_version }}
34
+ - name : Build
35
+ run : make build
36
+ - name : Upload artifact
37
+ uses : actions/upload-artifact@v3
38
+ with :
39
+ name : build-${{ github.sha }}
40
+ if-no-files-found : error
41
+ path : dist/
Original file line number Diff line number Diff line change @@ -3,6 +3,11 @@ name: _publish
3
3
4
4
on :
5
5
workflow_call :
6
+ inputs :
7
+ artifact_name :
8
+ description : The artifact name.
9
+ type : string
10
+ required : true
6
11
secrets :
7
12
registry_token :
8
13
description : The package registry token.
@@ -20,10 +25,10 @@ jobs:
20
25
uses : ./.github/actions/setup
21
26
with :
22
27
install_dependencies : ' false'
23
- - name : Download artifacts
28
+ - name : Download artifact
24
29
uses : actions/download-artifact@v3
25
30
with :
26
- name : ${{ github.sha }}
31
+ name : ${{ inputs.artifact_name }}
27
32
path : dist/
28
33
- name : Publish
29
34
run : poetry publish --skip-existing -u $USERNAME -p $PASSWORD
Original file line number Diff line number Diff line change 58
58
run : make lint
59
59
build :
60
60
name : Build (Python ${{ matrix.python }} on ${{ matrix.os_name }})
61
- runs-on : ${{ matrix.os }}
62
- timeout-minutes : 30
61
+ uses : ./.github/workflows/_build.yml
62
+ with :
63
+ python_version : ${{ matrix.python }}
64
+ runs_on : ${{ matrix.os }}
63
65
strategy :
64
66
fail-fast : false
65
67
matrix :
@@ -77,12 +79,45 @@ jobs:
77
79
os_name : macOS
78
80
- os : windows-latest
79
81
os_name : Windows
82
+ install :
83
+ name : Install (Python ${{ matrix.python }} on ${{ matrix.os_name }})
84
+ runs-on : ${{ matrix.os }}
85
+ timeout-minutes : 30
86
+ needs : build
87
+ strategy :
88
+ fail-fast : false
89
+ matrix :
90
+ os :
91
+ - ubuntu-latest
92
+ - macos-latest
93
+ python :
94
+ - ' 3.10'
95
+ - ' 3.11'
96
+ include :
97
+ - os : ubuntu-latest
98
+ os_name : Linux
99
+ - os : macos-latest
100
+ os_name : macOS
80
101
steps :
81
- - name : Checkout
82
- uses : actions/checkout@v3
83
- - name : Setup
84
- uses : ./.github/actions/setup
102
+ - name : Setup Python
103
+ uses : actions/setup-python@v4
85
104
with :
86
- python_version : ${{ matrix.python }}
87
- - name : Build
88
- run : make build
105
+ python-version : ${{ matrix.python }}
106
+ - name : Download artifact
107
+ uses : actions/download-artifact@v3
108
+ with :
109
+ name : ${{ needs.build.outputs.artifact_name }}
110
+ path : .
111
+ - name : Get meta
112
+ id : meta
113
+ run : echo "whl=$(ls *.whl | head -n1)" >> $GITHUB_OUTPUT
114
+ - name : Install
115
+ run : pip install $PACKAGE
116
+ env :
117
+ PACKAGE : ${{ steps.meta.outputs.whl }}
118
+ - name : Import
119
+ run : echo "import $PACKAGE_IMPORT_NAME" > main.py
120
+ env :
121
+ PACKAGE_IMPORT_NAME : makenew_pypackage
122
+ - name : Run
123
+ run : python main.py
Original file line number Diff line number Diff line change 9
9
- v*
10
10
11
11
jobs :
12
- artifacts :
13
- name : Build artifacts
14
- runs-on : ubuntu-latest
15
- timeout-minutes : 30
16
- steps :
17
- - name : Checkout
18
- uses : actions/checkout@v3
19
- - name : Setup
20
- uses : ./.github/actions/setup
21
- - name : Build
22
- run : make build
23
- - name : Upload artifacts
24
- uses : actions/upload-artifact@v3
25
- with :
26
- name : ${{ github.sha }}
27
- if-no-files-found : error
28
- path : dist/
12
+ build :
13
+ name : Build
14
+ uses : ./.github/workflows/_build.yml
29
15
release :
30
16
name : GitHub Releases
31
17
runs-on : ubuntu-latest
32
18
timeout-minutes : 30
33
- needs : artifacts
19
+ needs : build
34
20
steps :
35
21
- name : Checkout
36
22
uses : actions/checkout@v3
37
- - name : Download artifacts
23
+ - name : Download artifact
38
24
uses : actions/download-artifact@v3
39
25
with :
40
- name : ${{ github.sha }}
26
+ name : ${{ needs.build.outputs.artifact_name }}
41
27
path : dist/
42
28
- name : Create GitHub release
43
29
uses : softprops/action-gh-release@v1
49
35
pypi :
50
36
name : PyPI
51
37
uses : ./.github/workflows/_publish.yml
52
- needs : artifacts
38
+ needs : build
39
+ with :
40
+ artifact_name : ${{ needs.build.outputs.artifact_name }}
53
41
secrets :
54
42
registry_token : ${{ secrets.PYPI_API_TOKEN }}
You can’t perform that action at this time.
0 commit comments