diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..fc6948944 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,44 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:noble", + "features": { + "ghcr.io/devcontainers/features/python:1": { + "version": "3.13" + }, + "ghcr.io/devcontainers-extra/features/pulumi:1": { + "version": "3.207.0" + }, + "ghcr.io/devcontainers-extra/features/ruff:1": { + "version": "0.14.5" + }, + "ghcr.io/devcontainers/features/aws-cli:1": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/node:1": { + "version": "20" + } + }, + "mounts": [ + // "source=/${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached", + // "source=/${localEnv:HOME}${localEnv:USERPROFIaLE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached", + // "source=/${localEnv:HOME}${localEnv:USERPROFILE}/src,target=/home/vscode/src,type=bind,consistency=cached" + ], + + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "npm install -g bun" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/.github/workflows/build-and-push-devcontainer.yaml b/.github/workflows/build-and-push-devcontainer.yaml new file mode 100644 index 000000000..ad339d6d7 --- /dev/null +++ b/.github/workflows/build-and-push-devcontainer.yaml @@ -0,0 +1,39 @@ +--- +name: build-and-push-devcontainer + +concurrency: + group: merge-main + cancel-in-progress: true + +on: + push: + branches: + - main + +env: + CACHE_IMAGE_PREFIX: ghcr.io/${{ github.repository }} + +jobs: + # Build and cache devcontainer for faster CI stages + devcontainer-build: + runs-on: ubuntu-latest + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and cache devcontainer + uses: devcontainers/ci@v0.3 + with: + # Change this to point to your image name + imageName: ${{ env.CACHE_IMAGE_PREFIX }}/cached-devcontainer + cacheFrom: ${{ env.CACHE_IMAGE_PREFIX }}/cached-devcontainer + push: always + # Change this to be your CI task/script + # runCmd: \ No newline at end of file diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index c5ce85916..92fba606b 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -17,6 +17,8 @@ jobs: if: startsWith(github.ref_name, 'r-') # the prefix we have added to the tag environment: production runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 @@ -25,9 +27,6 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PULUMI }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PULUMI }} - - name: Clean up before Pulumi release - run: rm -rf dist - - name: Get Artifact from Release uses: dsaltares/fetch-gh-release-asset@master with: @@ -46,6 +45,8 @@ jobs: if: startsWith(github.ref_name, 'r-') # the prefix we have added to the tag environment: production runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest steps: - name: Download ECR tag artifact uses: dsaltares/fetch-gh-release-asset@master @@ -77,20 +78,12 @@ jobs: with: mask-password: "true" - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: 3.13 - - name: Set up Pulumi environment id: pulumi-env - shell: bash run: | tar -xvf pulumi.tbz - curl -fsSL https://get.pulumi.com | sh - name: Deploy to prod - shell: bash env: PULUMI_ACCESS_TOKEN: "${{ secrets.PULUMI_ACCESS_TOKEN }}" run: | @@ -126,6 +119,8 @@ jobs: name: prod-sanity-browserstack needs: [deploy-prod-backend, deploy-prod-frontend] runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: production env: TB_ACCTS_EMAIL: ${{ secrets.E2E_APPT_PROD_TB_ACCTS_EMAIL }} @@ -136,12 +131,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'test/e2e/package-lock.json' - - name: Install dependencies run: | cd ./test/e2e diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index bfc55ea25..35a380fa7 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -17,6 +17,8 @@ jobs: build-and-deploy-stage-frontend: environment: staging runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest steps: - uses: actions/checkout@v4 @@ -26,11 +28,6 @@ jobs: aws-region: eu-central-1 aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PULUMI }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PULUMI }} - - - name: Setup NPM - uses: actions/setup-node@v4 - with: - node-version: '20.x' - name: Install dependencies run: cd frontend && npm install @@ -49,6 +46,8 @@ jobs: build-backend-image: environment: staging runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest steps: - uses: actions/checkout@v4 @@ -91,6 +90,8 @@ jobs: if: needs.build-backend-image.result == 'success' environment: staging runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest steps: - uses: actions/checkout@v4 @@ -113,11 +114,6 @@ jobs: with: mask-password: "true" - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: 3.13 - - name: Unpack ECR tag id: get_ecr_tag run: | @@ -170,15 +166,11 @@ jobs: ! contains(join(needs.*.result, ','), 'failure') environment: production runs-on: ubuntu-latest - + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest steps: - uses: actions/checkout@v4 - - name: Setup NPM - uses: actions/setup-node@v4 - with: - node-version: '20.x' - - name: Install dependencies run: cd frontend && npm install @@ -233,6 +225,8 @@ jobs: if: false # if: ${{ !failure() || !cancelled() }} runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: staging env: TB_ACCTS_EMAIL: ${{ secrets.E2E_APPT_STAGE_TB_ACCTS_EMAIL }} @@ -243,12 +237,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'test/e2e/package-lock.json' - - name: Install dependencies run: | cd ./test/e2e diff --git a/.github/workflows/nightly-tests-desktop.yml b/.github/workflows/nightly-tests-desktop.yml index 97a974dd2..fdbc6dce7 100644 --- a/.github/workflows/nightly-tests-desktop.yml +++ b/.github/workflows/nightly-tests-desktop.yml @@ -18,6 +18,8 @@ jobs: nightly-prod-desktop-e2e: name: nightly-prod-desktop-e2e runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: production env: TB_ACCTS_EMAIL: ${{ secrets.E2E_APPT_PROD_TB_ACCTS_EMAIL }} @@ -28,12 +30,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'test/e2e/package-lock.json' - - name: Install dependencies run: | cd ./test/e2e diff --git a/.github/workflows/nightly-tests-mobile.yml b/.github/workflows/nightly-tests-mobile.yml index bf5d6bcab..987a74caf 100644 --- a/.github/workflows/nightly-tests-mobile.yml +++ b/.github/workflows/nightly-tests-mobile.yml @@ -18,6 +18,8 @@ jobs: nightly-prod-mobile-e2e: name: nightly-prod-mobile-e2e runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: production env: TB_ACCTS_EMAIL: ${{ secrets.E2E_APPT_PROD_TB_ACCTS_EMAIL }} @@ -28,12 +30,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'test/e2e/package-lock.json' - - name: Install dependencies run: | cd ./test/e2e diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 9cd580eca..db3bd742f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -33,30 +33,35 @@ jobs: with: filters: | validate-backend: - - 'backend/**' + - '**' - '.github/workflows/validate.yml' validate-frontend: - - 'frontend/**' + - '**' - '.github/workflows/validate.yml' validate-pulumi: - - 'pulumi/**' + - '**' - '.github/workflows/validate.yml' + # validate-backend: + # - 'backend/**' + # - '.github/workflows/validate.yml' + # validate-frontend: + # - 'frontend/**' + # - '.github/workflows/validate.yml' + # validate-pulumi: + # - 'pulumi/**' + # - '.github/workflows/validate.yml' validate-backend: needs: detect-changes runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: staging if: needs.detect-changes.outputs.validate-backend == 'true' steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.13' - cache: 'pip' - - name: Install dependencies run: | cd ./backend @@ -86,17 +91,13 @@ jobs: validate-frontend: needs: detect-changes runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: staging if: needs.detect-changes.outputs.validate-frontend == 'true' steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - cache-dependency-path: 'frontend/package-lock.json' - - name: Install dependencies run: | cd ./frontend @@ -117,17 +118,13 @@ jobs: validate-pulumi: needs: detect-changes runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/cached-devcontainer:latest environment: staging if: needs.detect-changes.outputs.validate-pulumi == 'true' steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.13' - cache: 'pip' - - name: Install dependencies run: | cd ./pulumi