Update infastructure #6
Workflow file for this run
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: test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
# We only need to test on one OS as we are using Docker | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_RUN_CMD: docker run --user root --rm autobike:workflow | |
steps: | |
# Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Build Docker image | |
- name: Build Docker image | |
run: docker build -t autobike:workflow . | |
# Run Black formatting check | |
- name: Black formatting check | |
# always() runs even if the job is canceled, while success() || failure() does not | |
if: success() || failure() | |
run: ${{ env.DOCKER_RUN_CMD }} black --check --config pyproject.toml . | |
# Run Pylint linting | |
- name: Pylint linting | |
if: success() || failure() | |
run: ${{ env.DOCKER_RUN_CMD }} pylint --rcfile=pyproject.toml src/ | |
# Run Pytest with code coverage | |
- name: Pytest with code coverage | |
if: success() || failure() | |
run: ${{ env.DOCKER_RUN_CMD }} pytest --cov=./ --cov-report=xml | |
# Run mypy type checking | |
- name: Mypy type check | |
if: success() || failure() | |
run: ${{ env.DOCKER_RUN_CMD }} mypy --config-file=pyproject.toml src/ | |
# Upload to codecov | |
- name: Upload coverage to Codecov | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
fail_ci_if_error: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |