Skip to content

Commit

Permalink
Merge pull request #72 from maykinmedia/feature/build-frontend-in-ci
Browse files Browse the repository at this point in the history
Build frontend as part of CI
  • Loading branch information
SilviaAmAm authored Jun 7, 2024
2 parents 6228ea5 + 2edc310 commit aaef793
Show file tree
Hide file tree
Showing 8 changed files with 2,866 additions and 550 deletions.
75 changes: 47 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,50 @@ jobs:
working-directory: backend
files: ./coverage.xml

# frontend-build:
# name: Create 'production' build
# runs-on: ubuntu-latest
#
# defaults:
# run:
# working-directory: frontend
#
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v3
# with:
# node-version-file: 'frontend/.nvmrc'
#
# - name: Build Javascript
# run: |
# npm ci --legacy-peer-deps
# npm run build
#
# - name: Store build artifact
# uses: actions/upload-artifact@v3
# with:
# name: open-archiefbeheer-frontend-build
# path: dist/
# retention-days: 1
frontend-build:
name: Build frontend
runs-on: ubuntu-latest

defaults:
run:
working-directory: frontend

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'frontend/.nvmrc'

- name: Build Javascript
run: |
npm ci --legacy-peer-deps
CI=false npm run build
frontend-tests:
name: Run storybook tests
needs: frontend-build
runs-on: ubuntu-latest

defaults:
run:
working-directory: frontend

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'frontend/.nvmrc'
- name: Install dependencies
run: npm ci
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build Storybook
run: npm run build-storybook
- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006" \
"npx wait-on tcp:127.0.0.1:6006 && npm run test-storybook"
docs:
name: Build and check documentation
Expand Down Expand Up @@ -155,7 +174,7 @@ jobs:

- run: docker image save -o image.tar $IMAGE_NAME:${{ steps.vars.outputs.tag }}
- name: Store image artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docker-image
path: image.tar
Expand All @@ -164,18 +183,18 @@ jobs:
docker_push:
needs:
- backend-tests
- frontend-build
- docker_build

name: Push Docker image
runs-on: ubuntu-latest
if: github.event_name == 'push' # Exclude PRs

steps:
# This will include the updated OAS (if updated) from the update-oas job.
- uses: actions/checkout@v4

- name: Download built image
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: docker-image

Expand Down
1 change: 1 addition & 0 deletions frontend/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
Loading

0 comments on commit aaef793

Please sign in to comment.