.github/workflows/sipa-ci .yml

Summary

Maintainability
Test Coverage
name: SIPA CI

on: [push, pull_request]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-python@v4
      with:
        python-version: "3.12"
    - uses: pre-commit/action@v3.0.0
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
           submodules: 'true'
      - name: Fix permissions
        run: sudo chmod -R a+rw .
      - name: Build the Docker image
        run: docker build -t sipa:latest .
      - name: Login to GitLab Registry
        uses: docker/login-action@v1
        with:
          registry: registry.agdsn.de
          username: "github-actions"
          password: ${{ secrets.GITLAB_REGISTRY_PASSWORD }}
      - name: Tag built image
        run: docker tag sipa:latest registry.agdsn.de/agdsn/coreos/sipa/sipa:${GITHUB_REF##*/}
      - name: Push to GitLab registry
        run: docker push registry.agdsn.de/agdsn/coreos/sipa/sipa:${GITHUB_REF##*/}
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Check out sipa and submodules
        uses: actions/checkout@v3
        with:
          submodules: recursive
      - uses: actions/setup-python@v4
        with:
          python-version: '3.12'
          cache: 'pip'
      - name: print information about pip cache
        run: pip cache info && pip cache list
      - name: ensure presence of `wheel`
        run: pip install wheel
      - name: install pip dependencies
        run: >
          pip install
          -r build/requirements/requirements.txt
          -r build/requirements/requirements_testing.txt
        id: pip-install
      # now come the tests
      - name: Run tests
        run: >
          pytest
          --junitxml=junit/test-results.xml
      - name: Publish Test Report
        uses: mikepenz/action-junit-report@v3
        if: always() # always run even if the previous step fails
        with:
          report_paths: 'junit/test-*.xml'