Skip to content

Commit

Permalink
Chores
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
  • Loading branch information
smorimoto committed Dec 9, 2024
1 parent b492367 commit c7f13d6
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 52 deletions.
85 changes: 54 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Builds, tests & co

on:
- push
- pull_request
push:
pull_request:
release:
types:
- published

permissions: read-all

Expand All @@ -25,7 +28,7 @@ jobs:
- name: Set-up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
node-version: 23
check-latest: true

- run: corepack enable
Expand All @@ -38,14 +41,11 @@ jobs:
- name: Run Biome checks
run: yarn lint

- name: Build extension
run: opam exec -- make build-release

- name: Package extension
run: yarn package
- name: Build and Package extension
run: opam exec -- make pkg

- name: Generate artifact attestation
if: startsWith(github.ref, 'refs/tags')
if: github.event_name == 'release'
uses: actions/attest-build-provenance@v2
with:
subject-path: ocaml-platform.vsix
Expand All @@ -59,28 +59,6 @@ jobs:
- name: Test extension
run: xvfb-run -a yarn test

- name: Publish extension to VSCode Marketplace
if: startsWith(github.ref, 'refs/tags')
continue-on-error: true
run: yarn deploy:vsce
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}

- name: Publish extension to Open VSX Registry
if: startsWith(github.ref, 'refs/tags')
continue-on-error: true
run: yarn deploy:ovsx --pat "$OVSX_PAT"
env:
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}

- name: Create release
if: startsWith(github.ref, 'refs/tags')
continue-on-error: true
uses: softprops/action-gh-release@v2
with:
draft: true
files: ocaml-platform.vsix

lint-opam:
runs-on: ubuntu-latest
steps:
Expand All @@ -102,3 +80,48 @@ jobs:
with:
ocaml-compiler: 5
- uses: ocaml/setup-ocaml/lint-fmt@v3

release:
if: github.event_name == 'release'
needs:
- build-and-test
- lint-opam
- lint-fmt
runs-on: ubuntu-latest
steps:
- name: Checkout tree
uses: actions/checkout@v4

- name: Set-up Node.js
uses: actions/setup-node@v4
with:
node-version: 23
check-latest: true

- run: corepack enable

- name: Install dependencies
run: yarn install --immutable

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ocaml-platform-${{ github.sha }}

- name: Publish extension to VSCode Marketplace
continue-on-error: true
run: yarn deploy:vsce
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}

- name: Publish extension to Open VSX Registry
continue-on-error: true
run: yarn deploy:ovsx --pat "$OVSX_PAT"
env:
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}

- name: Create release
continue-on-error: true
uses: softprops/action-gh-release@v2
with:
files: ocaml-platform.vsix
27 changes: 6 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,18 @@ create_switch:
switch: create_switch deps ## Create an opam switch and install development dependencies

.PHONY: build
build: ## Build the project
dune build src/vscode_ocaml_platform.bc.js
yarn workspace astexplorer build
yarn esbuild _build/default/src/vscode_ocaml_platform.bc.js \
--bundle \
--packages=bundle \
--external:vscode \
--outdir=dist \
--platform=node \
--target=es2022 \
--sourcemap

.PHONY: build-release
build-release:
build: clean ## Build the project
dune build src/vscode_ocaml_platform.bc.js --profile=release
yarn workspace astexplorer build
yarn esbuild _build/default/src/vscode_ocaml_platform.bc.js \
--bundle \
--packages=bundle \
--external:vscode \
--minify \
--outdir=dist \
--packages=bundle \
--platform=node \
--target=es2022 \
--minify-whitespace \
--minify-syntax \
--sourcemap \
--sources-content=false
--analyze

.PHONY: test
test: ## Run the unit tests
Expand All @@ -57,7 +42,7 @@ test: ## Run the unit tests
.PHONY: clean
clean: ## Clean build artifacts and other generated files
dune clean
rm -r dist/
$(RM) -r dist

.PHONY: doc
doc: ## Generate odoc documentation
Expand All @@ -73,7 +58,7 @@ watch: ## Watch for the filesystem and rebuild on every change
dune build @all -w --terminal-persistence=clear-on-rebuild

.PHONY: pkg
pkg: build-release # Builds and packages the extension for installment
pkg: build # Builds and packages the extension for installment
yarn package

.PHONY: install
Expand Down

0 comments on commit c7f13d6

Please sign in to comment.