-
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (99 loc) · 3.6 KB
/
test.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
# This is a basic workflow to help you get started with Actions
name: Test & Test-Publish
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, ]
pull_request:
branches: [ main, ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
name: Test
# The type of runner that the job will run on
strategy:
matrix:
python-version: ["3.10"]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Setup Poetry
# https://github.com/abatilo/actions-poetry
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.2.0"
# View poetry help
- name: View Poetry Help
run: poetry --help
# Install dependencies
- name: Install dependencies with test dependencies
run: poetry install --with test --no-root
# Test with PyTest and Coverage
- name: Test with PyTest and Coverage
run: poetry run invoke pytest-cov
# Build wheels and source tarball
# todo: Note that, at the moment, only pure python wheels are supported. Restriction due to poetry build system
- name: Build wheels and source tarball
run: |
poetry version
poetry build
poetry publish --dry-run --username=__token__ --password=${{ secrets.PYPI_API_TOKEN}}
publish_dev_build:
name: Publish Dev Build
# if test failed, we should not publish
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Setup Poetry
# https://github.com/abatilo/actions-poetry
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.2.0"
- name: Install build dependencies
run: poetry install --with build --no-root
# We are aware that this does not change version in all places as
# we are using poetry for bumping version.
# But Note that this is intended as it is just for dev purpose ;)
- name: Build wheels and source tarball
run: |
poetry version
poetry version --short
poetry version $(poetry version --short)dev$GITHUB_RUN_NUMBER
poetry build
poetry publish --dry-run --username=__token__ --password=${{ secrets.TEST_PYPI_API_TOKEN}}
- name: Check wheels and source tarball
run: poetry run twine check dist/*
- name: List files
run: |
cd dist
ls -l .
cd ..
# todo: temporary block publishing to test pypi
# Know more at https://github.com/pypa/gh-action-pypi-publish
# - name: Publish to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN}}
# repository_url: https://test.pypi.org/legacy/
# skip_existing: true
# verbose: true