Skip to content

Update build scripts #187

Update build scripts

Update build scripts #187

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache-dependency-path: backend/build.gradle
cache: gradle
- uses: actions/setup-node@v4
with:
node-version: '22'
cache-dependency-path: '**/package-lock.json'
cache: npm
- name: Build backend
run: |
cd backend
./gradlew build --info --warning-mode=summary
- name: Sonar analysis
if: ${{ env.SONAR_TOKEN != null }}
run: |
cd backend
./gradlew sonarqube -Dsonar.token=$SONAR_TOKEN \
--info --warning-mode=summary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Configure infrastructure
run: |
cat > infrastructure/infrastructure-config.ts << EOF
import { InfrastructureConfig } from "./lib/infrastructure-config-interface";
export const CONFIG: InfrastructureConfig = {
region: "eu-west-1",
domain: "ec2-controller.example.com",
hostedZoneName: "example.com.",
hostedZoneId: "XXXXXXXXXXXXXX",
sslCertificateArn: "arn:aws:acm:us-east-1:000000000000:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
stackName: "ec2-controller",
contactEmailAddress: "[email protected]"
};
EOF
- name: Build infrastructure
run: |
cd infrastructure
npm ci
npm run cdk synth
npm run lint
- name: Configure frontend
run: |
cat > frontend/src/frontend-config.ts << EOF
import { FrontendConfig } from "./environment";
export const CONFIG: FrontendConfig = {
region: "eu-west-1",
apiGatewayEndpointUrl: "https://xxxxxxxxxx.execute-api.eu-west-1.amazonaws.com/prod",
cognitoIdentityPoolId: "eu-west-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
cognitoUserPoolId: "eu-west-1_xxxxxxxxx",
cognitoUserPoolWebClientId: "xxxxxxxxxxxxxxxxxxxxxxxxxx"
};
EOF
- name: Build frontend
run: |
cd frontend
npm ci
npm run build
npm run lint