Skip to content
107 changes: 107 additions & 0 deletions .github/workflows/build-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

name: Build CI Template

on:
workflow_call:
inputs:
BUILD_FLAGS:
description: 'additional build flags to pass to build'
default: ''
required: false
type: string
os:
description: os to use in the run
type: string
default: '["ubuntu-latest", "macos-latest", "windows-latest"]'
required: false

jobs:
build:
env:
BUILD_FLAGS: ${{ inputs.BUILD_FLAGS }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(inputs.os) }}


steps:
- name: Checkout
uses: actions/checkout@v2

# Node 16 matches the version of Node used by VS Code when this was
# written, but it should be updated when VS Code updates its Node version.
# Node needs to be installed before OS-specific setup so that we can run
# the hash verification script.
- name: Use Node 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x

# On new macos-latest machines, Python 3.9+ is used, and it's causing issues with binding.gyp
- name: Use Python 3.8
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Windows setup
if: ${{ matrix.os == 'windows-latest' }}
run: |
curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
node build/checkHash.js arduino-1.8.19-windows.zip `
c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
7z x arduino-1.8.19-windows.zip -o"$Env:TEMP\arduino-ide"
echo "$Env:TEMP\arduino-ide\arduino-1.8.19" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Linux setup
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0
sleep 3
wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -P /home/$USER
node build/checkHash.js /home/$USER/arduino-1.8.19-linux64.tar.xz \
eb68bddc1d1c0120be2fca1350a03ee34531cf37f51847b21210b6e70545bc9b
tar -xvf /home/$USER/arduino-1.8.19-linux64.tar.xz -C /home/$USER/
sudo ln -s /home/$USER/arduino-1.8.19/arduino /usr/bin/arduino
sudo apt-get update
sudo apt-get install -y g++-multilib build-essential libudev-dev
- name: macOS setup
if: ${{ matrix.os == 'macos-latest' }}
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install arduino --cask

# Windows agents already have gulp installed.
- name: Install gulp
if: ${{ matrix.os != 'windows-latest' }}
run: npm install --global gulp
- name: Install global dependencies
run: npm install --global node-gyp vsce
- name: Install project dependencies
run: npm install

- name: Check for linting errors
run: gulp tslint
- name: Build and pack extension
if: ${{ matrix.os != 'windows-latest' }}
run: |
export NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js ${{ env.BUILD_FLAGS }}
- name: Build and pack extension (windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
$env:NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js ${{ env.BUILD_FLAGS }}
- name: Publish extension VSIX as artifact
uses: actions/upload-artifact@v4
with:
name: VS Code extension VSIXes (${{ matrix.os }})
path: out/vsix

- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: npm test --silent
91 changes: 3 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

name: CI

name: Build CI
on:
push:
branches:
Expand All @@ -15,86 +11,5 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
- name: Checkout
uses: actions/checkout@v2

# Node 16 matches the version of Node used by VS Code when this was
# written, but it should be updated when VS Code updates its Node version.
# Node needs to be installed before OS-specific setup so that we can run
# the hash verification script.
- name: Use Node 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x

# On new macos-latest machines, Python 3.9+ is used, and it's causing issues with binding.gyp
- name: Use Python 3.8
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Windows setup
if: ${{ matrix.os == 'windows-latest' }}
run: |
curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
node build/checkHash.js arduino-1.8.19-windows.zip `
c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945
7z x arduino-1.8.19-windows.zip -o"$Env:TEMP\arduino-ide"
echo "$Env:TEMP\arduino-ide\arduino-1.8.19" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Linux setup
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0
sleep 3
wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -P /home/$USER
node build/checkHash.js /home/$USER/arduino-1.8.19-linux64.tar.xz \
eb68bddc1d1c0120be2fca1350a03ee34531cf37f51847b21210b6e70545bc9b
tar -xvf /home/$USER/arduino-1.8.19-linux64.tar.xz -C /home/$USER/
sudo ln -s /home/$USER/arduino-1.8.19/arduino /usr/bin/arduino
sudo apt-get update
sudo apt-get install -y g++-multilib build-essential libudev-dev
- name: macOS setup
if: ${{ matrix.os == 'macos-latest' }}
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install arduino --cask

# Windows agents already have gulp installed.
- name: Install gulp
if: ${{ matrix.os != 'windows-latest' }}
run: npm install --global gulp
- name: Install global dependencies
run: npm install --global node-gyp vsce
- name: Install project dependencies
run: npm install

- name: Check for linting errors
run: gulp tslint
- name: Build and pack extension
if: ${{ matrix.os != 'windows-latest' }}
run: |
export NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js
- name: Build and pack extension (windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
$env:NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js
- name: Publish extension VSIX as artifact
uses: actions/upload-artifact@v4
with:
name: VS Code extension VSIXes (${{ matrix.os }})
path: out/vsix

- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: npm test --silent
uses: ./.github/workflows/build-template.yml

50 changes: 50 additions & 0 deletions .github/workflows/deploy-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish pre-release extension to

on:
push:
branches:
- master
pull_request:
branches:
- main
workflow_dispatch:

jobs:
call-build:
uses: ./.github/workflows/build-template.yml
with:
BUILD_FLAGS: '--pre-release'
os: '["ubuntu-latest"]'

upload:
needs: call-build
runs-on: ubuntu-latest
steps:
- name: download-artifacts
uses: actions/download-artifact@v4
with:
name: VS Code extension VSIXes (ubuntu-latest)

- name: Use Node 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x

- name: install vsce
run: npm install --global vsce

- name: sainity checl
run: echo ${{ secrets.VSCE_PASSWORD }} | sha256sum

- name: vsce login
run: echo ${{ secrets.VSCE_PASSWORD }} | vsce login ${{ secrets.VSCE_USER }}

- name: publish extension
run: vsce publish --pre-release --packagePath ./out/vsix/*

- name: vsce logout
run: vsce logout




Loading