Improved build process #2
Workflow file for this run
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: Facia-Tool CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_client_v1: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
cache-dependency-path: package-lock.json | |
- name: Set up grunt | |
run: npm i -g grunt-cli | |
- name: Install NPM dependencies | |
run: npm install | |
- name: Set up JSPM | |
env: | |
JSPM_GITHUB_AUTH_SECRET: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm run jspm config registries.github.auth ${JSPM_GITHUB_AUTH_SECRET} | |
npm run jspm registry export github | |
- name: Install JSPM dependencies | |
run: npm run jspm install | |
- name: Build frontend v1 | |
run: | | |
grunt --stack validate | |
grunt --stack bundle | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: fronts-client.dist | |
path: public/fronts-client.dist | |
test_client_v1: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
cache-dependency-path: package-lock.json | |
- name: Set up grunt | |
run: npm i -g grunt-cli | |
- name: Install NPM dependencies | |
run: npm install | |
- name: Set up JSPM | |
env: | |
JSPM_GITHUB_AUTH_SECRET: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm run jspm config registries.github.auth ${JSPM_GITHUB_AUTH_SECRET} | |
npm run jspm registry export github | |
- name: Install JSPM dependencies | |
run: npm run jspm install | |
- name: Test frontend v1 | |
run: | | |
grunt --stack validate | |
grunt --stack test | |
build_client_v2: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: fronts-client/.nvmrc | |
cache: yarn | |
cache-dependency-path: fronts-client/yarn.lock | |
- run: yarn ci | |
working-directory: fronts-client | |
- run: yarn build | |
working-directory: fronts-client | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: fronts-client-v2 | |
path: public/fronts-client-v2 | |
test_client_v2: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: fronts-client/.nvmrc | |
cache: yarn | |
cache-dependency-path: fronts-client/yarn.lock | |
- run: yarn ci | |
working-directory: fronts-client | |
- run: yarn test | |
working-directory: fronts-client | |
- run: test-integration-ci | |
working-directory: fronts-client | |
test_backend: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
services: | |
# See https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers | |
postgres: | |
image: postgres:10.7-alpine | |
env: | |
POSTGRES_USER: faciatool | |
POSTGRES_PASSWORD: faciatool | |
POSTGRES_DB: faciatool | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 4724:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "11" | |
distribution: "corretto" | |
cache: "sbt" | |
- name: Run tests | |
run: sbt 'test; database-int:test' | |
build_backend: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
needs: | |
- build_client_v1 | |
- build_client_v2 | |
services: | |
# See https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers | |
postgres: | |
image: postgres:10.7-alpine | |
env: | |
POSTGRES_USER: faciatool | |
POSTGRES_PASSWORD: faciatool | |
POSTGRES_DB: faciatool | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 4724:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "11" | |
distribution: "corretto" | |
cache: "sbt" | |
- name: Bundle | |
run: sbt debian:packageBin | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build-package | |
path: target/facia-tool_1.0_all.deb | |
upload: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
needs: | |
- test_client_v1 | |
- test_client_v2 | |
- test_backend | |
- build_backend | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
path: target/facia-tool_1.0_all.deb | |
name: build-package | |
- uses: guardian/actions-riff-raff@v4 | |
with: | |
app: cms-fronts::facia-tool | |
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
configPath: riff-raff.yaml | |
contentDirectories: | | |
facia-tool: | |
- target/facia-tool_1.0_all.deb |