Debian Codegraph @

.github/workflows/main.yml

raw symbols SCIP
1 on: [push, pull_request]
2 name: Test
3
4 permissions:
5 id-token: write # Required for OIDC
6 contents: read
7
8 jobs:
9 test:
10 strategy:
11 matrix:
12 go-version: [1.20.x, 1.x]
13 os: [ubuntu-latest, windows-latest]
14 arch: ["", "386"]
15 fail-fast: false
16 runs-on: ${{ matrix.os }}
17 steps:
18 - name: Install Go
19 uses: actions/setup-go@v5
20 with:
21 go-version: ${{ matrix.go-version }}
22 - name: Checkout code
23 uses: actions/checkout@v3
24 - name: Check formatting
25 run: diff -u <(echo -n) <(gofmt -d .)
26 if: runner.os != 'Windows'
27 - name: Run go vet
28 env:
29 GOARCH: ${{ matrix.arch }}
30 run: go vet ./...
31 - name: Run staticcheck
32 uses: dominikh/[email protected]
33 with:
34 version: "2025.1.1"
35 install-go: false
36 cache-key: ${{ matrix.go-version }}
37 if: ${{ matrix.go-version == '1.x' }}
38 - name: Run tests
39 env:
40 GOARCH: ${{ matrix.arch }}
41 run: go test -vet=off ./...
42
43 test-types:
44 runs-on: ubuntu-latest
45 steps:
46 - uses: actions/checkout@v4
47 - run: |
48 npm ci
49 npm test --workspaces
50
51 publish-types-tagged:
52 name: 'Publish type definitions to npm (tagged)'
53 needs: [test, test-types]
54 runs-on: ubuntu-latest
55 if: startsWith(github.ref, 'refs/tags/v')
56 steps:
57 - uses: actions/checkout@v4
58 - name: Extract version
59 run: |
60 VERSION=$(echo "${{ github.ref }}" | sed 's|refs/tags/v||')
61 if [[ "$VERSION" == [0-9].* ]]; then
62 echo "version=$VERSION" >> $GITHUB_ENV
63 fi
64 - uses: './.github/actions/publish-types'
65 if: env.version != ''
66 with:
67 VERSION: ${{ env.version }}
68
69 publish-types-untagged:
70 name: 'Publish type definitions to npm (untagged master)'
71 needs: [ test, test-types ]
72 runs-on: ubuntu-latest
73 if: "!startsWith(github.ref, 'refs/tags/v') && github.ref_name == 'master'"
74 steps:
75 - uses: actions/checkout@v4
76 - name: Extract version
77 run: |
78 VERSION=0.0.0-$(git log -1 --format=%cd --date=format:%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)
79 echo "version=$VERSION" >> $GITHUB_ENV
80 - uses: './.github/actions/publish-types'
81 with:
82 VERSION: ${{ env.version }}