Add tag to build and adapt ref #17
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: Build, Push, and Test | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| tags: '*' | |
| release: | |
| types: | |
| - created | |
| jobs: | |
| build: | |
| name: Build and Push the Docker Images | |
| uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@main | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref || github.ref_name }} | |
| docker-file: docker/Dockerfile | |
| docker-context: docker | |
| image-name: ls1intum/eos | |
| tags: | | |
| type=ref,event=tag | |
| test-solution: | |
| name: Run Tests for Solution | |
| needs: build | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/ls1intum/eos:${{ needs.build.outputs.image_tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Copy solution to example/tests/assignment | |
| run: | | |
| mkdir -p example/tests/assignment | |
| cp -r example/solution/* example/tests/assignment/ | |
| - name: Run Gradle Tests | |
| working-directory: example/tests | |
| run: ./gradlew test | |
| test-template: | |
| name: Run Tests for Template | |
| needs: build | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/ls1intum/eos:${{ needs.build.outputs.image_tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Copy template to example/tests/assignment | |
| run: | | |
| mkdir -p example/tests/assignment | |
| cp -r example/template/* example/tests/assignment/ | |
| - name: Run Gradle Tests | |
| working-directory: example/tests | |
| run: | | |
| if ./gradlew test; then | |
| echo "❌ Tests unexpectedly passed!" | |
| exit 1 | |
| else | |
| echo "✅ Tests failed as expected." | |
| fi |