-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (89 loc) · 2.72 KB
/
prerelease.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
name: PreRelease
on:
push:
branches:
- dev
jobs:
tests:
name: "${{ matrix.python-version }} / ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
include:
- { python-version: 3.9, os: ubuntu-latest }
steps:
- name: Check out the repository
uses: actions/[email protected]
- name: Set up Python {{ "${{ matrix.python-version }}" }}
uses: actions/[email protected]
with:
python-version: "${{ matrix.python-version }}"
- name: Upgrade pip
run: |
pip install --upgrade pip
pip --version
- name: Install dependencies
run: |
pip install poetry
poetry --version
poetry install
- name: Run lint
run: |
poetry run flake8 src/plasticorigins/
- name: Run tests
run: |
cd models/
sh download_pretrained_base.sh
cd ..
poetry run coverage run -m pytest
poetry run coverage xml
rm models/mobilenet_v3_pretrained.pth
release:
needs: [tests]
name: "release"
runs-on: "ubuntu-latest"
steps:
- name: Check out the repository
uses: actions/[email protected]
- name: Set up Python {{ "${{ matrix.python-version }}" }}
uses: actions/[email protected]
with:
python-version: "3.8"
- name: Upgrade pip
run: |
pip install --upgrade pip
pip --version
- name: Install dependencies
run: |
pip install poetry
poetry --version
poetry install
- name: Get Dev Version
id: get-dev-version
run: |
echo "::set-output name=version::$(poetry version --short)"
- name: Check Version
id: check-version
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
echo "::set-output name=tag::$(poetry version --short)"
echo "::set-output name=branch::$(echo $GITHUB_REF | cut -d'/' -f 3)"
- name: Build project for distribution
run: poetry build
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.check-version.outputs.tag }}
draft: false
commit: ${{ steps.check-version.outputs.branch }}
prerelease: steps.check-version.outputs.prerelease == 'true'
allowUpdates: true
- name: Publish to Pypi
run: |
poetry version
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish