From 5e146b67e4b36b06b7265c34cf1a48ca4fd0da94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 11:59:11 -0300 Subject: [PATCH 1/7] [multi-geo] Upload assets --- .github/workflows/ci-cd.yml | 95 +++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ba59ece..afaf2cd 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -41,34 +41,91 @@ jobs: - name: npm Build run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build - - name: Configure AWS credentials (development) - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }} - uses: aws-actions/configure-aws-credentials@v1 + - name: Store assets + uses: actions/upload-artifact@v3 with: - role-to-assume: arn:aws:iam::079419646996:role/public-assets - aws-region: us-east-1 + name: assets + path: umd/ + retention-days: 1 - - name: Upload to S3 (development) - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }} - run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS - env: - BUCKET: split-public-stage - SOURCE_DIR: ./umd - DEST_DIR: sdk - ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public + upload-stage: + name: Upload assets + runs-on: ubuntu-latest + needs: build + #if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }} + strategy: + matrix: + environment: + - stage + - stage-eu + include: + - environment: stage + account_id: "079419646996" + bucket: split-public-stage + - environment: stage-eu + account_id: "901851837056" + bucket: split-public-stage-eu-west-1 + + steps: + - name: Download assets + uses: actions/download-artifact@v3 + with: + name: assets + path: umd + + - name: Display structure of downloaded files + run: ls -R + working-directory: umd + + # - name: Configure AWS credentials + # uses: aws-actions/configure-aws-credentials@v1 + # with: + # role-to-assume: arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role + # aws-region: us-east-1 + # + # - name: Upload to S3 + # run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS + # env: + # BUCKET: ${{ matrix.bucket }} + # SOURCE_DIR: ./umd + # DEST_DIR: sdk + # ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public + + upload-prod: + name: Upload assets + runs-on: ubuntu-latest + needs: build + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + strategy: + matrix: + environment: + - prod + - prod-eu + include: + - environment: prod + account_id: "825951051969" + bucket: split-public + - environment: prod-eu + account_id: "842946900133" + bucket: split-public-eu-west-1 + + steps: + - name: Download assets + uses: actions/download-artifact@v3 + with: + name: assets + path: umd - - name: Configure AWS credentials (main) - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: - role-to-assume: arn:aws:iam::825951051969:role/public-assets + role-to-assume: arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role aws-region: us-east-1 - - name: Upload to S3 (main) - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + - name: Upload to S3 run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS env: - BUCKET: split-public + BUCKET: ${{ matrix.bucket }} SOURCE_DIR: ./umd DEST_DIR: sdk ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public From 8b3ebe23f429d77cf98e7870b2b056e361ac5a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 12:02:41 -0300 Subject: [PATCH 2/7] Ignore tests for now --- .github/workflows/ci-cd.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index afaf2cd..e501d86 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -8,6 +8,10 @@ on: branches: - '*' +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.event.pull_request.number }} + cancel-in-progress: true + permissions: contents: read id-token: write @@ -18,27 +22,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Set up nodejs - uses: actions/setup-node@v2 + - name: Set p Node.js + uses: actions/setup-node@v3 with: node-version: '16.16.0' cache: 'npm' - - name: npm CI + - name: npm ci run: npm ci - - name: npm ts tests - run: npm run test-ts-decls - - - name: npm Check - run: npm run check - - - name: npm Test - run: npm run test + # - name: npm ts tests + # run: npm run test-ts-decls + # + # - name: npm Check + # run: npm run check + # + # - name: npm Test + # run: npm run test - - name: npm Build + - name: npm build run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build - name: Store assets From ca0e596cf50a2d60839c699e6075d44092232d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 12:06:03 -0300 Subject: [PATCH 3/7] Upload assets to us and eu (stage) --- .github/workflows/ci-cd.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index e501d86..ddcdd52 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -77,23 +77,23 @@ jobs: name: assets path: umd - - name: Display structure of downloaded files + - name: Display structure of assets run: ls -R working-directory: umd - # - name: Configure AWS credentials - # uses: aws-actions/configure-aws-credentials@v1 - # with: - # role-to-assume: arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role - # aws-region: us-east-1 - # - # - name: Upload to S3 - # run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS - # env: - # BUCKET: ${{ matrix.bucket }} - # SOURCE_DIR: ./umd - # DEST_DIR: sdk - # ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role + aws-region: us-east-1 + + - name: Upload to S3 + run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS + env: + BUCKET: ${{ matrix.bucket }} + SOURCE_DIR: ./umd + DEST_DIR: sdk + ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public upload-prod: name: Upload assets @@ -120,6 +120,10 @@ jobs: name: assets path: umd + - name: Display structure of assets + run: ls -R + working-directory: umd + - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: From d095069d65eff621b0a35ee170973d7c7a1db405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 12:08:55 -0300 Subject: [PATCH 4/7] Re-enable tests --- .github/workflows/ci-cd.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ddcdd52..d38ad8a 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -33,14 +33,14 @@ jobs: - name: npm ci run: npm ci - # - name: npm ts tests - # run: npm run test-ts-decls - # - # - name: npm Check - # run: npm run check - # - # - name: npm Test - # run: npm run test + - name: npm ts tests + run: npm run test-ts-decls + + - name: npm Check + run: npm run check + + - name: npm Test + run: npm run test - name: npm build run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build @@ -56,7 +56,7 @@ jobs: name: Upload assets runs-on: ubuntu-latest needs: build - #if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }} strategy: matrix: environment: @@ -82,7 +82,7 @@ jobs: working-directory: umd - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: role-to-assume: arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role aws-region: us-east-1 @@ -125,7 +125,7 @@ jobs: working-directory: umd - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: role-to-assume: arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role aws-region: us-east-1 From 1224d914ea583b19907d6e029466296de382e34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 12:10:32 -0300 Subject: [PATCH 5/7] wording --- .github/workflows/ci-cd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index d38ad8a..f9bce1d 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -24,7 +24,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Set p Node.js + - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '16.16.0' @@ -33,13 +33,13 @@ jobs: - name: npm ci run: npm ci - - name: npm ts tests + - name: npm test-ts-decls run: npm run test-ts-decls - - name: npm Check + - name: npm check run: npm run check - - name: npm Test + - name: npm test run: npm run test - name: npm build From 1b0185e243a9caaa5ecf90f34c4c9882fe950fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 12:15:37 -0300 Subject: [PATCH 6/7] Add extra conditional to upload artifact --- .github/workflows/ci-cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index f9bce1d..62260b4 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -47,6 +47,7 @@ jobs: - name: Store assets uses: actions/upload-artifact@v3 + if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/main') }} with: name: assets path: umd/ From 17a3f050a0481b2cb67159144d9d8ecc27c43175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Daniel=20Fad=C3=B3n?= Date: Thu, 27 Oct 2022 12:16:22 -0300 Subject: [PATCH 7/7] Add extra conditional to upload artifact --- .github/workflows/ci-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 62260b4..962596d 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -46,8 +46,8 @@ jobs: run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build - name: Store assets - uses: actions/upload-artifact@v3 if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/main') }} + uses: actions/upload-artifact@v3 with: name: assets path: umd/