Merge pull request #2 from hyriver/dependabot/github_actions/github/c… #3
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: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: python ${{ matrix.python-version }}, ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
REPO_NAME: ${{ github.event.repository.name }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
matrix: | |
python-version: [3.8, '3.11'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set environment variables | |
run: |- | |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV | |
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | |
- name: Setup micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ${{ env.CONDA_ENV_FILE }} | |
environment-name: ${{ env.REPO_NAME }}-tests | |
create-args: >- | |
python=${{ env.PYTHON_VERSION }} | |
cache-environment: true | |
cache-environment-key: ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}} | |
- name: Install error reporter | |
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.11' | |
run: | | |
python -m pip install pytest-github-actions-annotate-failures | |
- name: Install the package | |
run: |- | |
python -m pip install --no-deps . | |
- name: Version info | |
run: |- | |
NAME="$(echo ${REPO_NAME} | tr - _)" | |
python -c "import ${NAME}; ${NAME}.show_versions()" | |
- name: Run pytest | |
run: |- | |
pytest | |
- name: Run codecov and upload the report | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: RUNNER_OS,PYTHON_VERSION | |
name: codecov-umbrella | |
fail_ci_if_error: false |