Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Remove deploy and add Windows test to GH actions #1401

Merged
merged 2 commits into from
Jan 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 50 additions & 90 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: CI-Tests
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

name: CI

on:
push:
branches:
Expand All @@ -11,110 +15,66 @@ on:
- master
- dev


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

steps:
- name: checkout
uses: actions/checkout@v2
- name: get node
uses: actions/setup-node@v1
with:
node-version: 11.x
- name: linux setup
- name: Windows setup
if: ${{ matrix.os == 'windows-latest' }}
run: |
curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worthwhile to do a hash check on the download as well (like we're doing in the ADO pipeline)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can add it. If we're going to do it on all 3 platforms, it's probably best to extract the inline node script to a separate file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added for Linux and Windows. I'm leaving Mac alone for now because it installs through Homebrew. We could likely switch it to something closer to the Linux install, but I'll leave that for a future PR.

- 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.2-linux64.tar.xz -P /home/$USER
tar -xvf /home/$USER/arduino-1.8.2-linux64.tar.xz -C /home/$USER/
sudo ln -s /home/$USER/arduino-1.8.2/arduino /usr/bin/arduino
wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz -P /home/$USER
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 g++-multilib
sudo apt-get install -y build-essential
sudo apt-get install libudev-dev
- name: macos setup
sudo apt-get install -y g++-multilib build-essential libudev-dev
- name: macOS setup
if: ${{ matrix.os == 'macos-latest' }}
run: |
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install arduino --cask
- name: preinstall
run: |
npm install -g node-gyp
npm install -g vsce@"^1.0.0"
npm install -g gulp
- name: install
run: npm install
- name: scripts
run: |
gulp tslint
vsce package
- name: run tests

- name: Checkout
uses: actions/checkout@v2

# Node 14 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.
- name: Use Node 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
# 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
run: vsce package --out vscode-arduino.vsix
- name: Publish extension VSIX as artifact
uses: actions/upload-artifact@v2
with:
name: VS Code extension VSIX (${{ matrix.os }})
path: vscode-arduino.vsix

- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: npm test --silent

deploy:
needs: build
runs-on: ubuntu-latest
environment: vsix-publishing
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: echo ${{env.VERSION}}
- name: Checkout
uses: actions/checkout@v2
- name: get node
uses: actions/setup-node@v1
with:
node-version: 11.x
- name: linux setup
run: |
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0
sleep 3
sudo apt-get update
sudo apt-get install g++-multilib
sudo apt-get install -y build-essential
sudo apt-get install libudev-dev
- name: preinstall
run: |
npm install -g node-gyp
npm install -g vsce@"^1.0.0"
npm install -g gulp
- name: install
run: npm install
- name: scripts
run: |
gulp tslint
gulp genAikey
vsce package
- name: upload .vsix to github tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.OAUTH_TOKEN }}
file: ${{github.workspace}}/vscode-arduino*.vsix
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: check for production tag
id: check-version
run: |
if [[ ${{ env.VERSION }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo ::set-output name=ISPRODUCTION::true
fi
# Skip attempting to publish for now, because I can't figure out how to
# generate a valid VSCE_TOKEN. Instead we can manually publish by uploading
# the release build artifact to the extension publisher site.
- name: publish
if: false && steps.check-version.outputs.ISPRODUCTION == 'true'
env:
PROD_AIKEY: ${{ secrets.PROD_AIKEY }}
run: |
gulp genAikey
vsce publish -p ${{ secrets.VSCE_TOKEN }}