build-syncthing.yaml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
  1. name: Build Syncthing
  2. on:
  3. pull_request:
  4. push:
  5. branches-ignore:
  6. - release
  7. - release-rc*
  8. workflow_call:
  9. workflow_dispatch:
  10. env:
  11. # The go version to use for builds. We set check-latest to true when
  12. # installing, so we get the latest patch version that matches the
  13. # expression.
  14. GO_VERSION: "~1.25.0"
  15. # Optimize compatibility on the slow architectures.
  16. GOMIPS: softfloat
  17. GOARM: "6"
  18. # Avoid hilarious amounts of obscuring log output when running tests.
  19. LOGGER_DISCARD: "1"
  20. # Our build metadata
  21. BUILD_USER: builder
  22. BUILD_HOST: github.syncthing.net
  23. TAGS: "sqlite_omit_load_extension sqlite_dbstat"
  24. TAGS_LINUX: "sqlite_omit_load_extension sqlite_dbstat netgo osusergo"
  25. # A note on actions and third party code... The actions under actions/ (like
  26. # `uses: actions/checkout`) are maintained by GitHub, and we need to trust
  27. # GitHub to maintain their code and infrastructure or we're in deep shit in
  28. # general. The same doesn't necessarily apply to other actions authors, so
  29. # some care needs to be taken when adding steps, especially in the paths
  30. # that lead up to code being packaged and signed.
  31. jobs:
  32. #
  33. # Source
  34. #
  35. facts:
  36. name: Gather common facts
  37. runs-on: ubuntu-latest
  38. outputs:
  39. version: ${{ steps.get-version.outputs.version }}
  40. release-kind: ${{ steps.get-version.outputs.release-kind }}
  41. release-generation: ${{ steps.get-version.outputs.release-generation }}
  42. go-version: ${{ steps.get-go.outputs.go-version }}
  43. steps:
  44. - uses: actions/checkout@v5
  45. with:
  46. fetch-depth: 0
  47. ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
  48. - uses: actions/setup-go@v6
  49. with:
  50. go-version: ${{ env.GO_VERSION }}
  51. cache: false
  52. check-latest: true
  53. - name: Get Syncthing version
  54. id: get-version
  55. run: |
  56. version=$(go run build.go version)
  57. echo "version=$version" >> "$GITHUB_OUTPUT"
  58. echo "Version: $version"
  59. kind=stable
  60. if [[ $version == *-rc.[0-9] || $version == *-rc.[0-9][0-9] ]] ; then
  61. kind=candidate
  62. elif [[ $version == *-* ]] ; then
  63. kind=nightly
  64. fi
  65. echo "release-kind=$kind" >> "$GITHUB_OUTPUT"
  66. echo "Release kind: $kind"
  67. generation=v1
  68. if [[ $version == v2.* ]] ; then
  69. generation=v2
  70. fi
  71. echo "release-generation=$generation" >> "$GITHUB_OUTPUT"
  72. echo "Release generation: $generation"
  73. - name: Get Go version
  74. id: get-go
  75. run: |
  76. go version
  77. echo "go-version=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_OUTPUT
  78. #
  79. # Tests for all platforms. Runs a matrix build on Windows, Linux and Mac,
  80. # with the list of expected supported Go versions (current, previous).
  81. #
  82. build-test:
  83. name: Build and test
  84. strategy:
  85. fail-fast: false
  86. matrix:
  87. runner: ["windows-latest", "ubuntu-latest", "macos-latest"]
  88. # The oldest version in this list should match what we have in our go.mod.
  89. # Variables don't seem to be supported here, or we could have done something nice.
  90. go: ["~1.24.0", "~1.25.0"]
  91. runs-on: ${{ matrix.runner }}
  92. steps:
  93. - name: Set git to use LF
  94. if: matrix.runner == 'windows-latest'
  95. # Without this, the Windows checkout will happen with CRLF line
  96. # endings, which is fine for the source code but messes up tests
  97. # that depend on data on disk being as expected. Ideally, those
  98. # tests should be fixed, but not today.
  99. run: |
  100. git config --global core.autocrlf false
  101. git config --global core.eol lf
  102. - uses: actions/checkout@v5
  103. - uses: actions/setup-go@v6
  104. with:
  105. go-version: ${{ matrix.go }}
  106. cache: true
  107. check-latest: true
  108. - name: Build
  109. run: |
  110. go run build.go
  111. - name: Install go-test-json-to-loki
  112. run: |
  113. go install calmh.dev/go-test-json-to-loki@latest
  114. - name: Test
  115. run: |
  116. go version
  117. go run build.go test | go-test-json-to-loki
  118. env:
  119. GOFLAGS: "-json"
  120. LOKI_URL: ${{ secrets.LOKI_URL }}
  121. LOKI_USER: ${{ secrets.LOKI_USER }}
  122. LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
  123. LOKI_LABELS: "go=${{ matrix.go }},runner=${{ matrix.runner }},repo=${{ github.repository }},ref=${{ github.ref }}"
  124. CGO_ENABLED: "1"
  125. #
  126. # The basic checks job is a virtual one that depends on the matrix tests,
  127. # the correctness checks, and various builds that we always do. This makes
  128. # it easy to have the PR process have a single test as a gatekeeper for
  129. # merging, instead of having to add all the matrix tests and update them
  130. # each time the version changes. (The top level test is not available for
  131. # choosing there, only the matrix "children".)
  132. #
  133. basics:
  134. name: Basic checks passed
  135. runs-on: ubuntu-latest
  136. needs:
  137. - build-test
  138. - package-linux
  139. - package-illumos
  140. - package-cross
  141. - package-source
  142. - package-debian
  143. - package-windows
  144. - govulncheck
  145. - golangci
  146. - meta
  147. steps:
  148. - uses: actions/checkout@v5
  149. #
  150. # Windows
  151. #
  152. package-windows:
  153. name: Package for Windows
  154. runs-on: ubuntu-latest
  155. needs:
  156. - facts
  157. env:
  158. VERSION: ${{ needs.facts.outputs.version }}
  159. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  160. steps:
  161. - uses: actions/checkout@v5
  162. - uses: actions/setup-go@v6
  163. with:
  164. go-version: ${{ needs.facts.outputs.go-version }}
  165. cache: false
  166. - uses: mlugg/setup-zig@v2
  167. - uses: actions/cache@v4
  168. with:
  169. path: |
  170. ~/.cache/go-build
  171. ~/go/pkg/mod
  172. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-package-windows-${{ hashFiles('**/go.sum') }}
  173. - name: Install dependencies
  174. run: |
  175. go install github.com/josephspurrier/goversioninfo/cmd/[email protected]
  176. - name: Create packages
  177. run: |
  178. for tgt in syncthing stdiscosrv strelaysrv ; do
  179. go run build.go -tags "${{env.TAGS}}" -goos windows -goarch amd64 -cc "zig cc -target x86_64-windows" zip $tgt
  180. go run build.go -tags "${{env.TAGS}}" -goos windows -goarch 386 -cc "zig cc -target x86-windows" zip $tgt
  181. go run build.go -tags "${{env.TAGS}}" -goos windows -goarch arm64 -cc "zig cc -target aarch64-windows" zip $tgt
  182. # go run build.go -tags "${{env.TAGS}}" -goos windows -goarch arm -cc "zig cc -target thumb-windows" zip $tgt # fails with linker errors
  183. done
  184. env:
  185. CGO_ENABLED: "1"
  186. - name: Archive artifacts
  187. uses: actions/upload-artifact@v4
  188. with:
  189. name: unsigned-packages-windows
  190. path: "*.zip"
  191. #
  192. # Codesign binaries for Windows. This job runs only when called in the
  193. # Syncthing repo for release branches and tags, as it requires our
  194. # specific code signing keys etc.
  195. #
  196. codesign-windows:
  197. name: Codesign for Windows
  198. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
  199. environment: release
  200. runs-on: windows-latest
  201. needs:
  202. - package-windows
  203. steps:
  204. - name: Download artifacts
  205. uses: actions/download-artifact@v4
  206. with:
  207. name: unsigned-packages-windows
  208. path: packages
  209. - name: Extract packages
  210. working-directory: packages
  211. run: |
  212. $files = Get-ChildItem "." -Filter *.zip
  213. foreach ($file in $files) {
  214. 7z x $file.Name
  215. }
  216. - name: Sign files with Trusted Signing
  217. uses: azure/[email protected]
  218. with:
  219. azure-tenant-id: ${{ secrets.AZURE_TRUSTED_SIGNING_TENANT_ID }}
  220. azure-client-id: ${{ secrets.AZURE_TRUSTED_SIGNING_CLIENT_ID }}
  221. azure-client-secret: ${{ secrets.AZURE_TRUSTED_SIGNING_CLIENT_SECRET }}
  222. endpoint: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
  223. trusted-signing-account-name: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT }}
  224. certificate-profile-name: ${{ secrets.AZURE_TRUSTED_SIGNING_PROFILE }}
  225. files-folder: ${{ github.workspace }}\packages
  226. files-folder-filter: exe
  227. files-folder-recurse: true
  228. file-digest: SHA256
  229. timestamp-rfc3161: http://timestamp.acs.microsoft.com
  230. timestamp-digest: SHA256
  231. - name: Repackage packages
  232. working-directory: packages
  233. run: |
  234. $files = Get-ChildItem "." -Filter *.zip
  235. foreach ($file in $files) {
  236. Remove-Item $file.Name
  237. 7z a -tzip $file.Name $file.BaseName
  238. }
  239. - name: Archive artifacts
  240. uses: actions/upload-artifact@v4
  241. with:
  242. name: packages-windows
  243. path: "packages/*.zip"
  244. #
  245. # Linux
  246. #
  247. package-linux:
  248. name: Package for Linux
  249. runs-on: ubuntu-latest
  250. needs:
  251. - facts
  252. env:
  253. VERSION: ${{ needs.facts.outputs.version }}
  254. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  255. steps:
  256. - uses: actions/checkout@v5
  257. - uses: actions/setup-go@v6
  258. with:
  259. go-version: ${{ needs.facts.outputs.go-version }}
  260. cache: false
  261. - uses: mlugg/setup-zig@v2
  262. - uses: actions/cache@v4
  263. with:
  264. path: |
  265. ~/.cache/go-build
  266. ~/go/pkg/mod
  267. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-package-${{ hashFiles('**/go.sum') }}
  268. - name: Create packages
  269. run: |
  270. sudo apt-get install -y gcc-mips64-linux-gnuabi64 gcc-mips64el-linux-gnuabi64
  271. for tgt in syncthing stdiscosrv strelaysrv ; do
  272. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch amd64 -cc "zig cc -target x86_64-linux-musl" tar "$tgt"
  273. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch 386 -cc "zig cc -target x86-linux-musl" tar "$tgt"
  274. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch arm -cc "zig cc -target arm-linux-musleabi -mcpu=arm1136j_s" tar "$tgt"
  275. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch arm64 -cc "zig cc -target aarch64-linux-musl" tar "$tgt"
  276. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch mips -cc "zig cc -target mips-linux-musleabi" tar "$tgt"
  277. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch mipsle -cc "zig cc -target mipsel-linux-musleabi" tar "$tgt"
  278. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch mips64 -cc mips64-linux-gnuabi64-gcc tar "$tgt"
  279. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch mips64le -cc mips64el-linux-gnuabi64-gcc tar "$tgt"
  280. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch riscv64 -cc "zig cc -target riscv64-linux-musl" tar "$tgt"
  281. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch s390x -cc "zig cc -target s390x-linux-musl" tar "$tgt"
  282. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch loong64 -cc "zig cc -target loongarch64-linux-musl" tar "$tgt"
  283. # go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch ppc64 -cc "zig cc -target powerpc64-linux-musl" tar "$tgt" # fails with linkmode not supported
  284. go run build.go -tags "${{env.TAGS_LINUX}}" -goos linux -goarch ppc64le -cc "zig cc -target powerpc64le-linux-musl" tar "$tgt"
  285. done
  286. env:
  287. CGO_ENABLED: "1"
  288. EXTRA_LDFLAGS: "-linkmode=external -extldflags=-static"
  289. - name: Archive artifacts
  290. uses: actions/upload-artifact@v4
  291. with:
  292. name: packages-linux
  293. path: |
  294. *.tar.gz
  295. compat.json
  296. package-illumos:
  297. runs-on: ubuntu-latest
  298. name: Package for illumos
  299. needs:
  300. - facts
  301. env:
  302. VERSION: ${{ needs.facts.outputs.version }}
  303. GO_VERSION: ${{ needs.facts.outputs.go-version }}
  304. steps:
  305. - uses: actions/checkout@v5
  306. - name: Build syncthing in OmniOS VM
  307. uses: vmactions/omnios-vm@v1
  308. with:
  309. envs: "VERSION GO_VERSION CGO_ENABLED"
  310. usesh: true
  311. prepare: |
  312. pkg install developer/gcc14 web/curl archiver/gnu-tar
  313. run: |
  314. curl -L "https://go.dev/dl/go$GO_VERSION.illumos-amd64.tar.gz" | gtar xzf -
  315. export PATH="$GITHUB_WORKSPACE/go/bin:$PATH"
  316. go version
  317. for tgt in syncthing stdiscosrv strelaysrv ; do
  318. go run build.go -tags "${{env.TAGS}}" tar "$tgt"
  319. done
  320. env:
  321. CGO_ENABLED: "1"
  322. - name: Archive artifacts
  323. uses: actions/upload-artifact@v4
  324. with:
  325. name: packages-illumos
  326. path: "*.tar.gz"
  327. #
  328. # macOS. The entire build runs in the release environment because code
  329. # signing is part of the build process, so it is limited to release
  330. # branches on the Syncthing repo.
  331. #
  332. package-macos:
  333. name: Package for macOS
  334. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
  335. environment: release
  336. runs-on: macos-latest
  337. needs:
  338. - facts
  339. env:
  340. CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
  341. VERSION: ${{ needs.facts.outputs.version }}
  342. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  343. steps:
  344. - uses: actions/checkout@v5
  345. - uses: actions/setup-go@v6
  346. with:
  347. go-version: ${{ needs.facts.outputs.go-version }}
  348. cache: false
  349. - uses: actions/cache@v4
  350. with:
  351. path: |
  352. ~/.cache/go-build
  353. ~/go/pkg/mod
  354. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-package-${{ hashFiles('**/go.sum') }}
  355. - name: Import signing certificate
  356. if: env.CODESIGN_IDENTITY != ''
  357. run: |
  358. # Set up a run-specific keychain, making it available for the
  359. # `codesign` tool.
  360. umask 066
  361. KEYCHAIN_PATH=$RUNNER_TEMP/codesign.keychain
  362. KEYCHAIN_PASSWORD=$(uuidgen)
  363. security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
  364. security default-keychain -s "$KEYCHAIN_PATH"
  365. security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
  366. security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
  367. # Import the certificate
  368. CERTIFICATE_PATH=$RUNNER_TEMP/codesign.p12
  369. echo "$DEVELOPER_ID_CERTIFICATE_BASE64" | base64 -d -o "$CERTIFICATE_PATH"
  370. security import "$CERTIFICATE_PATH" -k "$KEYCHAIN_PATH" -P "$DEVELOPER_ID_CERTIFICATE_PASSWORD" -T /usr/bin/codesign -T /usr/bin/productsign
  371. security set-key-partition-list -S apple-tool:,apple: -s -k actions "$KEYCHAIN_PATH"
  372. # Set the codesign identity for following steps
  373. echo "CODESIGN_IDENTITY=$CODESIGN_IDENTITY" >> $GITHUB_ENV
  374. env:
  375. DEVELOPER_ID_CERTIFICATE_BASE64: ${{ secrets.DEVELOPER_ID_CERTIFICATE_BASE64 }}
  376. DEVELOPER_ID_CERTIFICATE_PASSWORD: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }}
  377. CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
  378. - name: Create package (amd64)
  379. run: |
  380. for tgt in syncthing stdiscosrv strelaysrv ; do
  381. go run build.go -tags "${{env.TAGS}}" -goarch amd64 zip "$tgt"
  382. done
  383. env:
  384. CGO_ENABLED: "1"
  385. - name: Create package (arm64 cross)
  386. run: |
  387. cat <<EOT > xgo.sh
  388. #!/bin/bash
  389. CGO_ENABLED=1 \
  390. CGO_CFLAGS="-target arm64-apple-macos10.15" \
  391. CGO_LDFLAGS="-target arm64-apple-macos10.15" \
  392. go "\$@"
  393. EOT
  394. chmod 755 xgo.sh
  395. for tgt in syncthing stdiscosrv strelaysrv ; do
  396. go run build.go -tags "${{env.TAGS}}" -gocmd ./xgo.sh -goarch arm64 zip "$tgt"
  397. done
  398. env:
  399. CGO_ENABLED: "1"
  400. - name: Create package (universal)
  401. run: |
  402. rm -rf _tmp
  403. mkdir _tmp
  404. pushd _tmp
  405. unzip ../syncthing-macos-amd64-*.zip
  406. unzip ../syncthing-macos-arm64-*.zip
  407. lipo -create syncthing-macos-amd64-*/syncthing syncthing-macos-arm64-*/syncthing -o syncthing
  408. amd64=(syncthing-macos-amd64-*)
  409. universal="${amd64/amd64/universal}"
  410. mv "$amd64" "$universal"
  411. mv syncthing "$universal"
  412. zip -r "../$universal.zip" "$universal"
  413. - name: Archive artifacts
  414. uses: actions/upload-artifact@v4
  415. with:
  416. name: packages-macos
  417. path: "*.zip"
  418. notarize-macos:
  419. name: Notarize for macOS
  420. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
  421. environment: release
  422. needs:
  423. - package-macos
  424. runs-on: macos-latest
  425. steps:
  426. - name: Download artifacts
  427. uses: actions/download-artifact@v4
  428. with:
  429. name: packages-macos
  430. - name: Notarize binaries
  431. run: |
  432. APPSTORECONNECT_API_KEY_PATH="$RUNNER_TEMP/apikey.p8"
  433. echo "$APPSTORECONNECT_API_KEY" | base64 -d -o "$APPSTORECONNECT_API_KEY_PATH"
  434. for file in *-macos-*.zip ; do
  435. xcrun notarytool submit \
  436. -k "$APPSTORECONNECT_API_KEY_PATH" \
  437. -d "$APPSTORECONNECT_API_KEY_ID" \
  438. -i "$APPSTORECONNECT_API_KEY_ISSUER" \
  439. $file
  440. done
  441. env:
  442. APPSTORECONNECT_API_KEY: ${{ secrets.APPSTORECONNECT_API_KEY }}
  443. APPSTORECONNECT_API_KEY_ID: ${{ secrets.APPSTORECONNECT_API_KEY_ID }}
  444. APPSTORECONNECT_API_KEY_ISSUER: ${{ secrets.APPSTORECONNECT_API_KEY_ISSUER }}
  445. #
  446. # Cross compile other unixes
  447. #
  448. package-cross:
  449. name: Package cross compiled
  450. runs-on: ubuntu-latest
  451. needs:
  452. - facts
  453. env:
  454. VERSION: ${{ needs.facts.outputs.version }}
  455. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  456. steps:
  457. - uses: actions/checkout@v5
  458. - uses: actions/setup-go@v6
  459. with:
  460. go-version: ${{ needs.facts.outputs.go-version }}
  461. cache: false
  462. - uses: actions/cache@v4
  463. with:
  464. path: |
  465. ~/.cache/go-build
  466. ~/go/pkg/mod
  467. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-cross-${{ hashFiles('**/go.sum') }}
  468. - name: Create packages
  469. run: |
  470. platforms=$(go tool dist list \
  471. | grep -v aix/ppc64 \
  472. | grep -v android/ \
  473. | grep -v darwin/ \
  474. | grep -v illumos/ \
  475. | grep -v ios/ \
  476. | grep -v js/ \
  477. | grep -v linux/ \
  478. | grep -v nacl/ \
  479. | grep -v plan9/ \
  480. | grep -v windows/ \
  481. | grep -v /wasm \
  482. )
  483. # Build for each platform with errors silenced, because we expect
  484. # some oddball platforms to fail. This avoids a bunch of errors in
  485. # the GitHub Actions output, instead summarizing each build
  486. # failure as a warning.
  487. for plat in $platforms; do
  488. goos="${plat%/*}"
  489. goarch="${plat#*/}"
  490. echo "::group ::$plat"
  491. for tgt in syncthing stdiscosrv strelaysrv ; do
  492. if ! go run build.go -goos "$goos" -goarch "$goarch" tar "$tgt" ; then
  493. echo "::warning ::Failed to build $tgt for $plat"
  494. fi
  495. done
  496. echo "::endgroup::"
  497. done
  498. env:
  499. CGO_ENABLED: "0"
  500. - name: Archive artifacts
  501. uses: actions/upload-artifact@v4
  502. with:
  503. name: packages-other
  504. path: "*.tar.gz"
  505. #
  506. # Source
  507. #
  508. package-source:
  509. name: Package source code
  510. runs-on: ubuntu-latest
  511. needs:
  512. - facts
  513. env:
  514. VERSION: ${{ needs.facts.outputs.version }}
  515. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  516. steps:
  517. - uses: actions/checkout@v5
  518. - uses: actions/setup-go@v6
  519. with:
  520. go-version: ${{ needs.facts.outputs.go-version }}
  521. cache: false
  522. - name: Package source
  523. run: |
  524. echo "$VERSION" > RELEASE
  525. go mod vendor
  526. go run build.go assets
  527. cd ..
  528. tar c -z -f "syncthing-source-$VERSION.tar.gz" \
  529. --exclude .git \
  530. syncthing
  531. mv "syncthing-source-$VERSION.tar.gz" syncthing
  532. - name: Archive artifacts
  533. uses: actions/upload-artifact@v4
  534. with:
  535. name: packages-source
  536. path: syncthing-source-*.tar.gz
  537. #
  538. # Sign binaries for auto upgrade, generate ASC signature files
  539. #
  540. sign-for-upgrade:
  541. name: Sign for upgrade
  542. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
  543. environment: release
  544. needs:
  545. - codesign-windows
  546. - package-linux
  547. - package-illumos
  548. - package-macos
  549. - package-cross
  550. - package-source
  551. - facts
  552. env:
  553. VERSION: ${{ needs.facts.outputs.version }}
  554. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  555. runs-on: ubuntu-latest
  556. steps:
  557. - uses: actions/checkout@v5
  558. - uses: actions/checkout@v5
  559. with:
  560. repository: syncthing/release-tools
  561. path: tools
  562. - name: Download artifacts
  563. uses: actions/download-artifact@v4
  564. - uses: actions/setup-go@v6
  565. with:
  566. go-version: ${{ needs.facts.outputs.go-version }}
  567. cache: false
  568. - name: Install signing tool
  569. run: |
  570. go install ./cmd/dev/stsigtool
  571. - name: Sign archives
  572. run: |
  573. export PRIVATE_KEY="$RUNNER_TEMP/privkey.pem"
  574. export PATH="$PATH:$(go env GOPATH)/bin"
  575. echo "$STSIGTOOL_PRIVATE_KEY" | base64 -d > "$PRIVATE_KEY"
  576. mkdir packages
  577. mv packages-*/* packages
  578. pushd packages
  579. "$GITHUB_WORKSPACE/tools/sign-only"
  580. rm -f "$PRIVATE_KEY"
  581. env:
  582. STSIGTOOL_PRIVATE_KEY: ${{ secrets.STSIGTOOL_PRIVATE_KEY }}
  583. - name: Create shasum files
  584. run: |
  585. pushd packages
  586. files=(*.tar.gz *.zip)
  587. sha1sum "${files[@]}" > sha1sum.txt
  588. sha256sum "${files[@]}" > sha256sum.txt
  589. popd
  590. - name: Sign shasum files
  591. uses: docker://ghcr.io/kastelo/ezapt:latest
  592. with:
  593. args:
  594. sign
  595. packages/sha1sum.txt packages/sha256sum.txt
  596. env:
  597. EZAPT_KEYRING_BASE64: ${{ secrets.APT_GPG_KEYRING_BASE64 }}
  598. - name: Sign source
  599. uses: docker://ghcr.io/kastelo/ezapt:latest
  600. with:
  601. args:
  602. sign --detach --ascii
  603. packages/syncthing-source-${{ env.VERSION }}.tar.gz
  604. env:
  605. EZAPT_KEYRING_BASE64: ${{ secrets.APT_GPG_KEYRING_BASE64 }}
  606. - name: Archive artifacts
  607. uses: actions/upload-artifact@v4
  608. with:
  609. name: packages-signed
  610. path: |
  611. packages/*.tar.gz
  612. packages/*.zip
  613. packages/*.asc
  614. packages/*.json
  615. #
  616. # Debian
  617. #
  618. package-debian:
  619. name: Package for Debian
  620. runs-on: ubuntu-latest
  621. needs:
  622. - facts
  623. env:
  624. VERSION: ${{ needs.facts.outputs.version }}
  625. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  626. steps:
  627. - uses: actions/checkout@v5
  628. - uses: actions/setup-go@v6
  629. with:
  630. go-version: ${{ needs.facts.outputs.go-version }}
  631. cache: false
  632. - uses: ruby/setup-ruby@v1
  633. with:
  634. ruby-version: '3.0'
  635. - name: Install fpm
  636. run: |
  637. gem install fpm
  638. - uses: mlugg/setup-zig@v2
  639. - uses: actions/cache@v4
  640. with:
  641. path: |
  642. ~/.cache/go-build
  643. ~/go/pkg/mod
  644. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-debian-${{ hashFiles('**/go.sum') }}
  645. - name: Package for Debian (CGO)
  646. run: |
  647. for tgt in syncthing stdiscosrv strelaysrv ; do
  648. go run build.go -no-upgrade -installsuffix=no-upgrade -tags "${{env.TAGS_LINUX}}" -goos linux -goarch amd64 -cc "zig cc -target x86_64-linux-musl" deb "$tgt"
  649. go run build.go -no-upgrade -installsuffix=no-upgrade -tags "${{env.TAGS_LINUX}}" -goos linux -goarch armel -cc "zig cc -target arm-linux-musleabi -mcpu=arm1136j_s" deb "$tgt"
  650. go run build.go -no-upgrade -installsuffix=no-upgrade -tags "${{env.TAGS_LINUX}}" -goos linux -goarch armhf -cc "zig cc -target arm-linux-musleabi -mcpu=arm1136j_s" deb "$tgt"
  651. go run build.go -no-upgrade -installsuffix=no-upgrade -tags "${{env.TAGS_LINUX}}" -goos linux -goarch arm64 -cc "zig cc -target aarch64-linux-musl" deb "$tgt"
  652. done
  653. env:
  654. BUILD_USER: debian
  655. CGO_ENABLED: "1"
  656. EXTRA_LDFLAGS: "-linkmode=external -extldflags=-static"
  657. - name: Archive artifacts
  658. uses: actions/upload-artifact@v4
  659. with:
  660. name: debian-packages
  661. path: "*.deb"
  662. #
  663. # Nightlies
  664. #
  665. publish-nightly:
  666. name: Publish nightly build
  667. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/heads/release-nightly')
  668. environment: release
  669. needs:
  670. - sign-for-upgrade
  671. - facts
  672. runs-on: ubuntu-latest
  673. steps:
  674. - uses: actions/checkout@v5
  675. with:
  676. repository: syncthing/release-tools
  677. path: tools
  678. - name: Download artifacts
  679. uses: actions/download-artifact@v4
  680. with:
  681. name: packages-signed
  682. path: packages
  683. - uses: actions/setup-go@v6
  684. with:
  685. go-version: ${{ needs.facts.outputs.go-version }}
  686. cache: false
  687. - name: Create release json
  688. run: |
  689. cd packages
  690. "$GITHUB_WORKSPACE/tools/generate-release-json" "$BASE_URL" > nightly.json
  691. env:
  692. BASE_URL: ${{ secrets.NIGHTLY_BASE_URL }}
  693. - name: Push artifacts
  694. uses: docker://docker.io/rclone/rclone:latest
  695. env:
  696. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  697. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  698. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  699. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  700. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  701. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  702. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  703. with:
  704. args: sync -v --no-update-modtime packages objstore:nightly
  705. #
  706. # Push release artifacts to Spaces
  707. #
  708. publish-release-files:
  709. name: Publish release files
  710. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/tags/v'))
  711. environment: release
  712. permissions:
  713. contents: write
  714. needs:
  715. - sign-for-upgrade
  716. - package-debian
  717. - facts
  718. env:
  719. VERSION: ${{ needs.facts.outputs.version }}
  720. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  721. runs-on: ubuntu-latest
  722. steps:
  723. - uses: actions/checkout@v5
  724. with:
  725. fetch-depth: 0
  726. ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
  727. - name: Download signed packages
  728. uses: actions/download-artifact@v4
  729. with:
  730. name: packages-signed
  731. path: packages
  732. - name: Download debian packages
  733. uses: actions/download-artifact@v4
  734. with:
  735. name: debian-packages
  736. path: packages
  737. - uses: actions/setup-go@v6
  738. with:
  739. go-version: ${{ needs.facts.outputs.go-version }}
  740. cache: false
  741. - name: Push to object store (${{ env.VERSION }})
  742. uses: docker://docker.io/rclone/rclone:latest
  743. env:
  744. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  745. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  746. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  747. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  748. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  749. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  750. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  751. with:
  752. args: sync -v --no-update-modtime packages objstore:release/${{ env.VERSION }}
  753. - name: Push to object store (latest)
  754. uses: docker://docker.io/rclone/rclone:latest
  755. env:
  756. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  757. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  758. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  759. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  760. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  761. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  762. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  763. with:
  764. args: sync -v --no-update-modtime objstore:release/${{ env.VERSION }} objstore:release/latest
  765. - name: Create GitHub releases and push binaries
  766. run: |
  767. maybePrerelease=""
  768. if [[ $VERSION == *-* ]]; then
  769. maybePrerelease="--prerelease"
  770. fi
  771. export GH_PROMPT_DISABLED=1
  772. if ! gh release view --json name "$VERSION" >/dev/null 2>&1 ; then
  773. gh release create "$VERSION" \
  774. $maybePrerelease \
  775. --title "$VERSION" \
  776. --notes-from-tag
  777. fi
  778. gh release upload --clobber "$VERSION" \
  779. packages/*.asc packages/*.json \
  780. packages/syncthing-*.tar.gz \
  781. packages/syncthing-*.zip \
  782. packages/syncthing_*.deb
  783. PKGS=$(pwd)/packages
  784. cd /tmp # gh will not release for repo x while inside repo y
  785. for repo in relaysrv discosrv ; do
  786. export GH_REPO="syncthing/$repo"
  787. if ! gh release view --json name "$VERSION" >/dev/null 2>&1 ; then
  788. gh release create "$VERSION" \
  789. $maybePrerelease \
  790. --title "$VERSION" \
  791. --notes "https://github.com/syncthing/syncthing/releases/tag/$VERSION"
  792. fi
  793. gh release upload --clobber "$VERSION" \
  794. $PKGS/*.asc \
  795. $PKGS/*${repo}*
  796. done
  797. env:
  798. GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
  799. #
  800. # Push Debian/APT archive
  801. #
  802. publish-apt:
  803. name: Publish APT
  804. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
  805. environment: release
  806. needs:
  807. - package-debian
  808. - facts
  809. env:
  810. VERSION: ${{ needs.facts.outputs.version }}
  811. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  812. RELEASE_GENERATION: ${{ needs.facts.outputs.release-generation }}
  813. runs-on: ubuntu-latest
  814. steps:
  815. - name: Download packages
  816. uses: actions/download-artifact@v4
  817. with:
  818. name: debian-packages
  819. path: packages
  820. # Decide whether packages should go to stable, candidate or nightly
  821. - name: Pull archive
  822. uses: docker://docker.io/rclone/rclone:latest
  823. env:
  824. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  825. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  826. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  827. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  828. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  829. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  830. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  831. with:
  832. args: sync objstore:apt apt
  833. - name: Prepare packages
  834. run: |
  835. sudo chown -R $(id -u) apt/pool
  836. mv packages/*.deb apt/pool
  837. - name: Update archive
  838. uses: docker://ghcr.io/kastelo/ezapt:latest
  839. with:
  840. args:
  841. publish --root apt
  842. env:
  843. EZAPT_KEYRING_BASE64: ${{ secrets.APT_GPG_KEYRING_BASE64 }}
  844. - name: Push archive
  845. uses: docker://docker.io/rclone/rclone:latest
  846. env:
  847. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  848. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  849. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  850. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  851. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  852. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  853. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  854. with:
  855. args: sync -v --no-update-modtime apt objstore:apt
  856. #
  857. # Build and push (except for PRs) to GHCR.
  858. #
  859. docker-ghcr:
  860. name: Build and push Docker images (GHCR)
  861. runs-on: ubuntu-latest
  862. permissions:
  863. contents: read
  864. packages: write
  865. needs:
  866. - facts
  867. env:
  868. VERSION: ${{ needs.facts.outputs.version }}
  869. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  870. strategy:
  871. matrix:
  872. pkg:
  873. - syncthing
  874. - strelaysrv
  875. - stdiscosrv
  876. include:
  877. - pkg: syncthing
  878. dockerfile: Dockerfile
  879. image: syncthing
  880. - pkg: strelaysrv
  881. dockerfile: Dockerfile.strelaysrv
  882. image: relaysrv
  883. - pkg: stdiscosrv
  884. dockerfile: Dockerfile.stdiscosrv
  885. image: discosrv
  886. steps:
  887. - uses: actions/checkout@v5
  888. - uses: actions/setup-go@v6
  889. with:
  890. go-version: ${{ needs.facts.outputs.go-version }}
  891. cache: false
  892. - uses: mlugg/setup-zig@v2
  893. - uses: actions/cache@v4
  894. with:
  895. path: |
  896. ~/.cache/go-build
  897. ~/go/pkg/mod
  898. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-docker-${{ matrix.pkg }}-${{ hashFiles('**/go.sum') }}
  899. - name: Build binaries (CGO)
  900. run: |
  901. # amd64
  902. go run build.go -goos linux -goarch amd64 -tags "${{env.TAGS_LINUX}}" -cc "zig cc -target x86_64-linux-musl" -no-upgrade build ${{ matrix.pkg }}
  903. mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-amd64
  904. # arm64
  905. go run build.go -goos linux -goarch arm64 -tags "${{env.TAGS_LINUX}}" -cc "zig cc -target aarch64-linux-musl" -no-upgrade build ${{ matrix.pkg }}
  906. mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-arm64
  907. # arm
  908. go run build.go -goos linux -goarch arm -tags "${{env.TAGS_LINUX}}" -cc "zig cc -target arm-linux-musleabi -mcpu=arm1136j_s" -no-upgrade build ${{ matrix.pkg }}
  909. mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-arm
  910. env:
  911. CGO_ENABLED: "1"
  912. BUILD_USER: docker
  913. EXTRA_LDFLAGS: "-linkmode=external -extldflags=-static"
  914. - name: Login to GHCR
  915. uses: docker/login-action@v3
  916. with:
  917. registry: ghcr.io
  918. username: ${{ github.actor }}
  919. password: ${{ secrets.GITHUB_TOKEN }}
  920. - name: Set up Docker Buildx
  921. uses: docker/setup-buildx-action@v3
  922. - name: Set version tags
  923. run: |
  924. version=${VERSION#v}
  925. repo=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
  926. ref="${{github.ref_name}}"
  927. ref=${ref//\//-} # slashes to dashes
  928. # List of tags for ghcr.io
  929. if [[ $version == @([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]) ]] ; then
  930. major=${version%.*.*}
  931. minor=${version%.*}
  932. tags=$repo:$version,$repo:$major,$repo:$minor,$repo:latest
  933. elif [[ $version == *-rc.@([0-9]|[0-9][0-9]) ]] ; then
  934. tags=$repo:$version,$repo:rc
  935. elif [[ $ref == "main" ]] ; then
  936. tags=$repo:edge
  937. else
  938. tags=$repo:$ref
  939. fi
  940. echo Pushing to $tags
  941. echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV
  942. - name: Build and push Docker image
  943. uses: docker/build-push-action@v5
  944. with:
  945. context: .
  946. file: ${{ matrix.dockerfile }}
  947. platforms: linux/amd64,linux/arm64,linux/arm/7
  948. tags: ${{ env.DOCKER_TAGS }}
  949. push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
  950. labels: |
  951. org.opencontainers.image.version=${{ env.VERSION }}
  952. org.opencontainers.image.revision=${{ github.sha }}
  953. #
  954. # Sync images to Docker hub. This takes the images already pushed to GHCR
  955. # and copies them to Docker hub. Runs for releases only.
  956. #
  957. docker-hub:
  958. name: Sync images to Docker hub
  959. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release-nightly' || github.ref == 'refs/heads/infrastructure' || startsWith(github.ref, 'refs/tags/v'))
  960. runs-on: ubuntu-latest
  961. needs:
  962. - docker-ghcr
  963. environment: docker
  964. env:
  965. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  966. DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
  967. steps:
  968. - uses: actions/checkout@v5
  969. - name: Sync images
  970. uses: docker://docker.io/regclient/regsync:latest
  971. with:
  972. args:
  973. -c ./.github/regsync.yml
  974. once
  975. #
  976. # Check for known vulnerabilities in Go dependencies
  977. #
  978. govulncheck:
  979. runs-on: ubuntu-latest
  980. name: Run govulncheck
  981. needs:
  982. - facts
  983. steps:
  984. - uses: actions/checkout@v5
  985. - uses: actions/setup-go@v6
  986. with:
  987. go-version: ${{ needs.facts.outputs.go-version }}
  988. cache: false
  989. - name: run govulncheck
  990. run: |
  991. go run build.go assets
  992. go install golang.org/x/vuln/cmd/govulncheck@latest
  993. govulncheck ./...
  994. #
  995. # golangci-lint runs a suite of static analysis checks on the code
  996. #
  997. golangci:
  998. runs-on: ubuntu-latest
  999. name: Run golangci-lint
  1000. if: github.event_name == 'pull_request'
  1001. steps:
  1002. - uses: actions/checkout@v5
  1003. - uses: actions/setup-go@v6
  1004. with:
  1005. go-version: 'stable'
  1006. - name: ensure asset generation
  1007. run: go run build.go assets
  1008. - name: golangci-lint
  1009. uses: golangci/golangci-lint-action@v8
  1010. with:
  1011. only-new-issues: true
  1012. #
  1013. # Meta checks for formatting, copyright, etc
  1014. #
  1015. meta:
  1016. name: Run meta checks
  1017. runs-on: ubuntu-latest
  1018. steps:
  1019. - uses: actions/checkout@v5
  1020. - uses: actions/setup-go@v6
  1021. with:
  1022. go-version: 'stable'
  1023. - run: |
  1024. go run build.go assets
  1025. go test -v ./meta