From 134aa224fdf3a64e6edffe7cc6bf30fef5c67697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Fri, 3 May 2024 21:25:08 +0200 Subject: [PATCH] ci: split build job into webpack and vite --- .github/workflows/nodejs.yml | 38 ++++++++++++++++++++++++++++++------ Makefile | 14 +++++++------ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6a001b33..4c44fdf3 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -7,17 +7,43 @@ on: branches: [ master ] jobs: - build: - name: Build (node-${{ matrix.node-version }}) + build-webpack: + name: Build webpack (node-${{ matrix.node-version }}) + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20] + include: + - node-version: '20' + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install + run: npm ci + - name: Build + run: make build + - name: Upload build + uses: actions/upload-artifact@v3.1.2 + with: + name: build-webpack + path: dist/* + + build-vite: + name: Build vite (node-${{ matrix.node-version }}) runs-on: ubuntu-latest strategy: matrix: node-version: [20] - python-version: ['3.9'] include: - node-version: '20' - python-version: '3.9' steps: - uses: actions/checkout@v4 @@ -30,11 +56,11 @@ jobs: - name: Install run: npm ci - name: Build - run: npm run build + run: make build-vite - name: Upload build uses: actions/upload-artifact@v3.1.2 with: - name: build + name: build-vite path: dist/* test: diff --git a/Makefile b/Makefile index 2ff44c1b..bb5415b3 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,18 @@ else androidflag := endif -build: install static/logo.png static/logo.svg +prebuild: install static/logo.png static/logo.svg + +build: prebuild npm run build ${androidflag} -vite-build: +dev: prebuild + npm run serve ${androidflag} + +build-vite: prebuild npx vite build -vite-dev: +dev-vite: prebuild npx vite static/logo.%: media/logo/logo.% @@ -30,9 +35,6 @@ install: uninstall: rm -r node_modules/ -dev: - npm run serve ${androidflag} - test: npm test