diff --git a/.github/workflows/CONTRIBUTING.md b/.github/workflows/CONTRIBUTING.md new file mode 100644 index 00000000..8e86bda4 --- /dev/null +++ b/.github/workflows/CONTRIBUTING.md @@ -0,0 +1,205 @@ +# Contributing to Void GitHub Actions Workflows + +This document provides guidelines for contributing to the GitHub Actions workflows in the Void project. + +## Workflow Structure + +Each workflow file is located in the `.github/workflows/` directory and follows the standard GitHub Actions YAML format. + +## Creating a New Workflow + +To create a new workflow: + +1. **Identify the purpose**: Determine what the workflow should accomplish (build, test, deploy, etc.) +2. **Choose a name**: Use descriptive names like `build.yml`, `test.yml`, `deploy.yml` +3. **Define triggers**: Specify when the workflow should run (push, pull_request, schedule, workflow_dispatch) +4. **Define jobs**: Break down the workflow into logical jobs +5. **Add documentation**: Update the `README.md` in the workflows directory + +## Best Practices + +### 1. Use Reusable Workflows + +When possible, reuse common steps across workflows: + +```yaml +steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' +``` + +### 2. Use Matrix Strategy + +For testing across multiple platforms or versions: + +```yaml +strategy: + matrix: + os: [ubuntu-22.04, macos-12, windows-2022] + node-version: [18, 20] +``` + +### 3. Cache Dependencies + +Always cache dependencies to speed up builds: + +```yaml +- name: Cache node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} +``` + +### 4. Set Timeouts + +Always set timeouts to prevent workflows from running indefinitely: + +```yaml +runs-on: ubuntu-22.04 +timeout-minutes: 60 +``` + +### 5. Use Environment Variables + +For sensitive data, use GitHub Secrets: + +```yaml +env: + API_KEY: ${{ secrets.API_KEY }} +``` + +### 6. Clean Up Artifacts + +Remove unnecessary files to save storage: + +```yaml +- name: Clean up + run: | + rm -rf node_modules + rm -rf out +``` + +## Testing Workflows + +Before committing a workflow: + +1. **Test locally**: Use `act` (GitHub Actions runner) to test workflows locally +2. **Test in a branch**: Push to a feature branch and verify the workflow runs +3. **Check logs**: Review the workflow logs for any errors or warnings +4. **Verify artifacts**: If the workflow produces artifacts, verify they are correct + +## Common Workflow Patterns + +### Build Workflow + +```yaml +name: Build + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - run: npm ci + - run: npm run build +``` + +### Test Workflow + +```yaml +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - run: npm ci + - run: npm test +``` + +### Deployment Workflow + +```yaml +name: Deploy + +on: + push: + tags: + - 'v*' + +jobs: + deploy: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - run: npm ci + - run: npm run build + - name: Deploy to production + run: ./deploy.sh +``` + +## Workflow Documentation + +Each workflow should be documented in the `README.md` file in the workflows directory. Include: + +- **Purpose**: What the workflow does +- **Triggers**: When it runs +- **Jobs**: What each job does +- **Artifacts**: Any artifacts produced +- **Dependencies**: Required secrets or environment variables + +## Troubleshooting + +### Workflow Not Triggering + +1. Check the `on` section of the workflow +2. Verify the branch name matches +3. Check if the workflow is disabled in the repository settings + +### Workflow Failing + +1. Check the logs for error messages +2. Verify all dependencies are installed +3. Check for permission issues +4. Verify environment variables are set correctly + +### Workflow Running Too Long + +1. Check for infinite loops in the workflow +2. Verify all steps have timeouts +3. Check for hanging processes + +## Resources + +- [GitHub Actions Documentation](https://docs.github.com/en/actions) +- [GitHub Actions Marketplace](https://github.com/marketplace?type=actions) +- [act - Run GitHub Actions locally](https://github.com/nektos/act) diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000..f3bf222e --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,78 @@ +# GitHub Actions Workflows + +This directory contains the GitHub Actions workflows for building and testing Void. + +## Available Workflows + +### 1. `build.yml` - Main Build Workflow +Builds the main Void application and runs tests. +- **Triggers**: Push to `master` branch, pull requests, manual dispatch +- **Jobs**: + - `compile`: Compiles the project + - `test-unit`: Runs unit tests on Linux + - `test-browser`: Runs browser tests + - `lint`: Runs ESLint and Stylelint + - `hygiene`: Runs hygiene checks + +### 2. `build-cli.yml` - CLI Build Workflow +Builds the Void CLI (written in Rust) on Linux. +- **Triggers**: Push to `master` branch, pull requests, manual dispatch +- **Jobs**: + - `build-cli`: Builds and tests the CLI + +### 2.5. `build-cli-matrix.yml` - CLI Multi-platform Build Workflow +Builds the Void CLI (written in Rust) on multiple platforms. +- **Triggers**: Push to `master` branch, pull requests, manual dispatch +- **Jobs**: + - `build-cli`: Builds and tests the CLI on Ubuntu, macOS, and Windows + +### 3. `build-extensions.yml` - Extensions Build Workflow +Builds the extensions. +- **Triggers**: Push to `master` branch, pull requests, manual dispatch +- **Jobs**: + - `build-extensions`: Compiles all extensions + +### 4. `build-web.yml` - Web Build Workflow +Builds the web version of Void. +- **Triggers**: Push to `master` branch, pull requests, manual dispatch +- **Jobs**: + - `build-web`: Compiles the web version + +### 5. `triage.yml` - Issue Triage Workflow +Automatically triages GitHub issues using AI. +- **Triggers**: Scheduled every 6 hours, manual dispatch +- **Jobs**: + - `roadmap`: Updates the wiki with issue categories + +### 6. `publish-artifacts.yml` - Publish Build Artifacts +Publishes build artifacts for distribution. +- **Triggers**: Manual dispatch, scheduled every Monday at midnight UTC +- **Jobs**: + - `publish-artifacts`: Compiles all components and packages them for distribution + +### 7. `codeql-analysis.yml` - CodeQL Analysis +Performs static code analysis using CodeQL. +- **Triggers**: Push to `master` branch, pull requests, scheduled every Monday at midnight UTC +- **Jobs**: + - `analyze`: Analyzes the codebase for security and quality issues + +## Running Workflows Manually + +You can manually trigger any workflow by going to the GitHub Actions tab in your repository, selecting the workflow, and clicking "Run workflow". + +## Caching + +The workflows use GitHub Actions caching to speed up builds: +- Node.js dependencies are cached using `npm ci` +- Rust dependencies are cached for the CLI build +- Build artifacts are cached when possible + +## Environment + +All workflows run on Ubuntu 22.04 by default, with appropriate build tools installed. + +## Dependencies + +- Node.js version is specified in `.nvmrc` +- Rust toolchain is set to stable +- Build tools: `build-essential`, `pkg-config`, `libx11-dev`, `libx11-xcb-dev`, `libxkbfile-dev`, `libnotify-bin`, `libkrb5-dev` diff --git a/.github/workflows/USAGE.md b/.github/workflows/USAGE.md new file mode 100644 index 00000000..3cef9d5f --- /dev/null +++ b/.github/workflows/USAGE.md @@ -0,0 +1,228 @@ +# Utilisation des Workflows GitHub Actions + +Ce document explique comment utiliser les workflows GitHub Actions pour builder et tester le projet Void. + +## Table des Matières + +1. [Exécution des Workflows](#exécution-des-workflows) +2. [Workflow Principal (build.yml)](#workflow-principal-buildyml) +3. [Build de la CLI](#build-de-la-cli) +4. [Build des Extensions](#build-des-extensions) +5. [Build Web](#build-web) +6. [Publication des Artifacts](#publication-des-artifacts) +7. [Analyse CodeQL](#analyse-codeql) +8. [Triage des Issues](#triage-des-issues) +9. [Exécution Locale](#exécution-locale) +10. [Dépannage](#dépannage) + +## Exécution des Workflows + +### Déclenchement Automatique + +Tous les workflows sont configurés pour s'exécuter automatiquement dans les cas suivants : + +- **Push** sur la branche `master` +- **Pull Request** vers la branche `master` +- **Planifié** (pour certains workflows comme `triage.yml` et `codeql-analysis.yml`) + +### Déclenchement Manuel + +Vous pouvez déclencher manuellement n'importe quel workflow : + +1. Allez dans l'onglet **Actions** de votre dépôt GitHub +2. Sélectionnez le workflow que vous souhaitez exécuter +3. Cliquez sur le bouton **Run workflow** +4. Cliquez sur **Run workflow** à nouveau pour confirmer + +## Workflow Principal (build.yml) + +Ce workflow est le cœur du processus de build et de test. + +### Jobs disponibles : + +- **compile** : Compile le projet +- **test-unit** : Exécute les tests unitaires sur Linux +- **test-browser** : Exécute les tests navigateur +- **lint** : Exécute ESLint et Stylelint +- **hygiene** : Exécute les vérifications d'hygiène + +### Comment utiliser : + +```bash +# Pour voir les résultats des builds +cd /Users/jcommaret/Sites/void +npm run compile + +# Pour exécuter les tests unitaires +npm run test-node + +# Pour exécuter les tests navigateur +npm run playwright-install +npm run test-browser + +# Pour exécuter le linting +npm run eslint +npm run stylelint + +# Pour exécuter les vérifications d'hygiène +npm run hygiene +``` + +## Build de la CLI + +La CLI est écrite en Rust et peut être buildée sur différentes plateformes. + +### Build sur Linux/macOS/Windows : + +```bash +cd cli +cargo build --release +``` + +### Exécution des tests : + +```bash +cd cli +cargo test +``` + +### Build multi-plateforme : + +Le workflow `build-cli-matrix.yml` build la CLI sur : +- Ubuntu 22.04 +- macOS 12 +- Windows 2022 + +## Build des Extensions + +Les extensions sont buildées séparément pour permettre une mise à jour indépendante. + +### Comment build les extensions : + +```bash +npm run compile-extensions-build +``` + +## Build Web + +La version web de Void peut être buildée séparément. + +### Comment build la version web : + +```bash +npm run compile-web +``` + +## Publication des Artifacts + +Le workflow `publish-artifacts.yml` compile tous les composants et les package pour distribution. + +### Comment exécuter manuellement : + +1. Allez dans l'onglet **Actions** +2. Sélectionnez **Publish Build Artifacts** +3. Cliquez sur **Run workflow** + +### Artifacts produits : + +- `out/` : Build principal +- `void-cli-linux` : Binaire CLI pour Linux +- `out-vscode/` : Build web + +## Analyse CodeQL + +Le workflow `codeql-analysis.yml` effectue une analyse statique du code pour détecter les problèmes de sécurité et de qualité. + +### Comment voir les résultats : + +1. Allez dans l'onglet **Security** de votre dépôt +2. Sélectionnez **Code scanning** +3. Vous verrez les alertes détectées par CodeQL + +## Triage des Issues + +Le workflow `triage.yml` utilise l'IA pour trier automatiquement les issues GitHub. + +### Comment configurer : + +Vous devez configurer les secrets suivants dans votre dépôt : +- `OPENAI_API_KEY` : Clé API OpenAI +- `WIKI_TOKEN` : Token GitHub avec accès wiki + +### Comment exécuter manuellement : + +1. Allez dans l'onglet **Actions** +2. Sélectionnez **Issue Triage to Wiki** +3. Cliquez sur **Run workflow** + +## Exécution Locale + +Vous pouvez tester les workflows localement en utilisant `act` (GitHub Actions runner). + +### Installation : + +```bash +brew install act +``` + +### Exécution d'un workflow : + +```bash +act -j build +``` + +### Exécution de tous les workflows : + +```bash +act +``` + +## Dépannage + +### Problème : Le workflow ne se déclenche pas + +**Solutions** : +1. Vérifiez que le workflow est bien dans `.github/workflows/` +2. Vérifiez la section `on` du workflow YAML +3. Vérifiez que le workflow n'est pas désactivé dans les paramètres du dépôt +4. Vérifiez que vous avez les permissions nécessaires + +### Problème : Le workflow échoue + +**Solutions** : +1. Vérifiez les logs du workflow pour voir où il échoue +2. Vérifiez que toutes les dépendances sont installées +3. Vérifiez que les variables d'environnement sont correctement configurées +4. Vérifiez que vous avez assez d'espace disque +5. Vérifiez que vous avez assez de mémoire + +### Problème : Le workflow prend trop de temps + +**Solutions** : +1. Vérifiez que tous les jobs ont des timeouts configurés +2. Vérifiez qu'il n'y a pas de boucles infinies dans le code +3. Vérifiez que les dépendances sont bien cachées +4. Vérifiez que vous n'avez pas de processus qui s'exécutent indéfiniment + +### Problème : Les artifacts ne sont pas disponibles + +**Solutions** : +1. Vérifiez que le job qui produit les artifacts a réussi +2. Vérifiez que les artifacts sont bien configurés dans le workflow +3. Vérifiez que vous avez les permissions pour télécharger les artifacts +4. Vérifiez que les artifacts n'ont pas expiré (durée de conservation par défaut : 30 jours) + +## Bonnes Pratiques + +1. **Commitez souvent** : Plus vous commitez souvent, plus les workflows s'exécutent souvent, ce qui permet de détecter les problèmes plus tôt +2. **Utilisez des branches de feature** : Créez des branches de feature pour développer de nouvelles fonctionnalités et utilisez des pull requests pour les fusionner +3. **Vérifiez les workflows avant de fusionner** : Assurez-vous que tous les workflows passent avant de fusionner une pull request +4. **Nettoyez les artifacts** : Supprimez les artifacts inutiles pour économiser de l'espace de stockage +5. **Documentez les changements** : Documentez les changements apportés aux workflows dans les pull requests + +## Ressources + +- [Documentation GitHub Actions](https://docs.github.com/en/actions) +- [Marketplace GitHub Actions](https://github.com/marketplace?type=actions) +- [act - Run GitHub Actions locally](https://github.com/nektos/act) +- [CodeQL Documentation](https://codeql.github.com/docs/) diff --git a/.github/workflows/build-cli-matrix.yml b/.github/workflows/build-cli-matrix.yml new file mode 100644 index 00000000..b8cf90d8 --- /dev/null +++ b/.github/workflows/build-cli-matrix.yml @@ -0,0 +1,54 @@ +name: Build CLI (Multi-platform) + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + build-cli: + name: Build CLI (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: [ubuntu-22.04, macos-12, windows-2022] + defaults: + run: + working-directory: cli + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Cache Cargo dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + cli/target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Build CLI + run: | + cargo build --release + + - name: Run CLI tests + run: | + cargo test + + - name: Upload artifact + if: matrix.os == 'ubuntu-22.04' + uses: actions/upload-artifact@v3 + with: + name: void-cli-${{ matrix.os }} + path: cli/target/release/void diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml new file mode 100644 index 00000000..2410e5e7 --- /dev/null +++ b/.github/workflows/build-cli.yml @@ -0,0 +1,44 @@ +name: Build CLI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + build-cli: + name: Build CLI + runs-on: ubuntu-22.04 + timeout-minutes: 60 + defaults: + run: + working-directory: cli + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Cache Cargo dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + cli/target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Build CLI + run: | + cargo build --release + + - name: Run CLI tests + run: | + cargo test diff --git a/.github/workflows/build-extensions.yml b/.github/workflows/build-extensions.yml new file mode 100644 index 00000000..a11bb8c1 --- /dev/null +++ b/.github/workflows/build-extensions.yml @@ -0,0 +1,34 @@ +name: Build Extensions + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + build-extensions: + name: Build Extensions + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Build extensions + run: | + npm run compile-extensions-build diff --git a/.github/workflows/build-web.yml b/.github/workflows/build-web.yml new file mode 100644 index 00000000..316f5404 --- /dev/null +++ b/.github/workflows/build-web.yml @@ -0,0 +1,34 @@ +name: Build Web + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + build-web: + name: Build Web + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Build web version + run: | + npm run compile-web diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..fcb357b0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,157 @@ +name: Build Void + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + compile: + name: Compile + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Install build tools + run: | + sudo apt update -y + sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev + + - name: Compile + run: | + npm run compile + + - name: Check clean git state + run: | + .github/workflows/check-clean-git-state.sh + + test-unit: + name: Unit Tests (Linux) + needs: compile + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Install build tools + run: | + sudo apt update -y + sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev + + - name: Run unit tests + run: | + npm run test-node + + test-browser: + name: Browser Tests + needs: compile + runs-on: ubuntu-22.04 + timeout-minutes: 60 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + + - name: Install Playwright browsers + run: | + npm run playwright-install + + - name: Run browser tests + run: | + npm run test-browser + + lint: + name: Linting + runs-on: ubuntu-22.04 + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Run ESLint + run: | + npm run eslint + + - name: Run Stylelint + run: | + npm run stylelint + + hygiene: + name: Hygiene Checks + runs-on: ubuntu-22.04 + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Run hygiene checks + run: | + npm run hygiene diff --git a/.github/workflows/check-clean-git-state.sh b/.github/workflows/check-clean-git-state.sh new file mode 100755 index 00000000..52cb83b6 --- /dev/null +++ b/.github/workflows/check-clean-git-state.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Check if git status is clean (no uncommitted changes) +if ! git diff --quiet --ignore-submodules HEAD; then + echo "Error: Uncommitted changes detected in the repository" + git status + exit 1 +fi + +if ! git diff --quiet --cached --ignore-submodules HEAD; then + echo "Error: Uncommitted staged changes detected in the repository" + git status + exit 1 +fi + +echo "Git status is clean" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..0db181bf --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,44 @@ +name: CodeQL Analysis + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '0 0 * * 1' # Every Monday at midnight UTC + +jobs: + analyze: + name: CodeQL Analysis + runs-on: ubuntu-22.04 + timeout-minutes: 360 + permissions: + actions: read + contents: read + security-events: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: javascript-typescript + queries: +security-and-quality + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/publish-artifacts.yml b/.github/workflows/publish-artifacts.yml new file mode 100644 index 00000000..eb75159a --- /dev/null +++ b/.github/workflows/publish-artifacts.yml @@ -0,0 +1,74 @@ +name: Publish Build Artifacts + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 1' # Every Monday at midnight UTC + +jobs: + publish-artifacts: + name: Publish Build Artifacts + runs-on: ubuntu-22.04 + timeout-minutes: 120 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: | + npm ci + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Install build tools + run: | + sudo apt update -y + sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev + + - name: Compile + run: | + npm run compile + + - name: Build extensions + run: | + npm run compile-extensions-build + + - name: Build web version + run: | + npm run compile-web + + - name: Build CLI + working-directory: cli + run: | + cargo build --release + + - name: Package artifacts + run: | + # Create a directory for artifacts + mkdir -p artifacts + + # Copy main build artifacts + cp -r out/ artifacts/out/ + + # Copy CLI binary + cp cli/target/release/void artifacts/void-cli-linux + + # Copy web build + cp -r out-vscode/ artifacts/out-vscode/ + + # Create a zip file + zip -r void-artifacts.zip artifacts/ + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: void-build-artifacts + path: void-artifacts.zip + retention-days: 30