ci: Update ci files. #1
This file contains hidden or 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: Run tests | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
branches: [main, develop] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
jobs: | |
build: | |
name: Build image | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Save image name (lowercased) | |
run: echo "IMAGE_NAME=$(echo 'ghcr.io/${{ github.repository }}:run-${{ github.run_id }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and push image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./solution | |
file: ./solution/Dockerfile | |
tags: ${{ env.IMAGE_NAME }} | |
push: true | |
tests: | |
needs: build | |
name: Run tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
if: github.action != 'github-classroom[bot]' | |
steps: | |
- name: Setup checker environment | |
uses: Central-University-IT/setup-test-2025-backend@v1 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests | |
run: | | |
export IMAGE_SOLUTION=$(echo 'ghcr.io/${{ github.repository }}:run-${{ github.run_id }}' | tr '[:upper:]' '[:lower:]') | |
export IMAGE_ANTIFRAUD=docker.io/lodthe/prod-backend-antifraud | |
/usr/local/bin/checker | |
continue-on-error: true | |
- uses: actions/[email protected] | |
with: | |
name: result | |
path: ./result.json | |
if-no-files-found: error | |
compression-level: 0 | |
- uses: bots-house/[email protected] | |
continue-on-error: true | |
with: | |
owner: ${{ github.repository_owner }} | |
name: ${{ github.event.repository.name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: run-${{ github.run_id }} |