-
Notifications
You must be signed in to change notification settings - Fork 11
70 lines (58 loc) · 1.94 KB
/
code.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
name: Code CI
on:
push:
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"] # can add windows-latest, macos-latest
python: ["3.7", "3.8", "3.9"]
include:
# Tag the Python3.7 runner as the one to publish wheels
- os: "ubuntu-latest"
python: "3.7"
publish: true
name: ${{ matrix.os }}/${{ matrix.python }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install Python Dependencies
run: |
pip install pipenv twine build
pipenv install --dev --deploy --python $(python -c 'import sys; print(sys.executable)') && pipenv graph
- name: Create Sdist and Wheel
if: matrix.publish
# Set SOURCE_DATE_EPOCH from git commit for reproducible build
# https://reproducible-builds.org/
# Set group writable and umask to do the same to match inside DLS
run: |
chmod -R g+w .
umask 0002
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) python -m build --sdist --wheel
- name: Run Tests
run: pipenv run tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
name: ${{ matrix.os }}/${{ matrix.python }}
files: cov.xml
- name: Upload Wheel and Sdist as artifacts
if: matrix.publish
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*
- name: Publish Sdist and Wheel to PyPI
# Only once when on a tag
if: matrix.publish && startsWith(github.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: twine upload dist/*