Repository navigation
71 lines (70 loc) · 2.9 KB
/
Copy pathci.generated.yml
File metadata and controls
71 lines (70 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# GENERATED BY ./ci.ts -- DO NOT DIRECTLY EDIT
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
jobs:
build:
name: build
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 30
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
- uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2
with:
deno-version: v2.x
- name: Check formatting
run: zig fmt --check build.zig build.zig.zon main.zig src tests/spec_test.zig
- name: Test
run: zig build test --summary all
- name: Build
run: zig build
- name: Generate config schema
run: 'deno run -A --minimum-dependency-age=0 jsr:@dprint/automation@0.14.3/tasks/publish-schema zig-out/plugin.wasm deployment/schema.json --extension zig'
- name: Lint workflow generation
run: |-
./.github/workflows/ci.ts --lint
./.github/workflows/publish_npm.ts --lint
./.github/workflows/release.ts --lint
./.github/workflows/check_updates.ts --lint
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: 24.x
- name: Check the plugin has no imports
run: 'node -e "const m = new WebAssembly.Module(require(''fs'').readFileSync(''zig-out/plugin.wasm'')); const imports = WebAssembly.Module.imports(m); if (imports.length > 0) { console.error(imports); process.exit(1); }"'
- name: Setup and test npm deployment
run: |-
cd deployment/npm
npm install
node setup.js
npm run test
- name: Get tag version
id: get_tag_version
if: 'startsWith(github.ref, ''refs/tags/'')'
run: 'echo "TAG_VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"'
- name: Pre-release
if: 'startsWith(github.ref, ''refs/tags/'')'
run: |-
test "$(cat VERSION)" = "${{ steps.get_tag_version.outputs.TAG_VERSION }}" || (echo "The VERSION file doesn't match the tag" && exit 1)
# update config schema to have version
sed -i 's/dprint-plugin-zig\/0.0.0/dprint-plugin-zig\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json
# create release notes
deno run -A ./scripts/generateReleaseNotes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} > ${{ github.workspace }}-CHANGELOG.txt
- name: Release
if: 'startsWith(github.ref, ''refs/tags/'')'
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |-
gh release create "$GITHUB_REF_NAME" --verify-tag --title "$GITHUB_REF_NAME" \
--notes-file ${{ github.workspace }}-CHANGELOG.txt \
zig-out/plugin.wasm \
deployment/schema.json