Merge pull request #161 from madeline-scyphers/develop #730
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 | |
on: | |
push: | |
pull_request: | |
branches: | |
- develop | |
- main | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
jobs: | |
pre_job: | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
# All of these options are optional, so you can remove them if you are happy with the defaults | |
concurrent_skipping: 'same_content_newer' | |
skip_after_successful_duplicate: 'true' | |
paths_ignore: '["**/README.md", "**/docs/**"]' | |
do_not_skip: '["workflow_dispatch", "schedule"]' | |
ci: | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip != 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu | |
label: linux-64-0.3.4 | |
prefix: /usr/share/miniconda3/envs/boa | |
ax_version: 0.3.4 | |
- os: ubuntu | |
label: linux-64-0.3.3 | |
prefix: /usr/share/miniconda3/envs/boa | |
ax_version: 0.3.3 | |
- os: ubuntu | |
label: linux-64-0.3.2 | |
prefix: /usr/share/miniconda3/envs/boa | |
ax_version: 0.3.2 | |
- os: ubuntu | |
label: linux-64-0.3.1 | |
prefix: /usr/share/miniconda3/envs/boa | |
ax_version: 0.3.1 | |
- os: macos | |
label: osx-64 | |
prefix: /Users/runner/miniconda3/envs/boa | |
- os: windows | |
label: win-64 | |
prefix: C:\Miniconda3\envs\boa | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
python-version: 3.9 | |
activate-environment: boa | |
use-mamba: true | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('environment_dev.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update base environment | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: mamba env update -n boa -f environment_dev.yml --prune | |
- name: update ax versions | |
if: ${{ matrix.ax_version }} # only update when ax_version is set | |
shell: bash -l {0} | |
run: mamba install ax-platform=${{ matrix.ax_version }} -c conda-forge | |
- name: export env to artifact | |
run: mamba env export -n boa > environment_ci_${{ matrix.os }}_${{ matrix.ax_version }}.yml | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: environment_ci_${{ matrix.os }}.yml | |
path: environment_ci_${{ matrix.os }}.yml | |
- name: Lint | |
shell: bash -l {0} | |
run: | | |
invoke style --checkonly | |
- name: Run tests | |
shell: bash -l {0} | |
run: invoke tests --options '-v -s --cov=boa --cov-branch --cov-report=xml' | |
- name: Upload coverage to Codecov | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: codecov/codecov-action@v3 | |
- name: Pytest coverage comment | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-xml-coverage-path: ./coverage.xml | |
- name: Test package builds successfully | |
shell: bash -l {0} | |
run: | | |
python -m pip install build | |
python -m build | |
# Report final results of the matrix tests | |
result: | |
name: Result | |
if: needs.pre_job.outputs.should_skip != 'true' && always() | |
runs-on: ubuntu-latest | |
needs: | |
- pre_job | |
- ci | |
steps: | |
- name: Mark result as failed | |
if: needs.ci.result != 'success' | |
run: exit 1 |