Skip to content

Merge branch 'refs/heads/master' into cli_gradient #302

Merge branch 'refs/heads/master' into cli_gradient

Merge branch 'refs/heads/master' into cli_gradient #302

Workflow file for this run

name: CI Tests
on:
pull_request:
push:
workflow_dispatch:
jobs:
Sphinx-Pytest-Coverage:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env: [environment_a, environment_b, conda-forge]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
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 update -q -n base -c defaults conda
conda install -q -n base -c conda-forge -c nodefaults mamba
rm -f /usr/share/miniconda/pkgs/cache/*.json # workaround for mamba-org/mamba#488
mamba env create -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@v4
with:
name: ${{ matrix.env }}
if: matrix.env != 'conda_forge'
Codestyle-and-flake8:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env: [environment_a]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
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 update -q -n base -c defaults conda
conda install -q -n base -c conda-forge -c nodefaults mamba
rm -f /usr/share/miniconda/pkgs/cache/*.json # workaround for mamba-org/mamba#488
mamba env create -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-22.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check CONTRIBUTING.md
uses: cylc/release-actions/check-shortlog@v1
Safety-Bandit:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env: [environment_a, environment_b, conda-forge]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
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 update -q -n base -c defaults conda
conda install -q -n base -c conda-forge mamba
rm -f /usr/share/miniconda/pkgs/cache/*.json # workaround for mamba-org/mamba#488
mamba env create -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