Skip to content

Commit

Permalink
WIP - update CI/CD
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Dumais <[email protected]>
  • Loading branch information
marcdumais-work committed Jan 24, 2024
1 parent e5fa419 commit 56022c9
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 33 deletions.
139 changes: 111 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,94 @@
name: build
name: CI/CD

on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]

jobs:
cache-job:
runs-on: ${{ matrix.os }}
outputs:
id: yarn-cache
name: build-output
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules with yarn
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn --frozen-lockfile --ignore-scripts


jobs:

build:
runs-on: ${{ matrix.os }}
needs: cache-job

strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x]
node-version: [16]

steps:
- name: install dependencies on ubuntu
if: startsWith(matrix.os,'ubuntu')
run: |
sudo apt install -y make gcc pkg-config build-essential libx11-dev libxkbfile-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules with yarn
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile
- name: build
run: yarn --frozen-lockfile

ui-test:
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs: cache-job
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: ${{ matrix.node-version }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install dependencies
- name: Install dependencies and build
run: yarn
- name: Package VSCode Extension
run: yarn vsce:package
Expand All @@ -82,20 +114,71 @@ jobs:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: 'Tar extension'
run: tar -czvf extension.tar.gz vscode-trace-extension/*.vsix
- uses: actions/upload-artifact@v3
with:
name: extension
path: extension.tar.gz

code-lint:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs: cache-job
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16]

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: ${{ matrix.node-version }}

# ESLint and Prettier must be in `package.json`
- run: yarn --frozen-lockfile --ignore-scripts
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-scripts

- name: Run lint
run: yarn lint
- name: Run format check
run: yarn format:check

- run: yarn lint
- run: yarn format:check
publish:
runs-on: ${{ matrix.os }}
needs:
- cache-job
- build
- ui-test
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16]
name: Publish to openvsx.org
if: startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/download-artifact@v3
with:
name: extension
path: extension.tar.gz
- name: 'untar extension'
run: tar -xzvf extension.tar.gz
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Publish
run: |
# Not final version - for now use this step to check if things we expect seem to be in place
ls -alR | grep .vsix
if [[ -n "OVSX_PAT" ]]; then
echo "OVSX_PAT is defined"
else
echo "OVSX_PAT is not defined."
fi
#npx ovsx publish -i artifacts/*/*.vsix # --debug
env:
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }} # have ovsx consume the PAT from environment
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Create GitHub release based on "RELEASE" file

on:
push:
branches:
- master
paths:
- 'RELEASE'
pull_request:
types: [opened, synchronize]
branches:
- master
paths:
- 'RELEASE'

jobs:
gh-release:
name: Create GitHub release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pipe-cd/[email protected]
with:
release_file: 'RELEASE'
token: ${{ secrets.GITHUB_TOKEN }}

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"copy-webpack-plugin": "^11.0.0",
"eslint-config-prettier": "^9.0.0",
"lerna": "^7.0.0",
"ovsx": "latest",
"prettier": "^3.0.2"
},
"workspaces": [
Expand Down
39 changes: 34 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1477,9 +1477,9 @@
resolved "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.33.tgz#a56243ab5492801fff04e53c0aab0d18a6521751"
integrity sha512-VdgpnD75swH9hpXjd34VBgQ2w2quK63WljodlUcOoJDPKiV+rPjHrcUc2sjLCNKxhl6oKqmsZgwOWcDAY2GKKQ==

"@vscode/vsce@^2.21.0":
"@vscode/vsce@^2.19.0", "@vscode/vsce@^2.21.0":
version "2.22.0"
resolved "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.22.0.tgz#1eb3ebc6b89581a150bb44dd7d731a064019b617"
resolved "https://registry.yarnpkg.com/@vscode/vsce/-/vsce-2.22.0.tgz#1eb3ebc6b89581a150bb44dd7d731a064019b617"
integrity sha512-8df4uJiM3C6GZ2Sx/KilSKVxsetrTBBIUb3c0W4B1EWHcddioVs5mkyDKtMNP0khP/xBILVSzlXxhV+nm2rC9A==
dependencies:
azure-devops-node-api "^11.0.1"
Expand Down Expand Up @@ -2375,6 +2375,11 @@ chrome-trace-event@^1.0.2:
resolved "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac"
integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==

ci-info@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==

ci-info@^3.2.0, ci-info@^3.6.1:
version "3.9.0"
resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4"
Expand Down Expand Up @@ -2540,9 +2545,9 @@ commander@^2.20.0:
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==

commander@^6.2.1:
commander@^6.1.0, commander@^6.2.1:
version "6.2.1"
resolved "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==

compare-func@^2.0.0:
Expand Down Expand Up @@ -3930,6 +3935,11 @@ flatted@^3.2.9:
resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==

follow-redirects@^1.14.6:
version "1.15.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==

follow-redirects@^1.15.0:
version "1.15.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
Expand Down Expand Up @@ -4645,6 +4655,13 @@ [email protected]:
dependencies:
ci-info "^3.2.0"

is-ci@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c"
integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==
dependencies:
ci-info "^2.0.0"

is-core-module@^2.13.0, is-core-module@^2.13.1, is-core-module@^2.5.0, is-core-module@^2.8.1:
version "2.13.1"
resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384"
Expand Down Expand Up @@ -4967,7 +4984,6 @@ js-yaml@^3.10.0, js-yaml@^3.13.1, js-yaml@^3.9.1:

json-bigint@sidorares/json-bigint#2c0a5f896d7888e68e5f4ae3c7ea5cd42fd54473:
version "1.0.0"
uid "2c0a5f896d7888e68e5f4ae3c7ea5cd42fd54473"
resolved "https://codeload.github.com/sidorares/json-bigint/tar.gz/2c0a5f896d7888e68e5f4ae3c7ea5cd42fd54473"
dependencies:
bignumber.js "^9.0.0"
Expand Down Expand Up @@ -6158,6 +6174,19 @@ os-tmpdir@~1.0.2:
resolved "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==

ovsx@latest:
version "0.8.3"
resolved "https://registry.yarnpkg.com/ovsx/-/ovsx-0.8.3.tgz#3c67a595e423f3f70a3d62da3735dd07dfbca69f"
integrity sha512-LG7wTzy4eYV/KolFeO4AwWPzQSARvCONzd5oHQlNvYOlji2r/zjbdK8pyObZN84uZlk6rQBWrJrAdJfh/SX0Hg==
dependencies:
"@vscode/vsce" "^2.19.0"
commander "^6.1.0"
follow-redirects "^1.14.6"
is-ci "^2.0.0"
leven "^3.1.0"
semver "^7.5.2"
tmp "^0.2.1"

p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
Expand Down

0 comments on commit 56022c9

Please sign in to comment.