44 push :
55 branches : [ master ]
66 tags :
7- - " *"
7+ - " *"
88 paths-ignore :
9- - ' README.md'
10- - ' LICENSE'
11- - ' .gitignore'
12- - ' codecov.yml'
13- - ' .python-version'
14- - ' poetry.toml'
9+ - ' README.md'
10+ - ' LICENSE'
11+ - ' .gitignore'
12+ - ' codecov.yml'
13+ - ' .python-version'
14+ - ' poetry.toml'
1515 pull_request :
1616 branches : [ master ]
1717 paths-ignore :
18- - ' README.md'
19- - ' LICENSE'
20- - ' .gitignore'
21- - ' codecov.yml'
22- - ' .python-version'
23- - ' poetry.toml'
18+ - ' README.md'
19+ - ' LICENSE'
20+ - ' .gitignore'
21+ - ' codecov.yml'
22+ - ' .python-version'
23+ - ' poetry.toml'
2424 workflow_dispatch :
2525 schedule :
26- - cron : ' 30 5 * * 1'
26+ - cron : ' 30 5 * * 1'
2727
2828concurrency :
2929 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
3030 cancel-in-progress : true
3131
3232jobs :
33- test :
34- name : pre-commit and test
33+ pre-commit :
34+ runs-on : ubuntu-22.04
35+ steps :
36+ - uses : actions/checkout@master
37+ - uses : actions/setup-python@v2
38+ with :
39+ python-version : 3.7
40+ - name : Install pre-commit
41+ run : |
42+ pip install pre-commit==2.9.2
43+ - name : Run pre-commit
44+ run : |
45+ pre-commit install
46+ pre-commit run --all-files
47+ unit-test :
3548 runs-on : ${{ matrix.os }}
49+ needs : pre-commit
3650 strategy :
3751 matrix :
3852 python-version : [3.7, 3.8]
@@ -42,12 +56,10 @@ jobs:
4256 shell : bash
4357 steps :
4458 - uses : actions/checkout@master
45- - name : Install Python
46- uses : actions/setup-python@v2
59+ - uses : actions/setup-python@v2
4760 with :
4861 python-version : ${{ matrix.python-version }}
49- - name : Install latest Poetry
50- uses : snok/install-poetry@v1.3.3
62+ - uses : snok/install-poetry@v1.3.3
5163 with :
5264 virtualenvs-create : true
5365 virtualenvs-in-project : true
@@ -58,20 +70,65 @@ jobs:
5870 path : ~/.cache
5971 key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
6072 - name : Install dependencies
61- run : poetry install --no-interaction --no-root --with dev,pdf
73+ run : |
74+ poetry install --no-interaction --no-root --with dev,pdf
6275 - name : Install library
6376 run : poetry install --no-interaction
6477 - run : |
6578 source $VENV
6679 pytest --version
67- - name : Run pre-commit
68- run : |
69- poetry run pre-commit install
70- poetry run pre-commit run --all-files
71- - name : Run tests
80+ - name : Run unit tests and Codecov
7281 run : poetry run pytest -n auto --cov=./ --cov-report=xml
7382 - name : Upload coverage to Codecov
7483 uses : codecov/codecov-action@v1
84+ build :
85+ runs-on : ubuntu-22.04
86+ needs : unit-test
87+ steps :
88+ - uses : actions/checkout@master
89+ - uses : actions/setup-python@v2
90+ with :
91+ python-version : 3.7
92+ - uses : snok/install-poetry@v1.3.3
93+ with :
94+ virtualenvs-create : true
95+ virtualenvs-in-project : true
96+ - name : Build wheels
97+ run : |
98+ poetry build
99+ - name : Upload wheel and tar ball
100+ uses : actions/upload-artifact@v3
101+ with :
102+ name : dist
103+ path : ./dist/*
104+ integration-test :
105+ runs-on : ${{ matrix.os }}
106+ needs : build
107+ strategy :
108+ matrix :
109+ python-version : [3.7, 3.8]
110+ os : [ubuntu-22.04, windows-2022, macos-11]
111+ defaults :
112+ run :
113+ shell : bash
114+ steps :
115+ - uses : actions/setup-python@v2
116+ with :
117+ python-version : ${{ matrix.python-version }}
118+ - name : Download wheel and tar ball built previously
119+ uses : actions/download-artifact@master
120+ with :
121+ name : dist
122+ path : ./dist/
123+ - name : Install wheel
124+ run : |
125+ python -m pip install dist/cmdict-*py3-none-any.whl
126+ - name : Run module as script
127+ run : |
128+ python -m cmdict --help
129+ - name : Run module as executable
130+ run : |
131+ cmdict --help
75132 publish :
76133 if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pastydev/cmdict'
77134 environment :
@@ -80,23 +137,12 @@ jobs:
80137 permissions :
81138 id-token : write
82139 runs-on : ubuntu-22.04
83- needs : test
140+ needs : integration- test
84141 steps :
85- - uses : actions/checkout@master
86- - name : Install dependecies
87- uses : actions/setup-python@v2
88- with :
89- python-version : 3.7
90- cache : pip
91- - name : Install latest Poetry
92- uses : snok/install-poetry@v1.3.3
93- - name : Build wheels
94- run : |
95- poetry build
96- - name : Upload wheel and tar ball as artifacts
97- uses : actions/upload-artifact@v3
98- with :
99- name : dist
100- path : ./dist/*
101- - name : Publish to PyPI
102- uses : pypa/gh-action-pypi-publish@release/v1
142+ - name : Download wheel and tar ball built previously
143+ uses : actions/download-artifact@master
144+ with :
145+ name : dist
146+ path : ./dist/
147+ - name : Publish to PyPI
148+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments