-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (72 loc) · 2.05 KB
/
test.yml
File metadata and controls
74 lines (72 loc) · 2.05 KB
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
name: Tests
# This action should run on every commit
on: [push, pull_request]
env:
# override poetry virtual env location
# required for actions/setup-python@v3 can cache poetry correctly
POETRY_VIRTUALENVS_IN_PROJECT: false
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v2.0.3
env:
# skip the check that throws on `main` branch
SKIP: no-commit-to-branch
test:
name: Test Python scripts
runs-on: ubuntu-latest
defaults:
run:
working-directory: d3-cli
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- run: poetry run pytest # tests whether our Python code works
publish:
name: Publish pypi package
permissions:
# required to bump version
contents: write
runs-on: ubuntu-latest
# d3build is slow, so only run if lint passes
needs: [pre-commit, test]
# Only run on main branch, as the build is resource intensive
if:
contains('
refs/heads/main
', github.ref)
defaults:
run:
working-directory: d3-cli
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
pip uninstall -y keyring
poetry --version
- name: Publish package
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
POETRY_HTTP_BASIC_PYPI_USERNAME: NquiringMinds
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry version patch
poetry build
poetry publish