-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (91 loc) · 2.7 KB
/
build.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
name: build
on:
push:
pull_request:
branches: [ main, beta ]
types: [ opened, reopened, synchronize ]
env:
ACCESS_TOKEN: ${{ secrets.MB_ACCESS_TOKEN }}
ORG_ID: ${{ vars.ORG_ID }}
ORG_NAME: ${{ vars.ORG_NAME }}
MB_BASE_URL: ${{ vars.MB_BASE_URL}}
NUMBER_OF_MEMBERS: ${{ vars.NUMBER_OF_MEMBERS }}
TEAM_NAME: ${{ vars.TEAM_NAME }}
jobs:
pkg-and-docs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
poetry-version: [1.6]
steps:
- name: setup python ${{matrix.python-version}}
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Check-out repository
uses: actions/checkout@v3
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install package
run: poetry install
- name: Test
run: poetry run pytest tests/ --cov=masterblaster --cov-report=xml
- name: Codecov for coverage tracking
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
- name: Docs
run: poetry run make html --directory docs/
deploy:
needs: pkg-and-docs
if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
strategy:
matrix:
python-version: ['3.10']
poetry-version: [1.6]
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Check-out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install package
run: poetry install
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.PAT }}
- name: Build
run: poetry build
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Test install from TestPyPI
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
masterblaster-py
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}