|
| 1 | +# Build and Verify Workflow Usage |
| 2 | + |
| 3 | +This document explains how to use the `build-and-verify.yml` reusable workflow for cross-platform |
| 4 | +TypeScript VS Code extension builds with comprehensive CI/CD features. |
| 5 | + |
| 6 | +## Required Platform Matrix File |
| 7 | + |
| 8 | +The workflow **requires** a platform matrix file to be provided. There is no default matrix, ensuring |
| 9 | +that each caller explicitly defines their target platforms. This approach provides better control |
| 10 | +and prevents unexpected platform builds. |
| 11 | + |
| 12 | +### Platform Matrix File Format |
| 13 | + |
| 14 | +Create a JSON file in your repository with the following format: |
| 15 | + |
| 16 | +```json |
| 17 | +[ |
| 18 | + { |
| 19 | + "platform": "windows-2022", |
| 20 | + "arch": "amd64" |
| 21 | + }, |
| 22 | + { |
| 23 | + "platform": "ubuntu-24.04", |
| 24 | + "arch": "amd64" |
| 25 | + }, |
| 26 | + { |
| 27 | + "platform": "macos-14", |
| 28 | + "arch": "arm64" |
| 29 | + } |
| 30 | +] |
| 31 | +``` |
| 32 | + |
| 33 | +## Usage Examples |
| 34 | + |
| 35 | +### Basic Usage |
| 36 | + |
| 37 | +```yaml |
| 38 | +jobs: |
| 39 | + build-and-test: |
| 40 | + uses: Open-CMSIS-Pack/vscode-extension-workflows/.github/workflows/build-and-verify.yml@main |
| 41 | + with: |
| 42 | + platform-matrix-file: '.github/platform-matrix.json' |
| 43 | +``` |
| 44 | +
|
| 45 | +### Advanced Usage |
| 46 | +
|
| 47 | +```yaml |
| 48 | +name: Advanced CI/CD Pipeline |
| 49 | + |
| 50 | +on: |
| 51 | + push: |
| 52 | + branches: [ main, develop ] |
| 53 | + pull_request: |
| 54 | + branches: [ main ] |
| 55 | + |
| 56 | +jobs: |
| 57 | + build-and-test: |
| 58 | + permissions: |
| 59 | + contents: write # Required for release version bumps |
| 60 | + uses: Open-CMSIS-Pack/vscode-extension-workflows/.github/workflows/build-and-verify.yml@main |
| 61 | + with: |
| 62 | + platform-matrix-file: 'config/platforms.json' |
| 63 | + package-manager: 'yarn' |
| 64 | + working-directory: './app' |
| 65 | + build-command: 'build:prod' |
| 66 | + test-command: 'test:ci' |
| 67 | + lint-command: 'lint:check' |
| 68 | + enable-qlty: true |
| 69 | + secrets: |
| 70 | + QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }} |
| 71 | + PR_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | +``` |
| 73 | +
|
| 74 | +### Platform-Specific Configurations |
| 75 | +
|
| 76 | +#### Minimal (Single Platform) |
| 77 | +
|
| 78 | +```json |
| 79 | +[ |
| 80 | + { |
| 81 | + "platform": "ubuntu-24.04", |
| 82 | + "arch": "amd64" |
| 83 | + } |
| 84 | +] |
| 85 | +``` |
| 86 | + |
| 87 | +#### Cross-Platform (Current Default) |
| 88 | + |
| 89 | +This is the current configuration used by this repository: |
| 90 | + |
| 91 | +```json |
| 92 | +[ |
| 93 | + { |
| 94 | + "platform": "windows-2022", |
| 95 | + "arch": "amd64" |
| 96 | + }, |
| 97 | + { |
| 98 | + "platform": "ubuntu-24.04", |
| 99 | + "arch": "amd64" |
| 100 | + }, |
| 101 | + { |
| 102 | + "platform": "macos-14", |
| 103 | + "arch": "arm64" |
| 104 | + } |
| 105 | +] |
| 106 | +``` |
| 107 | + |
| 108 | +#### Comprehensive (All Platforms & Architectures) |
| 109 | + |
| 110 | +```json |
| 111 | +[ |
| 112 | + { |
| 113 | + "platform": "ubuntu-22.04", |
| 114 | + "arch": "amd64" |
| 115 | + }, |
| 116 | + { |
| 117 | + "platform": "ubuntu-24.04", |
| 118 | + "arch": "amd64" |
| 119 | + }, |
| 120 | + { |
| 121 | + "platform": "ubuntu-24.04", |
| 122 | + "arch": "arm64" |
| 123 | + }, |
| 124 | + { |
| 125 | + "platform": "windows-2022", |
| 126 | + "arch": "amd64" |
| 127 | + }, |
| 128 | + { |
| 129 | + "platform": "windows-2022", |
| 130 | + "arch": "arm64" |
| 131 | + }, |
| 132 | + { |
| 133 | + "platform": "macos-13", |
| 134 | + "arch": "amd64" |
| 135 | + }, |
| 136 | + { |
| 137 | + "platform": "macos-14", |
| 138 | + "arch": "arm64" |
| 139 | + }, |
| 140 | + { |
| 141 | + "platform": "macos-15", |
| 142 | + "arch": "arm64" |
| 143 | + } |
| 144 | +] |
| 145 | +``` |
| 146 | + |
| 147 | +## Required Inputs |
| 148 | + |
| 149 | +| Input | Required | Description | |
| 150 | +|-------|----------|-------------| |
| 151 | +| `platform-matrix-file` | ✅ | Path to JSON file containing platform matrix | |
| 152 | + |
| 153 | +## Optional Inputs |
| 154 | + |
| 155 | +| Input | Default | Description | |
| 156 | +|-------|---------|-------------| |
| 157 | +| `node-version-file` | `./package.json` | Path to package.json file for Node.js version detection | |
| 158 | +| `package-manager` | `npm` | Package manager to use (npm or yarn) with auto-detection | |
| 159 | +| `working-directory` | `.` | Working directory for the build | |
| 160 | +| `build-command` | `build` | npm/yarn script name for building | |
| 161 | +| `test-command` | `test` | npm/yarn script name for testing | |
| 162 | +| `lint-command` | `lint` | npm/yarn script name for linting | |
| 163 | +| `enable-qlty` | `false` | Enable Qlty coverage upload (requires QLTY_COVERAGE_TOKEN) | |
| 164 | + |
| 165 | +## Secrets |
| 166 | + |
| 167 | +| Secret | Required | Description | |
| 168 | +|--------|----------|-------------| |
| 169 | +| `QLTY_COVERAGE_TOKEN` | Optional | Required only if `enable-qlty: true` | |
| 170 | +| `PR_TOKEN` | Optional | Required only for release workflows to create version bump PRs | |
0 commit comments