-
Notifications
You must be signed in to change notification settings - Fork 74
115 lines (96 loc) · 2.85 KB
/
ci.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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Pre-Commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
Quality:
needs: Pre-Commit
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{matrix.python-version}}
- name: Install Python Poetry
uses: abatilo/[email protected]
- name: Configure poetry
shell: bash
run: python -m poetry config virtualenvs.in-project true
- name: View poetry version
run: poetry --version
- name: Install dependencies
run: |
python -m poetry install
- name: Test
run: poetry run python3 -m unittest discover -v
Release:
needs: Quality
if: |
github.repository == 'autonlab/auton-survival' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
!contains ( github.event.head_commit.message, 'chore(release)' )
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write
steps:
- uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check release status
id: release-status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install python-semantic-release
if semantic-release --noop --strict version
then
echo "Releasing new version."
else
echo "Skipping release steps."
fi
- if: steps.release-status.outputs.released == 'true'
name: Release to GitHub
id: github-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
semantic-release version
git fetch --tags
for file in ./dist/**
do gh release upload "${{steps.release-status.outputs.tag}}" $file
done
- if: steps.release-status.outputs.released == 'true'
name: Release to Test PyPI
id: test-pypi-release
env:
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi $TEST_PYPI_TOKEN
poetry publish -r test-pypi -u __token__
- if: steps.release-status.outputs.released == 'true'
name: Release to PyPI
id: pypi-release
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish