-
Notifications
You must be signed in to change notification settings - Fork 20
135 lines (126 loc) · 4.07 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Python package
on:
push:
branches: [ develop ]
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ develop ]
jobs:
# https://github.com/actions/runner/issues/1138
check_secrets:
runs-on: ubuntu-latest
outputs:
HAS_TEST_PYPI_PASSWORD: ${{ steps.check.outputs.HAS_TEST_PYPI_PASSWORD }}
steps:
- run: >
echo "::set-output name=HAS_TEST_PYPI_PASSWORD::${{ env.TEST_PYPI_PASSWORD != '' }}";
id: check
env:
TEST_PYPI_PASSWORD: ${{ secrets.test_pypi_password }}
build_tflite:
needs: []
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8']
include:
- python-version: '3.8'
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make venv-create SYSTEM_PYTHON=python
make dev-install-tflite
- name: Test with pytest
run: |
make dev-pytest-tflite
build:
needs: ["check_secrets"]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
include:
- python-version: '3.8'
push-package: true
- os: windows-2019
python-version: '3.8'
- os: macos-latest
python-version: '3.8'
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make dev-venv SYSTEM_PYTHON=python
- name: Lint
run: |
make dev-lint
- name: Test with pytest
run: |
make dev-pytest
- name: Build dist
if: matrix.push-package == true
run: |
make dev-remove-dist dev-build-dist dev-list-dist-contents dev-test-install-dist
- name: Publish distribution to Test PyPI
if: >
matrix.push-package == true
&& needs.check_secrets.outputs.HAS_TEST_PYPI_PASSWORD == 'true'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: matrix.push-package == true && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
docker-build:
runs-on: ubuntu-latest
steps:
- name: Set tags
id: set_tags
run: |
DOCKER_IMAGE=de4code/tf-bodypix
VERSION=""
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest"
else
TAGS="${DOCKER_IMAGE}_unstable:${GITHUB_SHA},${DOCKER_IMAGE}_unstable:latest"
fi
echo "TAGS=${TAGS}"
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{ env.DOCKERHUB_USERNAME != '' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.set_tags.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}