feat: add AWS implementation and IaC #28
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: User Management | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| paths: | |
| - "user-management/**" | |
| - ".github/**" | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME_USER_SERVICE: ${{ github.repository_owner }}/stickerlandia/user-management-service | |
| REPOSITORY_URL: github.com/${{ github.repository }} | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Run Unit Tests | |
| shell: bash | |
| run: | | |
| cd user-management/tests/Stickerlandia.UserManagement.UnitTest | |
| dotnet test | |
| integration-test-azure: | |
| runs-on: ubuntu-latest | |
| needs: unit-test | |
| strategy: | |
| matrix: | |
| DRIVING: | |
| - AGNOSTIC | |
| - AZURE | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: Install SSL Certificates | |
| run: | | |
| dotnet dev-certs https --trust | |
| - name: Install Azure Functions Core Tools | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
| sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
| sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs 2>/dev/null)-prod $(lsb_release -cs 2>/dev/null) main" > /etc/apt/sources.list.d/dotnetdev.list' | |
| sudo apt-get update | |
| sudo apt-get install azure-functions-core-tools-4 | |
| func --version | |
| - name: .NET Restore | |
| shell: bash | |
| run: | | |
| cd user-management | |
| dotnet restore | |
| - name: Run Integration Tests | |
| shell: bash | |
| env: | |
| DRIVING: ${{ matrix.DRIVING }} | |
| DRIVEN: AZURE | |
| run: | | |
| func --version | |
| cd user-management/tests/Stickerlandia.UserManagement.IntegrationTest && dotnet test --logger:"console;verbosity=detailed" | |
| integration-test-agnostic: | |
| runs-on: ubuntu-latest | |
| needs: unit-test | |
| strategy: | |
| matrix: | |
| DRIVING: | |
| - AGNOSTIC | |
| - AZURE | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: Install SSL Certificates | |
| run: | | |
| dotnet dev-certs https --trust | |
| - name: Install Azure Functions Core Tools | |
| run: | | |
| curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
| sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
| sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs 2>/dev/null)-prod $(lsb_release -cs 2>/dev/null) main" > /etc/apt/sources.list.d/dotnetdev.list' | |
| sudo apt-get update | |
| sudo apt-get install azure-functions-core-tools-4 | |
| func --version | |
| - name: .NET Restore | |
| shell: bash | |
| run: | | |
| cd user-management | |
| dotnet restore | |
| - name: Run Integration Tests | |
| shell: bash | |
| env: | |
| DRIVING: ${{ matrix.DRIVING }} | |
| DRIVEN: AGNOSTIC | |
| run: | | |
| cd user-management/tests/Stickerlandia.UserManagement.IntegrationTest && dotnet test --logger:"console;verbosity=detailed" | |
| push-image: | |
| runs-on: ubuntu-latest | |
| needs: [integration-test-azure, integration-test-agnostic] | |
| 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: 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_USER_SERVICE }} | |
| tags: | | |
| latest | |
| ${{ env.COMMIT_SHA }} | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
| with: | |
| context: ./user-management | |
| file: ./user-management/src/Stickerlandia.UserManagement.Api/Dockerfile | |
| 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 }} |