From 84c1f12fab0e7bc8afe084e84ef5952056ff4a91 Mon Sep 17 00:00:00 2001 From: Dmitry Romanov Date: Wed, 8 May 2024 16:40:07 -0400 Subject: [PATCH] Fix build workflow and use cache in CI --- .github/workflows/frontend.yaml | 29 ++++++++++++++++++++++------- firebird-ng/package.json | 5 +++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/frontend.yaml b/.github/workflows/frontend.yaml index ff125c9..b73c346 100644 --- a/.github/workflows/frontend.yaml +++ b/.github/workflows/frontend.yaml @@ -16,13 +16,16 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' # LTS active till Fall 2024 + node-version: '20' + cache: 'npm' + - name: Install Dependencies working-directory: ./firebird-ng run: npm install + - name: Run Tests working-directory: ./firebird-ng - run: npm run test-headless + run: npm run test:headless build: needs: test @@ -32,13 +35,18 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' # Same Node version as the test job - - name: Install Dependencies - working-directory: ./firebird-ng - run: npm install + node-version: '20' + cache: 'npm' + - name: Build working-directory: ./firebird-ng - run: ng build --prod + run: npm run build + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: built-site + path: ./firebird-ng/dist/ deploy: if: github.ref == 'refs/heads/master' || endsWith(github.ref, '-ci') @@ -46,6 +54,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + name: built-site + path: ./dist/firebird-ng + - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: diff --git a/firebird-ng/package.json b/firebird-ng/package.json index c640a24..e25d4c5 100644 --- a/firebird-ng/package.json +++ b/firebird-ng/package.json @@ -4,10 +4,11 @@ "scripts": { "ng": "ng", "start": "ng serve", - "build": "ng build", + "build": "ng build --configuration=production", + "build:watch": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", - "test-headless": "ng test --browsers=ChromeHeadless --watch=false --code-coverage --progress=false" + "test:headless": "ng test --browsers=ChromeHeadless --watch=false --code-coverage --progress=false" }, "private": true, "dependencies": {