Skip to content

fix: #114

fix: #114 #108

name: Build and Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda dependencies
run: |
conda env update --file environment.yml --name base
pip install -r requirements/requirements-dev.txt
- name: Lint with black
run: |
black --verbose --check .
- name: Install requirements
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-benchmark pytest-memray
pip install -r requirements.txt
python setup.py develop
- name: Run tests and collect benchmark
run: |
pytest --verbose -p no:warnings --memray --benchmark-json output.json ./tests/test_perf.py
- name: Continuous Benchmark
uses: benchmark-action/github-action-benchmark@v1.14.0
with:
name: cnmaps Benchmark
tool: "pytest"
output-file-path: output.json
github-token: ${{ secrets.CI_TOKEN }}
gh-repository: "github.com/cnmetlab/cnmaps"
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: false
benchmark-data-dir-path: "performance/"
alert-comment-cc-users: "@clarmy"
- name: Run tests and collect coverage
run: |
pytest --verbose -p no:warnings --cov ./tests/test_drawing.py ./tests/test_geo.py ./tests/test_map.py ./tests/test_issues.py
- name: Upload coverage reports to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}