-
Notifications
You must be signed in to change notification settings - Fork 7
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
Improved build process #1566
Merged
Merged
Improved build process #1566
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5cb9bf4
First crack at a parallelisable build process
fredex42 f47c71b
set build number properly, add path fix
fredex42 f0c7f0d
fix frontend integration test, versions & build number
fredex42 d8cc86e
explicitly bump backend to java11
fredex42 7278bcd
Remove sbt-riffraff plugin and deprecated jvm-11 options
fredex42 1497134
Pick up JSPM packages from client v1 build too
fredex42 34587a3
We shouldn't need DB service during backend build, only test
fredex42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
name: Facia-Tool CI | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
generate_build_number: | ||
name: Generate build number | ||
runs-on: ubuntu-latest | ||
outputs: | ||
BUILD_NUMBER: ${{ steps.create-build-number.outputs.BUILD_NUMBER }} | ||
steps: | ||
- id: create-build-number | ||
name: Create build number | ||
run: | | ||
LAST_TEAMCITY_BUILD=7962 | ||
echo "BUILD_NUMBER=$(( $GITHUB_RUN_NUMBER + $LAST_TEAMCITY_BUILD ))" >> "$GITHUB_OUTPUT" | ||
|
||
build_client_v1: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- 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 bundle | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: fronts-client-v1 | ||
path: public/fronts-client-v1 | ||
if-no-files-found: error | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: jspm-packages | ||
path: public/src/jspm_packages | ||
if-no-files-found: error | ||
test_client_v1: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- 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@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: fronts-client/.nvmrc | ||
cache: yarn | ||
cache-dependency-path: fronts-client/yarn.lock | ||
- run: yarn install --frozen-lockfile | ||
working-directory: fronts-client | ||
- run: yarn build | ||
working-directory: fronts-client | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: fronts-client-v2 | ||
path: public/fronts-client-v2 | ||
if-no-files-found: error | ||
test_client_v2: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: fronts-client/.nvmrc | ||
cache: yarn | ||
cache-dependency-path: fronts-client/yarn.lock | ||
- run: yarn install --frozen-lockfile | ||
working-directory: fronts-client | ||
- run: yarn test | ||
working-directory: fronts-client | ||
|
||
integrationtest_client_v2: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
needs: | ||
- build_client_v2 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: fronts-client/.nvmrc | ||
cache: yarn | ||
cache-dependency-path: fronts-client/yarn.lock | ||
- uses: actions/download-artifact@v4 #integration test requires built frontend (of course!) | ||
with: | ||
path: public/fronts-client-v2 | ||
name: fronts-client-v2 | ||
- run: yarn install --frozen-lockfile | ||
working-directory: fronts-client | ||
- run: yarn 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@v4 | ||
- 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 | ||
- generate_build_number | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: public/fronts-client-v1 | ||
name: fronts-client-v1 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: public/fronts-client-v2 | ||
name: fronts-client-v2 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: jspm-packages | ||
path: public/src/jspm_packages | ||
- name: Set GITHUB_RUN_NUMBER environment variable | ||
run: | | ||
echo "GITHUB_RUN_NUMBER=${{ needs.generate_build_number.outputs.BUILD_NUMBER }}" >> $GITHUB_ENV | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: "11" | ||
distribution: "corretto" | ||
cache: "sbt" | ||
- name: Bundle | ||
run: sbt debian:packageBin | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-package | ||
path: target/facia-tool_1.0_all.deb | ||
if-no-files-found: error | ||
compression-level: '0' #no point, it's already compressed | ||
upload: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
pull-requests: write | ||
needs: | ||
- generate_build_number | ||
- test_client_v1 | ||
- test_client_v2 | ||
- test_backend | ||
- build_backend | ||
- integrationtest_client_v2 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: target/facia-tool_1.0_all.deb | ||
name: build-package | ||
- name: Set GITHUB_RUN_NUMBER environment variable | ||
run: | | ||
echo "GITHUB_RUN_NUMBER=${{ needs.generate_build_number.outputs.BUILD_NUMBER }}" >> $GITHUB_ENV | ||
- uses: guardian/actions-riff-raff@v4 | ||
with: | ||
app: facia-tool | ||
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }} | ||
buildNumber: ${{ env.GITHUB_RUN_NUMBER }} | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
configPath: riff-raff.yaml | ||
contentDirectories: | | ||
facia-tool: | ||
- target/facia-tool_1.0_all.deb |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FMI as I'm sure it is – why is this necessary? Doesn't the AMI provide a Java runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically it's not necessary - but it's good practise when building a java-based DEB to have a generic JRE dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Andy is correct that technically it isn't necessary. But if this line is present, it needs to be correct. AFAIK if you left this as openjdk-8-jre-headless the package would fail to install.