Merge pull request #102 from akrherz/iem_database #174
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Install and Test | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
jobs: | |
build-linux: | |
defaults: | |
run: | |
# Ensures environment gets sourced right | |
shell: bash -l {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 | |
- 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: Run Memcached container | |
run: | | |
docker run -d --name iem_memcached -p 11211:11211 memcached:1.6.9 | |
- 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: Build and Test | |
run: | | |
set -e | |
# pip install from requirements.txt | |
python -m pip install -r pip_requirements.txt | |
python -m pip install . --upgrade --no-deps | |
python -m pytest --cov=iembot | |
python -m coverage xml | |
- name: Code coverage | |
if: ${{ matrix.PYTHON_VERSION == '3.12' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.xml |