name: CI on: push: branches: [ main, develop ] pull_request: branches: [ main ] jobs: test: runs-on: ubuntu-latest strategy: matrix: node-version: [18.x, 20.x] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Install dependencies run: npm install - name: Run tests run: npm test - name: Start server and test health endpoint run: | npm start & sleep 5 curl -f http://localhost:3000/api/health || exit 1 docker: runs-on: ubuntu-latest needs: test steps: - uses: actions/checkout@v4 - name: Build Docker image run: docker build -t openhamclock:test . - name: Test Docker container run: | docker run -d -p 3000:3000 --name ohc-test openhamclock:test sleep 10 curl -f http://localhost:3000/api/health || exit 1 docker stop ohc-test build-electron: runs-on: ${{ matrix.os }} needs: test if: github.event_name == 'push' && github.ref == 'refs/heads/main' strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: 20.x - name: Install dependencies run: npm install - name: Build Electron app run: npm run electron:build env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: electron-${{ matrix.os }} path: dist/ retention-days: 7