-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (68 loc) · 1.88 KB
/
test_build_deploy.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
name: Test, Build & Deploy FireFrame
on:
release:
types: [published]
pull_request:
branches:
- main
env:
PROJECT_ID: ${{ secrets.FIREBASE_TEST_PROJECT_ID }}
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: 'actions/checkout@v4'
- uses: 'psf/black@stable'
with:
version: '23.11.0'
src: './'
options: '--line-length 120 --check'
Test:
needs: Lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: 'actions/checkout@v4'
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- run: |
gcloud config set project $PROJECT_ID
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[test]
- name: Run tests
env:
GOOGLE_CLOUD_PROJECT: ${{ secrets.FIREBASE_TEST_PROJECT_ID }}
run: |
export GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_GHA_CREDS_PATH
pytest -n 4
Build-Deploy:
needs: [Lint, Test]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: 'actions/checkout@v4'
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}