Skip to content

Commit a9519d1

Browse files
authored
GLSP-1578: Switch to github actions (#82)
- Migrate from Jenins file to github actions - Clean up root scripts - Add scripts for formating - Use eslint/prettier ignore files
1 parent 761e3e3 commit a9519d1

File tree

7 files changed

+250
-886
lines changed

7 files changed

+250
-886
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
concurrency:
4+
group: ci-${{ github.ref }}
5+
cancel-in-progress: true
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [master]
10+
pull_request:
11+
branches: [master]
12+
13+
jobs:
14+
build:
15+
name: Build
16+
timeout-minutes: 60
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
21+
with:
22+
node-version: 20.x
23+
- name: Build
24+
run: yarn install
25+
- name: Check for uncommitted changes in yarn.lock
26+
run: |
27+
if git diff --name-only | grep -q "^yarn.lock"; then
28+
echo "::error::The yarn.lock file has uncommitted changes!"
29+
exit 1
30+
fi
31+
lint:
32+
name: Lint
33+
timeout-minutes: 60
34+
runs-on: ubuntu-22.04
35+
steps:
36+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
38+
with:
39+
node-version: 20.x
40+
- name: Install
41+
run: |
42+
yarn install
43+
- name: Create eslint json report
44+
run: |
45+
yarn lint:ci
46+
- name: Create summary
47+
if: always()
48+
run: |
49+
npm_config_yes=true npx github:10up/eslint-json-to-md#82ff16b --path ./eslint_report.json --output ./eslint_report.md
50+
cat eslint_report.md >> $GITHUB_STEP_SUMMARY

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
name: 'CodeQL'
1313

1414
on:
15-
push:
16-
branches: [master]
17-
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [master]
15+
workflow_dispatch:
2016
schedule:
21-
- cron: '27 3 * * 0'
17+
- cron: '27 3 * * 0' # every Sunday at 03:27 UTC
2218

2319
jobs:
2420
analyze:
@@ -39,11 +35,11 @@ jobs:
3935

4036
steps:
4137
- name: Checkout repository
42-
uses: actions/checkout@v2
38+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4339

4440
# Initializes the CodeQL tools for scanning.
4541
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v2
42+
uses: github/codeql-action/init@16df4fbc19aea13d921737861d6c622bf3cefe23 # v2.23.0
4743
with:
4844
languages: ${{ matrix.language }}
4945
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +50,7 @@ jobs:
5450
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5551
# If this step fails, then you should remove it and run the build manually (see below)
5652
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v2
53+
uses: github/codeql-action/autobuild@16df4fbc19aea13d921737861d6c622bf3cefe23 # v2.23.0
5854

5955
# ℹ️ Command-line programs to run using the OS shell.
6056
# 📚 https://git.io/JvXDl
@@ -68,4 +64,4 @@ jobs:
6864
# make release
6965

7066
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v2
67+
uses: github/codeql-action/analyze@16df4fbc19aea13d921737861d6c622bf3cefe23 # v2.23.0
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Release type (major, minor, patch, next, or custom)'
8+
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
- next
15+
- custom
16+
custom_version:
17+
description: 'Custom version (required if release_type is custom)'
18+
required: false
19+
type: string
20+
branch:
21+
description: 'Branch to use for the release repo (default: default branch)'
22+
required: false
23+
type: string
24+
draft:
25+
description: 'Create PR as draft'
26+
required: false
27+
type: boolean
28+
default: false
29+
30+
jobs:
31+
prepare-release:
32+
uses: eclipse-glsp/glsp/.github/workflows/prepare-release.yml@master
33+
with:
34+
release_type: ${{ inputs.release_type }}
35+
custom_version: ${{ inputs.custom_version }}
36+
release_repo: glsp-vscode-integration
37+
branch: ${{ inputs.branch }}
38+
draft: ${{ inputs.draft }}

.github/workflows/publish-next.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: 'Publish next'
2+
on:
3+
workflow_run:
4+
workflows: ['CI']
5+
types:
6+
- completed
7+
branches: [master]
8+
workflow_dispatch:
9+
10+
permissions:
11+
id-token: write
12+
jobs:
13+
build:
14+
name: Build & Release
15+
runs-on: ubuntu-22.04
16+
if: github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success')
17+
env:
18+
changes: true
19+
steps:
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
21+
with:
22+
# To fetch all history for all branches and tags.
23+
# Required for lerna to determine the version of the next package.
24+
fetch-depth: 0
25+
ref: ${{ github.event.workflow_run.head_commit.id || github.sha }}
26+
- name: Check for changes in "packages" directory
27+
id: check_changes
28+
run: |
29+
if git diff --name-only HEAD^ HEAD | grep -qE '^packages'; then
30+
echo "changes=true" >> $GITHUB_ENV
31+
else
32+
echo "changes=false" >> $GITHUB_ENV
33+
fi
34+
if: github.event_name == 'workflow_run'
35+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
36+
with:
37+
node-version: 20.x
38+
registry-url: 'https://registry.npmjs.org'
39+
if: env.changes == 'true'
40+
- name: Build
41+
run: yarn
42+
if: env.changes == 'true'
43+
- name: Publish NPM
44+
run: yarn publish:next
45+
env:
46+
NPM_CONFIG_PROVENANCE: 'true'
47+
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
48+
if: env.changes == 'true'

Jenkinsfile

Lines changed: 0 additions & 144 deletions
This file was deleted.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
"bundle": " lerna run bundle",
1212
"bundle:prod": "lerna run bundle:prod",
1313
"check:headers": "glsp checkHeaders . -t lastCommit",
14-
"check:pr": "yarn all && yarn check:headers",
14+
"check:pr": "yarn all && yarn format:check && yarn check:headers",
1515
"clean": "lerna run clean && rimraf logs/*.log",
1616
"compile": "tsc -b",
17+
"format": "prettier --write .",
18+
"format:check": "prettier --check .",
1719
"generate:index": "lerna run generate:index && yarn lint:fix",
1820
"lint": "eslint --ext .ts,.tsx .",
19-
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
21+
"lint:ci": "yarn lint --output-file eslint_report.json --format json",
2022
"lint:fix": "yarn lint --fix",
2123
"prepare": "yarn build",
22-
"publish:latest": "lerna publish from-git --no-git-reset --no-git-tag-version --no-push",
2324
"publish:next": "lerna publish preminor --exact --canary --preid next --dist-tag next --no-git-reset --no-git-tag-version --no-push --ignore-scripts --yes",
24-
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
2525
"upgrade:next": "glsp updateNext",
2626
"watch": "concurrently --kill-others -n tsc,extension,web-extension -c red,yellow.green \"tsc -b -w --preserveWatchOutput\" \"yarn -s workflow watch:bundle\" \"yarn -s workflow:web watch:bundle\"",
2727
"workflow": "yarn --cwd example/workflow/extension",
@@ -33,6 +33,7 @@
3333
"@types/vscode": "^1.54.0",
3434
"concurrently": "^8.2.2",
3535
"lerna": "^7.0.0",
36+
"mocha-ctrf-json-reporter": "0.0.9",
3637
"typescript": "5.9.2"
3738
},
3839
"engines": {

0 commit comments

Comments
 (0)