Merge pull request #117 from guardian/dependabot/npm_and_yarn/cdk/esl… #248
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: Build support-reminders | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
CI: | |
if: github.repository_owner == 'guardian' | |
# Required by actions-assume-aws-role | |
permissions: | |
id-token: write | |
contents: read | |
name: support-reminders build | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Env | |
run: env | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: './.nvmrc' | |
cache: 'yarn' | |
- name: Yarn | |
run: | | |
yarn clean | |
yarn install | |
yarn run build | |
- name: Run unit tests | |
run: yarn test --silent | |
env: | |
TEST_DB_URL: postgresql://localhost/postgres | |
TEST_DB_USER: postgres | |
TEST_DB_PASSWORD: postgres | |
- 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 | |
if: >- | |
github.actor != 'dependabot[bot]' | |
&& github.event.pull_request.user.login != 'dependabot[bot]' | |
with: | |
aws-region: eu-west-1 | |
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }} | |
- name: Upload to Riff-Raff | |
uses: guardian/actions-riff-raff@v2 | |
if: >- | |
github.actor != 'dependabot[bot]' | |
&& github.event.pull_request.user.login != 'dependabot[bot]' | |
with: | |
app: support-reminders | |
configPath: ./riff-raff.yaml | |
contentDirectories: | | |
support-reminders-cloudformation: | |
- ./cdk/cdk.out/SupportReminders-CODE.template.json | |
- ./cdk/cdk.out/SupportReminders-PROD.template.json | |
support-reminders: | |
- ./support-reminders.zip | |