-
Notifications
You must be signed in to change notification settings - Fork 53
41 lines (37 loc) · 1.13 KB
/
cicd.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
# Run unit and integration tests for CI
# Build any branch that passes CI as a docker image
# Push a docker image tagged with the git hash and branch name
# For PR's, display the option to deploy to the test env
# For merges to main, display the option to deploy to the dev env
# The environments are configured in the GitHub repo settings
name: CI/CD
on:
push:
branches:
- '**'
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-venv
- name: Run mypy & service tests
run: |
source venv/bin/activate
mypy optionlab/ --ignore-missing-imports
black . --check --diff --color
pytest -m "not benchmark"
publish:
name: Publish to pypi.org
if: github.event.ref == 'refs/heads/main'
needs: [ tests ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-venv
- name: Build and publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi "$PYPI_TOKEN"
poetry publish --build