Skip to content

Commit

Permalink
inital project from vscode-extension-template
Browse files Browse the repository at this point in the history
  • Loading branch information
timothypratley committed Dec 22, 2024
0 parents commit 6be56bf
Show file tree
Hide file tree
Showing 56 changed files with 8,187 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cljfmt.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{:remove-surrounding-whitespace? true
:remove-trailing-whitespace? true
:remove-consecutive-blank-lines? false
:insert-missing-whitespace? true
:remove-multiple-non-indenting-spaces? false}
193 changes: 193 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: Build and test
on:
push:
branches:
- '**'
pull_request:
branches:
- 'master'
workflow_call:

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Checkout
uses: actions/checkout@v4

- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
cli: latest
bb: latest

- name: Cache clojure/java dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: ${{ runner.os }}-clojure-${{ hashFiles('**/*.edn') }}
restore-keys: |
${{ runner.os }}-clojure-
- name: Install node dependencies
run: npm install

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build Pre-release VSIX
if: startsWith(github.ref, 'refs/heads/')
run: bb package-pre-release ${GITHUB_REF#refs/heads/}

- name: Build Release VSIX
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
set -x
npm run package
- name: Get VSIX File Name
id: get-vsix-name
shell: bash
run: echo "VSIX_NAME=$(ls *.vsix)" >> $GITHUB_ENV

- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ env.VSIX_NAME }}
path: ${{ env.VSIX_NAME }}

- name: Upload Test Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-extension-tests
path: out/extension-tests.js

test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Download Test Artifact
uses: actions/download-artifact@v4
with:
name: ${{ runner.os }}-extension-tests
pattern: out/extension-tests.js
merge-multiple: true
path: out/

- name: Run Tests
run: node out/extension-tests.js

e2e-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download VSIX Artifact
uses: actions/download-artifact@v4
with:
path: .
pattern: '${{ runner.os }}-*.vsix'
merge-multiple: true

- name: Get VSIX File Name
id: get-vsix-name
shell: bash
run: echo "VSIX_NAME=$(ls *.vsix)" >> $GITHUB_ENV

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install node dependencies
run: npm install

- name: Setup Babashka
uses: DeLaGuardo/setup-clojure@12.5
with:
bb: latest

- name: Run E2E Tests Unix
if: runner.os != 'Windows'
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: bb run-e2e-tests-vsix ${{ env.VSIX_NAME }}

- name: Run E2E Tests Windows
if: runner.os == 'Windows'
shell: bash
run: bb run-e2e-tests-vsix ${{ env.VSIX_NAME }}

lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
clj-kondo: latest

- name: Linting that sparks joy
run: |
clj-kondo --version
clj-kondo --lint src test --fail-level warning
check-format:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
cljfmt: latest

- name: Check formatting
run: |
cljfmt --version
cljfmt check
149 changes: 149 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Release VSIX

on:
push:
tags:
- 'v*'

jobs:
test:
uses: ./.github/workflows/build-and-test.yml

github-release:
needs:
- test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download VSIX Artifact
uses: actions/download-artifact@v4
with:
path: /tmp
pattern: '*.vsix'
merge-multiple: true

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@12.5
with:
cli: latest
bb: latest

- name: Cache clojure/java dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
key: ${{ runner.os }}-clojure-${{ hashFiles('**/*.edn') }}
restore-keys: |
${{ runner.os }}-clojure-
- name: Write release notes
run: |
bb ci:release-notes ${{ github.ref_name }} > /tmp/release-notes.md
- name: Github Release
uses: ncipollo/release-action@v1
with:
bodyFile: /tmp/release-notes.md
artifacts: "/tmp/*.vsix"

publish-to-marketplace:
runs-on: ubuntu-latest
needs: github-release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install node dependencies
run: npm install

- name: Download VSIX Artifact
uses: actions/download-artifact@v4
with:
path: /tmp
pattern: '*.vsix'
merge-multiple: true

- name: Publish to VS Code Marketplace
run: | # TODO: Actually publish to the marketplace. For now, only verify that the personal access token will work
npx vsce verify-pat --pat ${{ secrets.MARKETPLACE_PAT }}
echo npx vsce publish --packagePath /tmp/*.vsix --pat ${{ secrets.MARKETPLACE_PAT }} --githubBranch master
publish-to-open-vsx:
runs-on: ubuntu-latest
needs: github-release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install node dependencies
run: npm install

- name: Download VSIX Artifact
uses: actions/download-artifact@v4
with:
path: /tmp
pattern: '*.vsix'
merge-multiple: true

- name: Publish to Open VSX
run: | # TODO: Actually publish to open-vsx. For now, only verify that the personal access token will work
npx ovsx verify-pat --pat ${{ secrets.OPEN_VSX_PAT }}
echo npx ovsx publish /tmp/*.vsix --pat ${{ secrets.OPEN_VSX_PAT }}
bump-version:
runs-on: ubuntu-latest
needs: publish-to-marketplace
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Source Branch
id: source-branch
run: echo "BUMP_BRANCH=$(git name-rev --name-only --exclude=tags/* HEAD)" >> $GITHUB_ENV

- name: Setup Babashka
uses: DeLaGuardo/setup-clojure@12.5
with:
bb: latest

- name: Bump Version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bb ci:bump-version-and-push ${{ env.BUMP_BRANCH}} "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" "${{ github.actor }}" --force
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# vs code
*.vsix

# Dependency directories
node_modules

# macos
.DS_Store

# Clojure
.cpcache/
.nrepl-port

# CLJS
.shadow-cljs/

# Calva
.cache
**/.calva/output-window/output.calva-repl

# Extension
/out/

# Portal
**/.portal/vs-code.edn

# vscode test-electron
.vscode-test/

# ignored folder

/ignore/
Loading

0 comments on commit 6be56bf

Please sign in to comment.