feat: add ArchUnit to sticker-award #93
Workflow file for this run
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: Sticker Award Service | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| paths: | |
| - "sticker-award/**" | |
| - ".github/**" | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME_AWARD_SERVICE: ${{ github.repository_owner }}/stickerlandia/sticker-award-service | |
| REPOSITORY_URL: github.com/${{ github.repository }} | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven | |
| run: | | |
| cd sticker-award | |
| ./mvnw clean package -DskipTests | |
| - name: Run Unit Tests | |
| run: | | |
| cd sticker-award | |
| ./mvnw test | |
| - name: Run Integration Tests | |
| run: | | |
| cd sticker-award | |
| ./mvnw verify -Dskip.unit.tests=true -DskipITs=false | |
| - name: Install CodeQL CLI | |
| run: | | |
| # Download and install CodeQL CLI | |
| wget -q https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql-linux64.zip | |
| unzip -q codeql-linux64.zip | |
| sudo mv codeql /opt/codeql | |
| echo "/opt/codeql" >> $GITHUB_PATH | |
| /opt/codeql/codeql version --format=text | |
| - name: Create CodeQL Database | |
| run: | | |
| cd sticker-award | |
| codeql database create cql-db --language=java --source-root=. | |
| - name: Install CodeQL Packs | |
| run: | | |
| cd sticker-award | |
| codeql pack install cql-queries/ | |
| - name: Validate Architecture Rules | |
| run: | | |
| cd sticker-award | |
| ./scripts/validate-architecture.sh | |
| push-image: | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Get Commit Info | |
| id: get_sha | |
| run: | | |
| echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_AWARD_SERVICE }} | |
| tags: | | |
| latest | |
| ${{ env.COMMIT_SHA }} | |
| - name: Build java app | |
| id: build_app | |
| run: | | |
| cd sticker-award | |
| ./mvnw package -DskipTests | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
| with: | |
| context: ./sticker-award | |
| file: ./sticker-award/src/main/docker/Dockerfile.jvm | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| GIT_COMMIT_SHA=${{ env.COMMIT_SHA }} | |
| GIT_REPOSITORY_URL=${{ env.REPOSITORY_URL }} | |
| DD_GIT_REPOSITORY_URL=${{ env.REPOSITORY_URL }} | |
| DD_GIT_COMMIT_SHA=${{ env.COMMIT_SHA }} |