Fix to avoid issue encountered in test suite. #225
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: CI Tests | |
on: | |
pull_request: | |
push: | |
workflow_dispatch: | |
jobs: | |
Sphinx-Pytest-Coverage: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: [environment_a, environment_b, conda-forge] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /usr/share/miniconda/envs/im${{ matrix.env }} | |
key: ${{ format('{0}-conda-improver-{1}-{2}', runner.os, matrix.env, hashFiles(format('envs/{0}.yml', matrix.env))) }} | |
- name: conda env update | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda install -c conda-forge mamba | |
rm -f /usr/share/miniconda/pkgs/cache/*.json # workaround for mamba-org/mamba#488 | |
mamba env update -q --file envs/${{ matrix.env }}.yml --name im${{ matrix.env }} | |
- name: conda info | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
conda info | |
conda list | |
- name: sphinx documentation | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
make -C doc html SPHINXOPTS="-W --keep-going" | |
- name: pytest without coverage | |
if: matrix.env == 'conda-forge' | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
pytest | |
- name: pytest with coverage | |
if: matrix.env != 'conda-forge' | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
pytest --cov=improver --cov-report xml:coverage.xml | |
- name: codacy upload | |
if: env.CODACY_PROJECT_TOKEN && matrix.env == 'environment_a' | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
python-codacy-coverage -v -r coverage.xml | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
- name: codecov upload | |
uses: codecov/codecov-action@v3 | |
with: | |
name: ${{ matrix.env }} | |
if: matrix.env != 'conda_forge' | |
Codestyle-and-flake8: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: [environment_a] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /usr/share/miniconda/envs/im${{ matrix.env }} | |
key: ${{ format('{0}-conda-improver-{1}-{2}', runner.os, matrix.env, hashFiles(format('envs/{0}.yml', matrix.env))) }} | |
- name: conda env update | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda install -c conda-forge mamba | |
rm -f /usr/share/miniconda/pkgs/cache/*.json # workaround for mamba-org/mamba#488 | |
mamba env update -q --file envs/${{ matrix.env }}.yml --name im${{ matrix.env }} | |
- name: conda info | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
conda info | |
conda list | |
- name: isort | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
isort --check-only . | |
- name: black | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
black --check . | |
- name: flake8 | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
flake8 improver improver_tests | |
PR-standards: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check CONTRIBUTING.md | |
uses: cylc/release-actions/check-shortlog@v1 | |
Safety-Bandit: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: [environment_a, environment_b, conda-forge] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /usr/share/miniconda/envs/im${{ matrix.env }} | |
key: ${{ format('{0}-conda-improver-{1}-{2}', runner.os, matrix.env, hashFiles(format('envs/{0}.yml', matrix.env))) }} | |
- name: conda env update | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda install -c conda-forge mamba | |
rm -f /usr/share/miniconda/pkgs/cache/*.json # workaround for mamba-org/mamba#488 | |
mamba env update -q --file envs/${{ matrix.env }}.yml --name im${{ matrix.env }} | |
- name: conda info | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
conda info | |
conda list | |
- name: safety | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
safety check || true | |
- name: bandit | |
run: | | |
source '/usr/share/miniconda/etc/profile.d/conda.sh' | |
conda activate im${{ matrix.env }} | |
bandit -r improver |