Only build container once in ci #1075
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: CI | ||
on: | ||
push: | ||
pull_request_target: | ||
types: [labeled] | ||
jobs: | ||
should-run: | ||
if: ${{ github.event.action != 'labeled' || (github.event.action == 'labeled' && github.event.label.name == 'run tests') }} | ||
runs-on: ubuntu-latest | ||
build_devcontainer: | ||
needs: [should-run] | ||
uses: ./.github/workflows/build_devcontainer.yml | ||
secrets: inherit | ||
test: | ||
needs: [build_devcontainer] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
- name: Run tests in container | ||
uses: devcontainers/[email protected] | ||
with: | ||
imageName: dodona/dodona-tested | ||
imageTag: dev | ||
runCmd: poetry run pytest -n auto --cov=tested --cov-report=xml tests/ | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./result/coverage.xml | ||
lint: | ||
needs: [build_devcontainer] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
- name: Run isort | ||
uses: devcontainers/[email protected] | ||
with: | ||
imageName: dodona/dodona-tested | ||
imageTag: dev | ||
runCmd: poetry run isort --check-only --diff ./tested ./tests | ||
- name: Run black | ||
uses: devcontainers/[email protected] | ||
with: | ||
imageName: dodona/dodona-tested | ||
imageTag: dev | ||
runCmd: poetry run black --check ./tested ./tests | ||
types: | ||
needs: [build_devcontainer] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
- name: Run pyright | ||
uses: devcontainers/[email protected] | ||
with: | ||
imageName: dodona/dodona-tested | ||
imageTag: dev | ||
runCmd: pyright ./tested ./tests |