Update CI configuration with test job
This commit is contained in:
121
.gitlab-ci.yml
Normal file
121
.gitlab-ci.yml
Normal file
@@ -0,0 +1,121 @@
|
||||
stages:
|
||||
- build-web
|
||||
- build-desktop
|
||||
|
||||
variables:
|
||||
# Cache configuration
|
||||
npm_config_cache: "$CI_PROJECT_DIR/.npm"
|
||||
ELECTRON_CACHE: "$CI_PROJECT_DIR/.cache/electron"
|
||||
|
||||
# Cache node_modules and electron cache
|
||||
cache:
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
paths:
|
||||
- pwa/node_modules/
|
||||
- pwa/.npm/
|
||||
- pwa/.cache/
|
||||
|
||||
# Build the web application first
|
||||
build:web:
|
||||
stage: build-web
|
||||
image: node:20-alpine
|
||||
script:
|
||||
- cd pwa
|
||||
- npm ci
|
||||
- npm run build
|
||||
artifacts:
|
||||
paths:
|
||||
- pwa/dist/
|
||||
expire_in: 1 hour
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG' # Run on tags
|
||||
- if: '$CI_COMMIT_BRANCH == "main"' # Run on main branch
|
||||
- if: '$CI_COMMIT_BRANCH == "develop"' # Run on develop branch
|
||||
|
||||
# Build Linux AppImage and .deb
|
||||
build:linux:
|
||||
stage: build-desktop
|
||||
image: electronuserland/builder:wine
|
||||
dependencies:
|
||||
- build:web
|
||||
script:
|
||||
- cd pwa
|
||||
- npm ci
|
||||
- npm run electron:build:linux
|
||||
artifacts:
|
||||
paths:
|
||||
- pwa/dist-electron/*.AppImage
|
||||
- pwa/dist-electron/*.deb
|
||||
expire_in: 1 week
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG' # Only run on tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
# Build Windows executable
|
||||
build:windows:
|
||||
stage: build-desktop
|
||||
image: electronuserland/builder:wine
|
||||
dependencies:
|
||||
- build:web
|
||||
script:
|
||||
- cd pwa
|
||||
- npm ci
|
||||
- npm run electron:build:win
|
||||
artifacts:
|
||||
paths:
|
||||
- pwa/dist-electron/*.exe
|
||||
- pwa/dist-electron/*.msi
|
||||
expire_in: 1 week
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG' # Only run on tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
# Build macOS (requires macOS runner - optional)
|
||||
# Uncomment if you have a macOS runner available
|
||||
# build:mac:
|
||||
# stage: build-desktop
|
||||
# dependencies:
|
||||
# - build:web
|
||||
# script:
|
||||
# - cd pwa
|
||||
# - npm ci
|
||||
# - npm run electron:build:mac
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - pwa/dist-electron/*.dmg
|
||||
# expire_in: 1 week
|
||||
# rules:
|
||||
# - if: '$CI_COMMIT_TAG'
|
||||
# tags:
|
||||
# - macos
|
||||
|
||||
# Manual job to test builds without tags
|
||||
build:manual:
|
||||
stage: build-desktop
|
||||
image: electronuserland/builder:wine
|
||||
script:
|
||||
- cd pwa
|
||||
- npm ci
|
||||
- npm run electron:build:linux
|
||||
artifacts:
|
||||
paths:
|
||||
- pwa/dist-electron/
|
||||
expire_in: 1 day
|
||||
when: manual
|
||||
tags:
|
||||
- docker
|
||||
|
||||
# Test job to verify CI is working (no tags required)
|
||||
test:ci:
|
||||
stage: build-web
|
||||
image: alpine:latest
|
||||
script:
|
||||
- echo "CI is working!"
|
||||
- echo "Project directory:"
|
||||
- ls -la
|
||||
- echo "PWA directory:"
|
||||
- ls -la pwa/ || echo "PWA directory not found"
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"' # Run on every push
|
||||
Reference in New Issue
Block a user