This repository has been archived by the owner on Dec 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (56 loc) · 1.88 KB
/
test.yaml
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
# This workflow tests our package
name: Test
# controls when the action will run
on:
pull_request:
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
environment: testpypi
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.2.1
- name: Install dependencies
run: poetry install
- name: Lint
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
flake8 .
- name: Test
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
pytest tests
poetryup -vv
- name: Validate Project Version
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
NEW_VERSION=$(poetry version --short)
git fetch --no-tags && git checkout --force master
OLD_VERSION=$(poetry version --short)
echo "NEW_VERSION ${NEW_VERSION} OLD_VERSION ${OLD_VERSION}"
if [[ "$NEW_VERSION" == "$OLD_VERSION" ]]; then
echo "Make sure to bump project version"
exit 1 # operation not permitted
fi
- name: Build
run: poetry build
- name: Publish testpypi dry-run
env:
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{secrets.TESTPYPI_API_TOKEN}}
run: poetry publish -r testpypi --dry-run