-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.61 KB
/
python-app.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
name: Run Tests & Deploy
on: [push]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install poetry && poetry config virtualenvs.create false
python -m venv /opt/venv
poetry install --no-interaction --no-root
- name: Install packages needed for CI
run: pip install pre-commit pytest
- name: Lint all files
run: pre-commit run --all-files --show-diff-on-failure
- name: Run tests
env:
SOURCE_API_BASE: ${{secrets.SOURCE_API_BASE}}
SOURCE_USERNAME: ${{secrets.SOURCE_USERNAME}}
SOURCE_PASSWORD: ${{secrets.SOURCE_PASSWORD}}
TARGET_API_BASE: ${{secrets.TARGET_API_BASE}}
TARGET_USERNAME: ${{secrets.TARGET_USERNAME}}
TARGET_PASSWORD: ${{secrets.TARGET_PASSWORD}}
run: pytest tests
deploy:
runs-on: ubuntu-latest
needs: build-and-test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PUBLISH_TOKEN }}
- name: Semantic release
uses: relekang/python-semantic-release@master
with:
# Personal Access Token that belongs to an admin of the repo must
# be set in PUBLISH_TOKEN secret to bypass `main` branch protection
github_token: ${{ secrets.PUBLISH_TOKEN }}