-
Notifications
You must be signed in to change notification settings - Fork 9
107 lines (93 loc) · 3.16 KB
/
main.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: CI
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
jobs:
build-and-deploy:
defaults:
run:
# Ensures environment gets sourced right
shell: bash -l -e {0}
name: Python (${{ matrix.PYTHON_VERSION }})
runs-on: ubuntu-latest
strategy:
matrix:
PYTHON_VERSION: ["3.9", "3.11", "3.12"]
env:
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
steps:
- uses: actions/checkout@v4
with:
# we need a reasonable depth so that the most recent tag is available
fetch-depth: 500
- name: Run IEM Database container
run: |
docker run -d --name iem_database -p 5432:5432 ghcr.io/akrherz/iem_database:test_data
until docker exec iem_database pg_isready -h localhost; do
sleep 6
done
- name: Add /etc/hosts entries
run: |
cat .github/workflows/etchosts.txt | sudo tee -a /etc/hosts
# setup conda-forge with micromamba
- name: Setup Python
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- defaults
create-args: >-
python=${{ env.PYTHON_VERSION }}
environment-name: prod
cache-environment: true
- name: Setup Memcached
run: |
. .ci_tooling/memcached.sh
- name: Install pyiem
run: |
python -m pip install . --upgrade --no-deps
- name: Populate Data
run: |
set -x
sudo ln -s /home/runner/micromamba /opt/miniconda3
python util/create_transformed_parquet.py --justgeodf
python util/insert_testing_data.py
sudo mkdir -p /opt/iem/config
sudo wget --timeout=10 -O /opt/iem/config/navbar.json https://raw.githubusercontent.com/akrherz/iem/main/config/navbar.json
- name: Run Tests
run: |
# get pqinsert available as a dummy command
export PATH=$PATH:$(pwd)/tests/bin
# xdist and coverage seems to necessitate this
python -m pytest --cov=pyiem -n 4 --mpl --mpl-generate-summary=html \
--mpl-results-path=mplresults-${{ matrix.PYTHON_VERSION }}
python -m coverage xml
- name: Upload Test Results, if failed
if: failure()
uses: actions/upload-artifact@v4
with:
name: mplresults-${{ matrix.PYTHON_VERSION }}
path: mplresults-${{ matrix.PYTHON_VERSION }}
retention-days: 1
- name: Code coverage
if: ${{ matrix.PYTHON_VERSION == '3.12' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
- name: Build Docs
if: ${{ matrix.PYTHON_VERSION == '3.12' }}
run: |
cd docs
make html
touch build/html/.nojekyll
- name: Deploy Docs
if: ${{ matrix.PYTHON_VERSION == '3.12' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy. This example folder is generated by Sphinx