Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 91 additions & 66 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,111 @@ on:
branches: [main]
pull_request: null

env:
REPO: ${{ github.repository }}

jobs:
ruff_linter:
build_linter_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build linter image
uses: docker/build-push-action@v6
with:
context: .
file: .docker/lint.Dockerfile
target: runtime
cache-from: type=gha,scope=${{ github.ref_name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}
outputs: type=docker,dest=/tmp/linter_image.tar
tags: linter:latest
- name: Upload linter image
uses: actions/upload-artifact@v4
with:
name: linter-image
path: /tmp/linter_image.tar
retention-days: 1

run_ruff_check:
runs-on: ubuntu-latest
needs: build_linter_image
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- name: Download linter image
uses: actions/download-artifact@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build linters
env:
TAG: ghcr.io/${{ env.REPO }}_linters:latest
NEW_TAG: linter
run: docker build --target=runtime -f .docker/lint.Dockerfile . -t $NEW_TAG --cache-to type=gha,mode=max --cache-from $TAG --build-arg BUILDKIT_INLINE_CACHE=1
- name: Run linters
env:
NEW_TAG: linter
run: docker run $NEW_TAG ruff check --output-format=github .
name: linter-image
path: /tmp
- name: Load image
run: docker load -i /tmp/linter_image.tar
- name: Run ruff check
run: docker run linter:latest ruff check --output-format=github .

ruff_format:
run_ruff_format:
runs-on: ubuntu-latest
needs: build_linter_image
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- name: Download linter image
uses: actions/download-artifact@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build linters
env:
TAG: ghcr.io/${{ env.REPO }}_linters:latest
NEW_TAG: linter
run: docker build --target=runtime -f .docker/lint.Dockerfile . -t $NEW_TAG --cache-to type=gha,mode=max --cache-from $TAG --build-arg BUILDKIT_INLINE_CACHE=1
- name: Run linters
env:
NEW_TAG: linter
run: docker run $NEW_TAG ruff format --check
name: linter-image
path: /tmp
- name: Load image
run: docker load -i /tmp/linter_image.tar
- name: Run ruff format
run: docker run linter:latest ruff format --check

mypy:
run_mypy:
runs-on: ubuntu-latest
needs: build_linter_image
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- name: Download linter image
uses: actions/download-artifact@v4
with:
name: linter-image
path: /tmp
- name: Load image
run: docker load -i /tmp/linter_image.tar
- name: Run mypy
run: docker run linter:latest mypy .

build_test_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build test image
uses: docker/build-push-action@v6
with:
context: .
file: .docker/test.Dockerfile
target: runtime
cache-from: type=gha,scope=${{ github.ref_name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}
outputs: type=docker,dest=/tmp/test_image.tar
tags: test:latest
- name: Upload test image
uses: actions/upload-artifact@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build linters
env:
TAG: ghcr.io/${{ env.REPO }}_linters:latest
NEW_TAG: linter
run: docker build --target=runtime -f .docker/lint.Dockerfile . -t $NEW_TAG --cache-to type=gha,mode=max --cache-from $TAG --build-arg BUILDKIT_INLINE_CACHE=1
- name: Run linters
env:
NEW_TAG: linter
run: docker run $NEW_TAG mypy .
name: test-image
path: /tmp/test_image.tar
retention-days: 1

tests:
run_tests:
runs-on: ubuntu-latest
needs: build_test_image
env:
TAG: test:latest # Injected into docker-compose.remote.test.yml as ${TAG}
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- name: Checkout code
uses: actions/checkout@v4
- name: Download test image
uses: actions/download-artifact@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build tests
env:
CACHE: ghcr.io/${{ env.REPO }}_test:latest
TAG: tests
run: docker build --target=runtime -f .docker/test.Dockerfile . -t $TAG --cache-to type=gha,mode=max --cache-from $CACHE --build-arg BUILDKIT_INLINE_CACHE=1
name: test-image
path: /tmp
- name: Load image
run: docker load -i /tmp/test_image.tar
- name: Run tests
env:
TAG: tests
run: docker compose -f docker-compose.remote.test.yml up --no-log-prefix --attach md-test --exit-code-from md-test
run: docker compose -f docker-compose.remote.test.yml up --no-log-prefix --attach md-test --exit-code-from md-test
2 changes: 1 addition & 1 deletion interface