Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate giant to github actions #153

Merged
merged 12 commits into from
Oct 2, 2023
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Find full documentation here https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: CI

on:
# Manual invocation.
workflow_dispatch:

push:

jobs:
CI:
runs-on: ubuntu-latest

# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
permissions:
# required by aws-actions/configure-aws-credentials
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

# Setup AWS credentials to enable uploading to S3 for Riff-Raff.
# See https://github.com/aws-actions/configure-aws-credentials
- uses: aws-actions/configure-aws-credentials@v4
name: setup-riffraff-credentials
with:
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
aws-region: eu-west-1

# TODO: configure caching
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

# TODO: configure caching
# See https://github.com/actions/setup-java
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'

- name: Run script/teamcity
run: |
LAST_TEAMCITY_BUILD=5000
export GITHUB_RUN_NUMBER=$(( $GITHUB_RUN_NUMBER + $LAST_TEAMCITY_BUILD ))
./scripts/ci.sh
2 changes: 1 addition & 1 deletion riff-raff.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# We implement deploying to multiple stages by doing multiple builds in `teamcity.sh`
# We implement deploying to multiple stages by doing multiple builds in `ci.sh`
# updating all references to `pfi-playground` in this file between each.
stacks: [pfi-playground]
regions: [eu-west-1]
Expand Down
14 changes: 4 additions & 10 deletions scripts/teamcity.sh → scripts/ci.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/usr/bin/env bash
set -e

# Make Create React App treat warnings as errors
export CI=true

export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads nvm

nvm install
nvm use

pushd frontend

npm install
Expand All @@ -21,7 +12,10 @@ popd
cp -r frontend/build/* backend/public
# Replace the symbolic link we use in dev with the actual file.
# On Teamcity the JDeb build doesn't seem to follow the symbolic link while packaging, weirdly
cp frontend/node_modules/pdfjs-dist/build/pdf.worker.min.js backend/public/third-party/pdf.worker.min.js
# NOTE: On Github actions this seems to work, and in fact it will complain if you try and run the below line
# because it thinks that the two files are the same. So could be removed at some point but let's leave it for
# a bit in case e.g. github actions custom runners have similar issues
#cp frontend/node_modules/pdfjs-dist/build/pdf.worker.min.js backend/public/third-party/pdf.worker.min.js

#Use java 11
export JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto
Expand Down