CI #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# This is to catch new releases of VS Code which could cause the extension to break | |
# Check every Sunday at 12 AM | |
schedule: | |
- cron: 0 0 * * 0 | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
vscode-version: ["1.81.0", stable] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
path: "~/.npm" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm ci | |
env: | |
npm_config_arch: x64 | |
- name: Test with VS Code ${{ matrix.vscode-version }} | |
uses: coactions/setup-xvfb@v1 | |
env: | |
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }} | |
with: | |
run: npm test | |
build: | |
permissions: | |
contents: write | |
packages: write | |
if: github.event_name == 'push' | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
path: "~/.npm" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies (without binaries) | |
run: | | |
npm ci | |
- run: npx semantic-release --extends ./package.release.config.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: "*.vsix" | |
release: | |
permissions: | |
contents: write | |
packages: write | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Cache npm dependencies | |
uses: actions/cache@v2 | |
with: | |
path: "~/.npm" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: npm ci | |
- uses: actions/download-artifact@v3 | |
- run: npx semantic-release --extends ./publish.release.config.js | |
if: github.event_name == 'push' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
OVSX_PAT: ${{ secrets.OVSX_PAT }} |