Skip to content

Commit

Permalink
Merge pull request #23 from hotosm/ci/frontend-build-test
Browse files Browse the repository at this point in the history
Build Frontend Static on PR create
  • Loading branch information
nischalstha9 authored Jul 3, 2024
2 parents d3d4b58 + d9dc1c5 commit a8ad94a
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Precommit Code Check
on:
pull_request:
branches:
- master
- main
- develop
- staging
push:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/test_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test Frontend Static Build

on:
pull_request:
branches:
- main
- develop
- staging
paths:
- src/frontend/**
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
build:
name: Build JavaScript assets
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- name: Use Node.js 19.x
uses: actions/setup-node@v1
with:
node-version: 19.x

- name: Install yarn
working-directory: ./src/frontend/
run: npm install -g yarn

- name: Cache node_modules
uses: actions/cache@v2
with:
path: ./src/frontend/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Write Environment Variables
id: write_env
working-directory: ./src/frontend/
run: |
echo ${{ vars.FRONTEND_ENV_VARS }} > .env
- name: Install dependencies
working-directory: ./src/frontend/
run: yarn

- name: Generate build
working-directory: ./src/frontend/
run: |
yarn build

0 comments on commit a8ad94a

Please sign in to comment.