generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (75 loc) · 2.96 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
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
75
76
77
78
79
80
81
82
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: CI Build and Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install . .[dev]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
for f in tests/test*; do
pytest $f --memray --cov=gval --cov-report term-missing --cov-append --db ./monitordb
done
python ./tests/remote_benchmark.py
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
with:
output: docs/images/coverage.svg
- uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.event_name == 'pull_request' && matrix.python == '3.10'}}
with:
commit_message: "Testing and performance monitoring"
push_options: '--force'
skip_checkout: true
file_pattern: '*.svg *monitordb *remote_performance_report.csv'
disable_globbing: true
branch: testing
create_branch: true
- name: Sphinx build
run: |
sudo chown -R runner:runner /usr/local/bin
wget -P /usr/local/bin https://github.com/jgm/pandoc/releases/download/3.1/pandoc-3.1-linux-amd64.tar.gz
tar -xf /usr/local/bin/pandoc-3.1-linux-amd64.tar.gz --directory /usr/local/bin/
cp /usr/local/bin/pandoc-3.1/bin/pandoc /usr/local/bin/pandoc
sphinx-build docs/sphinx docs/sphinx/_build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'pull_request' && matrix.python == '3.10'}}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/sphinx/_build/
force_orphan: true