From a09d86733519651c58d403dbc002e87cd49a0588 Mon Sep 17 00:00:00 2001 From: Emily Bourke Date: Mon, 17 Jul 2023 14:51:43 +0100 Subject: [PATCH] CI: Inline scripts into workflow This makes it easier to skip steps for dependabot PRs, and possibly makes better use of the UI. --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++---- script/cfn.sh | 14 ------------- script/ci.sh | 25 ----------------------- 3 files changed, 39 insertions(+), 43 deletions(-) delete mode 100755 script/cfn.sh delete mode 100755 script/ci.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd84f5f..5f6a041 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,8 +48,11 @@ jobs: node-version-file: './.nvmrc' cache: 'yarn' - - name: Build project and generate Riff-Raff artefact - run: ./script/ci.sh + - name: Yarn + run: | + yarn clean + yarn install + yarn run build - name: Run unit tests run: yarn test --silent @@ -58,8 +61,40 @@ jobs: TEST_DB_USER: postgres TEST_DB_PASSWORD: postgres - - name: Generate CFN templates from GuCDK - run: ./script/cfn.sh + - name: Copy files to Riff Raff package + if: >- + github.actor != 'dependabot[bot]' + && github.event.pull_request.user.login != 'dependabot[bot]' + run: cp package.json riff-raff.yaml target + + - name: Yarn install in package + if: >- + github.actor != 'dependabot[bot]' + && github.event.pull_request.user.login != 'dependabot[bot]' + working-directory: ./target + run: yarn install --production + + - name: Zip target directory contents (quietly) + if: >- + github.actor != 'dependabot[bot]' + && github.event.pull_request.user.login != 'dependabot[bot]' + run: zip -qr ../support-reminders.zip ./* + working-directory: ./target + + - name: Yarn (CDK) + working-directory: cdk + run: | + yarn install + yarn tsc + yarn lint + yarn test + + - name: Yarn synth (CDK) + if: >- + github.actor != 'dependabot[bot]' + && github.event.pull_request.user.login != 'dependabot[bot]' + working-directory: cdk + run: yarn synth - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v2 diff --git a/script/cfn.sh b/script/cfn.sh deleted file mode 100755 index 90aacf0..0000000 --- a/script/cfn.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x - -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -ROOT_DIR="${DIR}/.." -cd "$ROOT_DIR/cdk" - -yarn install -yarn tsc -yarn lint -yarn test -yarn synth diff --git a/script/ci.sh b/script/ci.sh deleted file mode 100755 index 86ff9bc..0000000 --- a/script/ci.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x - -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -ROOT_DIR="${DIR}/.." -cd "$ROOT_DIR" - -yarn clean -yarn install -yarn tsc -yarn lint -yarn build - -cp package.json target -cp riff-raff.yaml target - -pushd target -yarn install --production -popd - -cd target - -zip -FSr "${ROOT_DIR}/support-reminders.zip" ./*