This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
chore(deps): update aws-sdk-js-v3 monorepo to v3.606.0 #17693
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Release | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
skipCleanup: | |
description: "Skip cleanup" | |
required: false | |
default: "no" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: eu-west-1 | |
AWS_DEFAULT_REGION: eu-west-1 | |
CI: 1 | |
FORCE_COLOR: 3 | |
JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION: 1 | |
jobs: | |
tests: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: "npm" | |
- name: Cache AWS CLI | |
id: cache-aws-cli-linux | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/aws/ | |
key: ${{ runner.OS }}-cache-aws-cli | |
- name: Install AWS | |
if: steps.cache-aws-cli-linux.outputs.cache-hit != 'true' | |
working-directory: /tmp | |
run: | | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip -q awscliv2.zip | |
sudo ./aws/install --update | |
- name: Install dependencies | |
run: npm ci --no-audit | |
- name: Compile TypeScript for type checking | |
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 Unit Tests | |
run: npm test | |
- name: Generate Stack ID | |
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 "STACK_NAME=at-${{ runner.OS }}-${RANDOM_STRING}" >> $GITHUB_ENV | |
- run: aws sts get-caller-identity | |
- run: echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV | |
- name: Set up stack for End-to-End tests | |
run: | | |
npx cdk -a 'node --import tsx --no-warnings --unhandled-rejections=strict cdk/cloudformation-test.ts' bootstrap aws://`aws sts get-caller-identity | jq -r '.Account' | tr -d '\n'`/${{ env.AWS_REGION }} | |
npx cdk -a 'node --import tsx --no-warnings --unhandled-rejections=strict cdk/cloudformation-http-api-mock.ts' deploy '*' --require-approval never | |
./cli.sh configure thirdParty nrfcloud teamId `uuidgen` | |
openssl ecparam -name prime256v1 -genkey | ./cli.sh configure thirdParty nrfcloud serviceKey | |
MOCK_HTTP_API_ENDPOINT=`aws cloudformation describe-stacks --stack-name ${STACK_NAME}-mock-http-api | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "apiURL") | .OutputValue' | sed -E 's/\/$//g'` | |
./cli.sh configure thirdParty nrfcloud endpoint ${MOCK_HTTP_API_ENDPOINT}/api.nrfcloud.com | |
npx cdk -a 'node --import tsx --no-warnings --unhandled-rejections=strict cdk/cloudformation-test.ts' deploy '*' --require-approval never | |
- name: Create CA | |
run: ./cli.sh create-ca --tags ci,repository=${{ github.repository }} | |
- name: Run End-to-End Tests | |
run: npm run test:e2e | |
- name: Print failed End-to-End tests | |
if: failure() | |
run: | |
cat e2e-test-result.json | npx tsx --no-warnings | |
./feature-runner/console-reporter.ts --only-failed --with-timestamps | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: e2e-test-result | |
path: e2e-test-result.json | |
- name: Get logs | |
if: failure() | |
run: ./cli.sh logs | |
- name: Clean up End-to-End test resources | |
if: | |
always() && !contains(toJSON(github.event.commits.*.message), | |
'[skip-cleanup]') && github.event.inputs.skipCleanup != 'yes' | |
run: | | |
./cli.sh configure thirdParty nrfcloud teamId -X | |
./cli.sh configure thirdParty nrfcloud serviceKey -X | |
./cli.sh configure thirdParty nrfcloud endpoint -X | |
./cli.sh purge-iot-user-policy-principals | |
./cli.sh purge-cas -c | |
./cli.sh logs -X | |
# Purge Buckets does not remove the source-code bucket (because it will be populate again by the CDK command) | |
./cli.sh purge-buckets | |
npx cdk -a 'node --import tsx --no-warnings --unhandled-rejections=strict cdk/cloudformation-test.ts' destroy -f '*' | |
npx cdk -a 'node --import tsx --no-warnings --unhandled-rejections=strict cdk/cloudformation-http-api-mock.ts' destroy -f '*' | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
if-no-files-found: error | |
name: lambdas-${{ github.sha }} | |
path: dist/**/*.zip | |
release: | |
needs: tests | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/saga' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci --no-audit | |
- name: Semantic release | |
run: npx semantic-release |