From ec14917e2348bb5c698ed5457949b7b8d4f7596e Mon Sep 17 00:00:00 2001 From: Prakash Poudel Date: Sat, 11 May 2024 16:23:26 +0545 Subject: [PATCH] Update github action --- .github/workflows/build-deploy-container.yml | 41 ++++-------- .github/workflows/e2e.yml | 69 -------------------- 2 files changed, 14 insertions(+), 96 deletions(-) delete mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/build-deploy-container.yml b/.github/workflows/build-deploy-container.yml index d4c423b4f..c85a76715 100644 --- a/.github/workflows/build-deploy-container.yml +++ b/.github/workflows/build-deploy-container.yml @@ -6,18 +6,13 @@ on: workflow_dispatch: env: - REGISTRY: ghcr.io - WEBAPP_IMAGE_NAME: poudelprakash/bigcapital-webapp - SERVER_IMAGE_NAME: poudelprakash/bigcapital-server + WEBAPP_IMAGE_NAME: poudelprakash/webapp + SERVER_IMAGE_NAME: poudelprakash/server jobs: build-publish-webapp: strategy: fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/arm64 name: Build and deploy webapp container runs-on: ubuntu-latest environment: production @@ -30,9 +25,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -40,15 +32,14 @@ jobs: - name: Log in to the Container registry uses: docker/login-action@v3 with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GH_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.WEBAPP_IMAGE_NAME }} + images: ${{ env.WEBAPP_IMAGE_NAME }} # Builds and push the Docker image. - name: Build and push Docker image @@ -57,10 +48,10 @@ jobs: with: context: ./ file: ./packages/webapp/Dockerfile - platforms: ${{ matrix.platform }} + platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/poudelprakash/webapp:latest, ghcr.io/poudelprakash/webapp:${{github.ref_name}} labels: ${{ steps.meta.outputs.labels }} + tags: poudelprakash/webapp:latest, poudelprakash/webapp:${{github.ref_name}} - name: Export digest run: | @@ -71,7 +62,7 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4 with: - name: digests-main-${{ env.PLATFORM_PAIR }} + name: digests-webapp path: /tmp/digests/* if-no-files-found: error retention-days: 1 @@ -93,9 +84,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -103,9 +91,8 @@ jobs: - name: Log in to the Container registry uses: docker/login-action@v3 with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GH_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} # Builds and push the Docker image. - name: Build and push Docker image @@ -114,9 +101,9 @@ jobs: with: context: ./ file: ./packages/server/Dockerfile - platforms: ${{ matrix.platform }} + platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/poudelprakash/server:latest, ghcr.io/poudelprakash/server:${{github.ref_name}} + tags: poudelprakash/server:latest, poudelprakash/server:${{github.ref_name}} labels: ${{ steps.meta.outputs.labels }} - name: Export digest @@ -128,11 +115,11 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4 with: - name: digests-main-${{ env.PLATFORM_PAIR }} + name: digests-server path: /tmp/digests/* if-no-files-found: error retention-days: 1 - + # Send notification to Slack channel. # - name: Slack Notification built and published server container successfully. # uses: rtCamp/action-slack-notify@v2 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index a922d4963..000000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: E2E -on: - push: - branches: - - main - - develop - - feat/oidc-integration - paths: - - '**.ts' - - '**.tsx' - - '**/tsconfig.json' - - 'pnpm-lock.yaml' - - '.github/workflows/e2e.yml' - pull_request: - paths: - - '**.ts' - - '**.tsx' - - '**/tsconfig.json' - - 'pnpm-lock.yaml' - - '.github/workflows/e2e.yml' - -defaults: - run: - shell: 'bash' - -jobs: - test_setup: - name: Test setup - runs-on: ubuntu-latest - outputs: - preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }} - steps: - - name: Wait for Vercel preview deployment to be ready - uses: patrickedqvist/wait-for-vercel-preview@v1.3.1 - id: waitForVercelPreviewDeployment - with: - token: ${{ secrets.GITHUB_TOKEN }} - max_timeout: 3000 - - test_e2e: - runs-on: ubuntu-latest - needs: test_setup - name: Playwright tests - timeout-minutes: 15 - environment: ${{ vars.ENVIRONMENT_STAGE }} - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 14 # Need for npm >=7.7 - cache: 'npm' - - - name: Install dependencies - run: npm install - - - name: Install Playwright with deps - run: npx playwright install --with-deps - - - name: Run tests - run: npm run test:e2e - env: - PLAYWRIGHT_TEST_BASE_URL: ${{ needs.test_setup.outputs.preview_url }} - - - uses: actions/upload-artifact@v2 - if: always() - with: - name: playwright-report - path: test-results/ - retention-days: 30