build-syncthing.yaml 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  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 -n 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. mkdir bin
  902. # amd64
  903. 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 }}
  904. mv ${{ matrix.pkg }} bin/${{ matrix.pkg }}-linux-amd64
  905. # arm64
  906. go run build.go -goos linux -goarch arm64 -tags "${{env.TAGS_LINUX}}" -cc "zig cc -target aarch64-linux-musl" -no-upgrade build ${{ matrix.pkg }}
  907. mv ${{ matrix.pkg }} bin/${{ matrix.pkg }}-linux-arm64
  908. # arm
  909. 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 }}
  910. mv ${{ matrix.pkg }} bin/${{ matrix.pkg }}-linux-arm
  911. env:
  912. CGO_ENABLED: "1"
  913. BUILD_USER: docker
  914. EXTRA_LDFLAGS: "-linkmode=external -extldflags=-static"
  915. - name: Login to GHCR
  916. uses: docker/login-action@v3
  917. with:
  918. registry: ghcr.io
  919. username: ${{ github.actor }}
  920. password: ${{ secrets.GITHUB_TOKEN }}
  921. - name: Set up QEMU
  922. uses: docker/setup-qemu-action@v3
  923. - name: Set up Docker Buildx
  924. uses: docker/setup-buildx-action@v3
  925. - name: Set version tags
  926. run: |
  927. version=${VERSION#v}
  928. repo=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
  929. ref="${{github.ref_name}}"
  930. ref=${ref//\//-} # slashes to dashes
  931. # List of tags for ghcr.io
  932. if [[ $version == @([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]) ]] ; then
  933. major=${version%.*.*}
  934. minor=${version%.*}
  935. tags=$repo:$version,$repo:$major,$repo:$minor,$repo:latest
  936. elif [[ $version == *-rc.@([0-9]|[0-9][0-9]) ]] ; then
  937. tags=$repo:$version,$repo:rc
  938. elif [[ $ref == "main" ]] ; then
  939. tags=$repo:edge
  940. else
  941. tags=$repo:$ref
  942. fi
  943. echo Pushing to $tags
  944. echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV
  945. - name: Prepare context dir
  946. run: |
  947. mkdir ctx
  948. mv bin/* script ctx
  949. - name: Build and push Docker image
  950. uses: docker/build-push-action@v6
  951. with:
  952. context: ctx
  953. file: ${{ matrix.dockerfile }}
  954. platforms: linux/amd64,linux/arm64,linux/arm/7
  955. tags: ${{ env.DOCKER_TAGS }}
  956. push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
  957. labels: |
  958. org.opencontainers.image.version=${{ env.VERSION }}
  959. org.opencontainers.image.revision=${{ github.sha }}
  960. #
  961. # Sync images to Docker hub. This takes the images already pushed to GHCR
  962. # and copies them to Docker hub. Runs for releases only.
  963. #
  964. docker-hub:
  965. name: Sync images to Docker hub
  966. 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'))
  967. runs-on: ubuntu-latest
  968. needs:
  969. - docker-ghcr
  970. environment: docker
  971. env:
  972. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  973. DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
  974. steps:
  975. - uses: actions/checkout@v5
  976. - name: Sync images
  977. uses: docker://docker.io/regclient/regsync:latest
  978. with:
  979. args:
  980. -c ./.github/regsync.yml
  981. once
  982. #
  983. # Check for known vulnerabilities in Go dependencies
  984. #
  985. govulncheck:
  986. runs-on: ubuntu-latest
  987. name: Run govulncheck
  988. needs:
  989. - facts
  990. steps:
  991. - uses: actions/checkout@v5
  992. - uses: actions/setup-go@v6
  993. with:
  994. go-version: ${{ needs.facts.outputs.go-version }}
  995. cache: false
  996. - name: run govulncheck
  997. run: |
  998. go run build.go assets
  999. go install golang.org/x/vuln/cmd/govulncheck@latest
  1000. govulncheck ./...
  1001. #
  1002. # golangci-lint runs a suite of static analysis checks on the code
  1003. #
  1004. golangci:
  1005. runs-on: ubuntu-latest
  1006. name: Run golangci-lint
  1007. if: github.event_name == 'pull_request'
  1008. steps:
  1009. - uses: actions/checkout@v5
  1010. - uses: actions/setup-go@v6
  1011. with:
  1012. go-version: 'stable'
  1013. - name: ensure asset generation
  1014. run: go run build.go assets
  1015. - name: golangci-lint
  1016. uses: golangci/golangci-lint-action@v8
  1017. with:
  1018. only-new-issues: true
  1019. #
  1020. # Meta checks for formatting, copyright, etc
  1021. #
  1022. meta:
  1023. name: Run meta checks
  1024. runs-on: ubuntu-latest
  1025. steps:
  1026. - uses: actions/checkout@v5
  1027. - uses: actions/setup-go@v6
  1028. with:
  1029. go-version: 'stable'
  1030. - run: |
  1031. go run build.go assets
  1032. go test -v ./meta