Skip to content

Commit

Permalink
ci: support multi-platform builds
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbolduc committed Mar 12, 2023
1 parent 9753487 commit cb16442
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 44 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/build.yml

This file was deleted.

93 changes: 90 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,54 @@ name: Build and Publish

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: windows-latest
platform: win32
arch: x64
npm_config_arch: x64
- os: windows-latest
platform: win32
arch: ia32
npm_config_arch: ia32
- os: windows-latest
platform: win32
arch: arm64
npm_config_arch: arm
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
npm_config_arch: arm64
- os: ubuntu-latest
platform: linux
arch: armhf
npm_config_arch: arm
- os: ubuntu-latest
platform: alpine
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: arm64
npm_config_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -22,21 +64,66 @@ jobs:
test/project/v7/package-lock.json
- name: Install Node dependencies
run: npm ci
- name: Set target variable
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $GITHUB_ENV
- name: Package VSIX
run: npm run package
run: npm run package -- --target ${{ env.target }}
- name: Archive VSIX
uses: actions/upload-artifact@v3
with:
name: vsix
name: ${{ env.target }}
path: '*.vsix'

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Node.js
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: |
package-lock.json
test/project/v6/package-lock.json
test/project/v7/package-lock.json
- name: Install Node dependencies
id: install
run: npm ci
- name: Test
if: (success() || failure()) && steps.install.conclusion == 'success'
run: npm run test -- --coverage
- name: Typecheck
if: (success() || failure()) && steps.install.conclusion == 'success'
run: npm run typecheck
- name: Lint
if: (success() || failure()) && steps.install.conclusion == 'success'
run: npm run lint
- name: Format
if: (success() || failure()) && steps.install.conclusion == 'success'
run: npm run format

publish:
runs-on: ubuntu-latest
needs: [build, test]
if: success() && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Node.js
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: |
package-lock.json
test/project/v6/package-lock.json
test/project/v7/package-lock.json
- name: Install Node dependencies
id: install
run: npm ci
- uses: actions/[email protected]
- name: Publish to marketplace
run: npm run deploy
env:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
"watch:webview": "npm run -s build:webview -- --watch",
"build:production": "npm run -s build:webview:base -- --minify && npm run -s build:extension:base -- --minify",
"package": "npm run -s build:production && vsce package --githubBranch main",
"deploy": "vsce publish --packagePath story-explorer-*.vsix",
"deploy": "vsce publish --packagePath *.vsix",
"format": "prettier --check '{.vscode,src}/**/*.{json,ts}' '*.{json,md}'",
"format:fix": "npm run -s format -- --write",
"generate-settings-markdown": "node -r ts-eager/register ./scripts/generateSettingsReadmeMarkdown.ts",
Expand Down

0 comments on commit cb16442

Please sign in to comment.