diff --git a/.github/workflows/DeployTestFrontend.yml b/.github/workflows/DeployTestFrontend.yml deleted file mode 100644 index 7c9b0df6..00000000 --- a/.github/workflows/DeployTestFrontend.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: DeployTestFrontend -on: - workflow_call: - secrets: - AZURE_CLIENT_ID: - required: true - AZURE_TENANT_ID: - required: true - AZURE_SUBSCRIPTION_ID: - required: true - - inputs: - environment: - required: true - type: string - -jobs: - deploy: - name: Deploy Frontend to ${{ inputs.environment }} - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - permissions: - id-token: write - contents: read - packages: read - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: artifacts - - - name: OIDC Login to Azure Public Cloud with AzPowershell (enableAzPSSession true) - uses: azure/login@v1 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - enable-AzPSSession: true - # - - name: 'Get resource group with PowerShell action' - uses: azure/powershell@v1 - with: - inlineScript: | - Get-AzResourceGroup - azPSVersion: 'latest' - - - name: Deploy infrastructure - id: bicep - shell: pwsh - run: > - .azure/deployBicep.ps1 - -environment test - -gitSha ${{github.sha}} - -subscriptionId ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Logout from azure - if: ${{failure() || success()}} - continue-on-error: true - run: az logout diff --git a/.github/workflows/PublishTestFrontend.yml b/.github/workflows/PublishTestFrontend.yml deleted file mode 100644 index e1ada2c6..00000000 --- a/.github/workflows/PublishTestFrontend.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: PublishTestFrontend -on: - workflow_dispatch: - workflow_call: - inputs: - publishArtifacts: - required: false - type: boolean - default: false - # push: - # branches: ['main'] - -jobs: - publish-migration-and-iac-frontend: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Copy .azure directory to artifact - run: | - # Make sure the .azure directory exists - if [ -d .azure ]; then - # Create the destination directory if it doesn't exist - mkdir -p /home/runner/work/dialogporten-frontend/dialogporten-frontend/artifacts - # Copy the .azure directory to the destination - cp -r .azure /home/runner/work/dialogporten-frontend/dialogporten-frontend/artifacts/.azure - fi - shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} - - - name: Upload .azure directory as an artifact - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: ${{ github.workspace }}/artifacts - - # - name: Log in to the Container registry - # uses: docker/login-action@v3 - # with: - # registry: ${{ env.REGISTRY }} - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Build and push Docker image - # uses: docker/build-push-action@v5 - # with: - # push: true - # tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-node-bff:${{ github.sha }} - - publish-docker-images: - env: - DOCKER_IMAGE_BASE: ghcr.io/digdir/dialogporten-frontend- - needs: publish-migration-and-iac-frontend - if: ${{inputs.publishArtifacts}} - runs-on: ubuntu-latest - - strategy: - fail-fast: false # TODO: set true - matrix: - include: - - dockerfile: ./Dockerfile - imageName: node-bff - # - dockerfile: ./src/Digdir.Domain.Dialogporten.Service/Dockerfile - # imageName: service - # - dockerfile: ./src/Digdir.Domain.Dialogporten.ChangeDataCapture/Dockerfile - # imageName: cdc - # - dockerfile: ./src/Digdir.Domain.Dialogporten.Infrastructure/MigrationBundleDockerfile - # imageName: migration-bundle - # - dockerfile: ./src/Digdir.Domain.Dialogporten.Infrastructure.MigrationJobVerifier/Dockerfile - # imageName: migration-verifier - - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v4 - - - name: Login to GitHub Container Registry - if: ${{inputs.publishArtifacts}} - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.DOCKER_IMAGE_BASE }}${{ matrix.imageName }} - - - name: Build and push docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ${{ matrix.dockerfile }} - push: true - tags: | - ${{ steps.meta.outputs.tags }}, - ${{ env.DOCKER_IMAGE_BASE }}${{ matrix.imageName }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} - - - name: testa - run: | - echo "tags=${{ steps.meta.outputs.tags }}" - echo "labels=${{ steps.meta.outputs.labels }}" diff --git a/.github/workflows/WorkflowTestFrontend.yml b/.github/workflows/WorkflowTestFrontend.yml deleted file mode 100644 index bfa7c62d..00000000 --- a/.github/workflows/WorkflowTestFrontend.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: WorkflowTest - -on: - workflow_dispatch: - push: - branches: [main] - #paths: [ src/**, tests/**, .github/workflows/** ] - -jobs: - BuildAndRunTests: - uses: ./.github/workflows/BuildAndRunTestsFrontend.yml - secrets: inherit - with: - environment: test - - BuildContainersAndPublishToGHCR: - needs: [BuildAndRunTests] - uses: ./.github/workflows/PublishTestFrontend.yml - with: - publishArtifacts: true - - DeployToAzureTestEnv: - needs: [BuildContainersAndPublishToGHCR] - uses: ./.github/workflows/DeployTestFrontend.yml - secrets: inherit - with: - environment: test diff --git a/.github/workflows/ci-cd-main.yml b/.github/workflows/ci-cd-main.yml new file mode 100644 index 00000000..a5f89a40 --- /dev/null +++ b/.github/workflows/ci-cd-main.yml @@ -0,0 +1,16 @@ +name: CI/CD Main + +on: + push: + branches: + - main + +jobs: + build-and-test: + uses: ./.github/workflows/workflow-build-and-test.yml + with: + environment: test + + deploy-documentation: + uses: ./.github/workflows/workflow-deploy-docs.yml + \ No newline at end of file diff --git a/.github/workflows/ci-cd-pull-request.yml b/.github/workflows/ci-cd-pull-request.yml new file mode 100644 index 00000000..6de8bfda --- /dev/null +++ b/.github/workflows/ci-cd-pull-request.yml @@ -0,0 +1,15 @@ +name: CI/CD Pull Request + +on: + pull_request: + branches: [main] + types: [opened, synchronize, reopened] + +jobs: + build-and-test: + uses: ./.github/workflows/workflow-build-and-test.yml + with: + environment: test + + playwright-test: + uses: ./.github/workflows/workflow-playwright-test.yml \ No newline at end of file diff --git a/.github/workflows/test-login.yml b/.github/workflows/test-login.yml deleted file mode 100644 index 7a01e0fa..00000000 --- a/.github/workflows/test-login.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Test Azure Login with OpenID Connect and PowerShell -on: - workflow_dispatch: - -permissions: - id-token: write - contents: read - -jobs: - Windows-latest: - runs-on: windows-latest - environment: - name: test - steps: - - name: OIDC Login to Azure Public Cloud with AzPowershell (enableAzPSSession true) - uses: azure/login@v1 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - enable-AzPSSession: true - - - name: 'Get resource group with PowerShell action' - uses: azure/powershell@v1 - with: - inlineScript: | - Get-AzResourceGroup - azPSVersion: "latest" diff --git a/.github/workflows/CI.yml b/.github/workflows/workflow-build-and-test.yml similarity index 88% rename from .github/workflows/CI.yml rename to .github/workflows/workflow-build-and-test.yml index 095cdd41..ae9d9efe 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/workflow-build-and-test.yml @@ -6,16 +6,6 @@ on: environment: required: true type: string - push: - paths: - - 'packages/**' - - './**' - - '.github/workflows/CI.yml' - - 'package.json' - - 'pnpm-lock.yaml' - - 'pnpm-workspace.yaml' - - 'turbo.json' - - 'biome.json' concurrency: group: ${{ github.ref }} diff --git a/.github/workflows/cd-docs.yml b/.github/workflows/workflow-deploy-docs.yml similarity index 96% rename from .github/workflows/cd-docs.yml rename to .github/workflows/workflow-deploy-docs.yml index 22486897..56e50a06 100644 --- a/.github/workflows/cd-docs.yml +++ b/.github/workflows/workflow-deploy-docs.yml @@ -1,9 +1,7 @@ -name: CD Docs +name: Deploy documentation on: - push: - branches: - - main + workflow_call: jobs: deploy-github-pages: diff --git a/.github/workflows/playwright.yml b/.github/workflows/workflow-playwright-test.yml similarity index 77% rename from .github/workflows/playwright.yml rename to .github/workflows/workflow-playwright-test.yml index 3c405b84..cd5456d0 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/workflow-playwright-test.yml @@ -1,18 +1,6 @@ -name: Playwright tests on pr +name: Playwright tests on: - pull_request: - branches: [main] - types: [opened, synchronize, reopened] - paths: - - 'packages/**' - - './**' - - '.github/workflows/playwright.yml' - - 'package.json' - - 'pnpm-lock.yaml' - - 'pnpm-workspace.yaml' - - 'turbo.json' - - 'biome.json' - + workflow_call: workflow_dispatch: jobs: