Skip to content

Add flags to Codecov actions for unit test results #21

Add flags to Codecov actions for unit test results

Add flags to Codecov actions for unit test results #21

Workflow file for this run

name: Tox CI with Conda
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
jobs:
flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: 3.11
auto-activate-base: false
- name: Create and activate environment
run: |
conda create -n test-env python=3.11 flake8 -y
conda init
source ~/.bashrc
conda activate test-env
pip install tox tox-conda
- name: Run Flake8
run: |
conda init
source ~/.bashrc
conda activate test-env
tox -e flake8
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8,3.9,3.10.15,3.11,3.12,3.13]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Create and activate environment
run: |
conda create -n test-env python=${{ matrix.python-version }} -y
conda init
source ~/.bashrc
conda activate test-env
pip install tox tox-conda
- name: Install GCC and GFortran
run: |
sudo apt-get update
sudo apt-get install -y gcc gfortran
- name: Install dependencies
run: |
sudo apt-get install -y bc ninja-build
- name: Run Tox
run: |
conda init
source ~/.bashrc
conda activate test-env
tox -e py$(echo ${{ matrix.python-version }} | tr -d . | cut -c 1-3)
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests