Skip to content

fix(deps): update aws-sdk-js-v3 monorepo #1484

fix(deps): update aws-sdk-js-v3 monorepo

fix(deps): update aws-sdk-js-v3 monorepo #1484

name: Test and Release
on:
push:
permissions:
contents: write
actions: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.sha }}
jobs:
stack-name:
runs-on: ubuntu-24.04
outputs:
stackPrefix: ${{ steps.stackPrefix.outputs.stackPrefix }}
steps:
- name: Generate Stack ID
id: stackPrefix
run: |
RANDOM_STRING=`node -e "const crypto = require('crypto'); process.stdout.write(crypto.randomBytes(Math.ceil(8 * 0.5)).toString('hex').slice(0, 8));"`
echo "stackPrefix=fcu-${RANDOM_STRING}" >> $GITHUB_OUTPUT
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: "24.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Compile TypeScript
run: npx tsc
- name: Check source code with eslint
run: npx eslint ./
- name: Check if source code is properly formatted
run: npx prettier -c ./
- name: Run tests
run: npm test
e2e-tests:
needs: [stack-name, unit-tests]
runs-on: ubuntu-latest
env:
STACK_PREFIX: ${{ needs.stack-name.outputs.stackPrefix }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: "24.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5
with:
# The role is set up via https://github.com/bifravst/ci
# secrets.CI__AWS_ACCOUNT_ID is an organization secret
role-to-assume: |
arn:aws:iam::${{ secrets.CI__AWS_ACCOUNT_ID }}:role/${{ github.repository_owner }}-ci-${{ github.event.repository.name }}
# vars.CI__AWS_REGION is an organization variable
aws-region: ${{ vars.CI__AWS_REGION }}
- name: Deploy to AWS
run: npm run cdk:ci:deploy
# E2E tests are retried, because wiring up the new stack can take a while
- name: Run e2e tests
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 5
command: npm run test:e2e
- name: Print failed End-to-End tests
if: failure()
run:
cat e2e-test-result.json | node --experimental-transform-types
--no-warnings ./feature-runner/console-reporter.ts --only-failed
--with-timestamps
- uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-test-result-${{ github.sha }}
path: e2e-test-result.json
- name: Get logs
if: failure()
env:
NODE_OPTIONS: "--experimental-transform-types --no-warnings"
AWS_REGION: ${{ vars.CI__AWS_REGION }}
run: node ./aws/logs.ts
- uses: actions/upload-artifact@v4
if: failure()
with:
name: logs-${{ github.sha }}
path: logs
- name: Export to-be released version
run: |
npx semantic-release --dry-run > semantic-release.out
echo "RELEASE_VERSION=$(cat semantic-release.out | grep 'The next release version is' | awk '{print $11}')" >> $GITHUB_ENV
cat semantic-release.out
- name: Semantic release
if: env.RELEASE_VERSION != ''
id: semantic-release
run: npx semantic-release
- name: Trigger deployment workflow
if:
steps.semantic-release.outcome == 'success' && env.RELEASE_VERSION
!= ''
run: |
gh workflow run --ref saga deploy.yaml -F ref=${{ github.sha }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: lambdas-${{ github.sha }}
path: dist
- name: Trigger cleanup workflow
if: always()
run: |
gh workflow run --ref "${{ github.ref }}" cleanup.yaml -F stackPrefix=${{ needs.stack-name.outputs.stackPrefix }}