build-syncthing.yaml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  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@v7
  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@v7
  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@v7
  564. with:
  565. pattern: packages-*
  566. path: packages
  567. merge-multiple: true
  568. - uses: actions/setup-go@v6
  569. with:
  570. go-version: ${{ needs.facts.outputs.go-version }}
  571. cache: false
  572. - name: Install signing tool
  573. run: |
  574. go install ./cmd/dev/stsigtool
  575. - name: Sign archives
  576. run: |
  577. export PRIVATE_KEY="$RUNNER_TEMP/privkey.pem"
  578. export PATH="$PATH:$(go env GOPATH)/bin"
  579. echo "$STSIGTOOL_PRIVATE_KEY" | base64 -d > "$PRIVATE_KEY"
  580. pushd packages
  581. "$GITHUB_WORKSPACE/tools/sign-only"
  582. rm -f "$PRIVATE_KEY"
  583. env:
  584. STSIGTOOL_PRIVATE_KEY: ${{ secrets.STSIGTOOL_PRIVATE_KEY }}
  585. - name: Create shasum files
  586. run: |
  587. pushd packages
  588. files=(*.tar.gz *.zip)
  589. sha1sum "${files[@]}" > sha1sum.txt
  590. sha256sum "${files[@]}" > sha256sum.txt
  591. popd
  592. - name: Sign shasum files
  593. uses: docker://ghcr.io/kastelo/ezapt:latest
  594. with:
  595. args:
  596. sign
  597. packages/sha1sum.txt packages/sha256sum.txt
  598. env:
  599. EZAPT_KEYRING_BASE64: ${{ secrets.APT_GPG_KEYRING_BASE64 }}
  600. - name: Sign source
  601. uses: docker://ghcr.io/kastelo/ezapt:latest
  602. with:
  603. args:
  604. sign --detach --ascii
  605. packages/syncthing-source-${{ env.VERSION }}.tar.gz
  606. env:
  607. EZAPT_KEYRING_BASE64: ${{ secrets.APT_GPG_KEYRING_BASE64 }}
  608. - name: Archive artifacts
  609. uses: actions/upload-artifact@v4
  610. with:
  611. name: packages-signed
  612. path: |
  613. packages/*.tar.gz
  614. packages/*.zip
  615. packages/*.asc
  616. packages/*.json
  617. #
  618. # Debian
  619. #
  620. package-debian:
  621. name: Package for Debian
  622. runs-on: ubuntu-latest
  623. needs:
  624. - facts
  625. env:
  626. VERSION: ${{ needs.facts.outputs.version }}
  627. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  628. steps:
  629. - uses: actions/checkout@v5
  630. - uses: actions/setup-go@v6
  631. with:
  632. go-version: ${{ needs.facts.outputs.go-version }}
  633. cache: false
  634. - uses: ruby/setup-ruby@v1
  635. with:
  636. ruby-version: '3.0'
  637. - name: Install fpm
  638. run: |
  639. gem install fpm
  640. - uses: mlugg/setup-zig@v2
  641. - uses: actions/cache@v4
  642. with:
  643. path: |
  644. ~/.cache/go-build
  645. ~/go/pkg/mod
  646. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-debian-${{ hashFiles('go.sum') }}
  647. - name: Package for Debian (CGO)
  648. run: |
  649. for tgt in syncthing stdiscosrv strelaysrv ; do
  650. 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"
  651. 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"
  652. 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"
  653. 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"
  654. done
  655. env:
  656. BUILD_USER: debian
  657. CGO_ENABLED: "1"
  658. EXTRA_LDFLAGS: "-linkmode=external -extldflags=-static"
  659. - name: Archive artifacts
  660. uses: actions/upload-artifact@v4
  661. with:
  662. name: debian-packages
  663. path: "*.deb"
  664. #
  665. # Nightlies
  666. #
  667. publish-nightly:
  668. name: Publish nightly build
  669. if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/heads/release-nightly')
  670. environment: release
  671. needs:
  672. - sign-for-upgrade
  673. - facts
  674. runs-on: ubuntu-latest
  675. steps:
  676. - uses: actions/checkout@v5
  677. with:
  678. repository: syncthing/release-tools
  679. path: tools
  680. - name: Download artifacts
  681. uses: actions/download-artifact@v7
  682. with:
  683. name: packages-signed
  684. path: packages
  685. - uses: actions/setup-go@v6
  686. with:
  687. go-version: ${{ needs.facts.outputs.go-version }}
  688. cache: false
  689. - name: Create release json
  690. run: |
  691. cd packages
  692. "$GITHUB_WORKSPACE/tools/generate-release-json" "$BASE_URL" > nightly.json
  693. env:
  694. BASE_URL: ${{ secrets.NIGHTLY_BASE_URL }}
  695. - name: Push artifacts
  696. uses: docker://docker.io/rclone/rclone:latest
  697. env:
  698. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  699. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  700. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  701. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  702. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  703. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  704. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  705. with:
  706. args: sync -v --no-update-modtime packages objstore:nightly
  707. #
  708. # Push release artifacts to Spaces
  709. #
  710. publish-release-files:
  711. name: Publish release files
  712. 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'))
  713. environment: release
  714. permissions:
  715. contents: write
  716. id-token: write
  717. attestations: write
  718. artifact-metadata: write
  719. needs:
  720. - sign-for-upgrade
  721. - package-debian
  722. - facts
  723. env:
  724. VERSION: ${{ needs.facts.outputs.version }}
  725. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  726. runs-on: ubuntu-latest
  727. steps:
  728. - uses: actions/checkout@v5
  729. with:
  730. fetch-depth: 0
  731. ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
  732. - name: Download signed packages
  733. uses: actions/download-artifact@v7
  734. with:
  735. name: packages-signed
  736. path: packages
  737. - name: Download debian packages
  738. uses: actions/download-artifact@v7
  739. with:
  740. name: debian-packages
  741. path: packages
  742. - name: Create GitHub build provenance attestations
  743. uses: actions/attest-build-provenance@v3
  744. with:
  745. subject-path: packages/*
  746. - name: Push to object store (${{ env.VERSION }})
  747. uses: docker://docker.io/rclone/rclone:latest
  748. env:
  749. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  750. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  751. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  752. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  753. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  754. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  755. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  756. with:
  757. args: sync -v --no-update-modtime packages objstore:release/${{ env.VERSION }}
  758. - name: Push to object store (latest)
  759. uses: docker://docker.io/rclone/rclone:latest
  760. env:
  761. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  762. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  763. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  764. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  765. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  766. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  767. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  768. with:
  769. args: sync -v --no-update-modtime objstore:release/${{ env.VERSION }} objstore:release/latest
  770. - name: Create GitHub releases and push binaries
  771. run: |
  772. maybePrerelease=""
  773. if [[ $VERSION == *-* ]]; then
  774. maybePrerelease="--prerelease"
  775. fi
  776. export GH_PROMPT_DISABLED=1
  777. if ! gh release view --json name "$VERSION" >/dev/null 2>&1 ; then
  778. gh release create "$VERSION" \
  779. $maybePrerelease \
  780. --title "$VERSION" \
  781. --notes-from-tag
  782. fi
  783. gh release upload --clobber "$VERSION" \
  784. packages/*.asc packages/*.json \
  785. packages/syncthing-*.tar.gz \
  786. packages/syncthing-*.zip \
  787. packages/syncthing_*.deb
  788. PKGS=$(pwd)/packages
  789. cd /tmp # gh will not release for repo x while inside repo y
  790. for repo in relaysrv discosrv ; do
  791. export GH_REPO="syncthing/$repo"
  792. if ! gh release view --json name "$VERSION" >/dev/null 2>&1 ; then
  793. gh release create "$VERSION" \
  794. $maybePrerelease \
  795. --title "$VERSION" \
  796. --notes "https://github.com/syncthing/syncthing/releases/tag/$VERSION"
  797. fi
  798. gh release upload --clobber "$VERSION" \
  799. $PKGS/*.asc \
  800. $PKGS/*${repo}*
  801. done
  802. env:
  803. GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
  804. #
  805. # Push Debian/APT archive
  806. #
  807. publish-apt:
  808. name: Publish APT
  809. 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'))
  810. environment: release
  811. needs:
  812. - package-debian
  813. - facts
  814. env:
  815. VERSION: ${{ needs.facts.outputs.version }}
  816. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  817. RELEASE_GENERATION: ${{ needs.facts.outputs.release-generation }}
  818. runs-on: ubuntu-latest
  819. steps:
  820. - name: Download packages
  821. uses: actions/download-artifact@v7
  822. with:
  823. name: debian-packages
  824. path: packages
  825. # Decide whether packages should go to stable, candidate or nightly
  826. - name: Pull archive
  827. uses: docker://docker.io/rclone/rclone:latest
  828. env:
  829. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  830. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  831. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  832. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  833. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  834. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  835. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  836. with:
  837. args: sync objstore:apt apt
  838. - name: Prepare packages
  839. run: |
  840. sudo chown -R $(id -u) apt/pool
  841. mv -n packages/*.deb apt/pool
  842. - name: Update archive
  843. uses: docker://ghcr.io/kastelo/ezapt:latest
  844. with:
  845. args:
  846. publish --root apt
  847. env:
  848. EZAPT_KEYRING_BASE64: ${{ secrets.APT_GPG_KEYRING_BASE64 }}
  849. - name: Push archive
  850. uses: docker://docker.io/rclone/rclone:latest
  851. env:
  852. RCLONE_CONFIG_OBJSTORE_TYPE: s3
  853. RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
  854. RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
  855. RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
  856. RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
  857. RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
  858. RCLONE_CONFIG_OBJSTORE_ACL: public-read
  859. with:
  860. args: sync -v --no-update-modtime apt objstore:apt
  861. #
  862. # Build and push (except for PRs) to GHCR.
  863. #
  864. docker-ghcr:
  865. name: Build and push Docker images (GHCR)
  866. runs-on: ubuntu-latest
  867. permissions:
  868. contents: read
  869. packages: write
  870. needs:
  871. - facts
  872. env:
  873. VERSION: ${{ needs.facts.outputs.version }}
  874. RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
  875. strategy:
  876. matrix:
  877. pkg:
  878. - syncthing
  879. - strelaysrv
  880. - stdiscosrv
  881. include:
  882. - pkg: syncthing
  883. dockerfile: Dockerfile
  884. image: syncthing
  885. - pkg: strelaysrv
  886. dockerfile: Dockerfile.strelaysrv
  887. image: relaysrv
  888. - pkg: stdiscosrv
  889. dockerfile: Dockerfile.stdiscosrv
  890. image: discosrv
  891. steps:
  892. - uses: actions/checkout@v5
  893. - uses: actions/setup-go@v6
  894. with:
  895. go-version: ${{ needs.facts.outputs.go-version }}
  896. cache: false
  897. - uses: mlugg/setup-zig@v2
  898. - uses: actions/cache@v4
  899. with:
  900. path: |
  901. ~/.cache/go-build
  902. ~/go/pkg/mod
  903. key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-docker-${{ matrix.pkg }}-${{ hashFiles('go.sum') }}
  904. - name: Build binaries (CGO)
  905. run: |
  906. mkdir bin
  907. # amd64
  908. 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 }}
  909. mv ${{ matrix.pkg }} bin/${{ matrix.pkg }}-linux-amd64
  910. # arm64
  911. go run build.go -goos linux -goarch arm64 -tags "${{env.TAGS_LINUX}}" -cc "zig cc -target aarch64-linux-musl" -no-upgrade build ${{ matrix.pkg }}
  912. mv ${{ matrix.pkg }} bin/${{ matrix.pkg }}-linux-arm64
  913. # arm
  914. 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 }}
  915. mv ${{ matrix.pkg }} bin/${{ matrix.pkg }}-linux-arm
  916. env:
  917. CGO_ENABLED: "1"
  918. BUILD_USER: docker
  919. EXTRA_LDFLAGS: "-linkmode=external -extldflags=-static"
  920. - name: Login to GHCR
  921. uses: docker/login-action@v3
  922. with:
  923. registry: ghcr.io
  924. username: ${{ github.actor }}
  925. password: ${{ secrets.GITHUB_TOKEN }}
  926. - name: Set up QEMU
  927. uses: docker/setup-qemu-action@v3
  928. - name: Set up Docker Buildx
  929. uses: docker/setup-buildx-action@v3
  930. - name: Set version tags
  931. run: |
  932. version=${VERSION#v}
  933. repo=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
  934. ref="${{github.ref_name}}"
  935. ref=${ref//\//-} # slashes to dashes
  936. # List of tags for ghcr.io
  937. if [[ $version == @([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]) ]] ; then
  938. major=${version%.*.*}
  939. minor=${version%.*}
  940. tags=$repo:$version,$repo:$major,$repo:$minor,$repo:latest
  941. elif [[ $version == *-rc.@([0-9]|[0-9][0-9]) ]] ; then
  942. tags=$repo:$version,$repo:rc
  943. elif [[ $ref == "main" ]] ; then
  944. tags=$repo:edge
  945. else
  946. tags=$repo:$ref
  947. fi
  948. echo Pushing to $tags
  949. echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV
  950. - name: Prepare context dir
  951. run: |
  952. mkdir ctx
  953. mv bin/* script ctx
  954. - name: Build and push Docker image
  955. uses: docker/build-push-action@v6
  956. with:
  957. context: ctx
  958. file: ${{ matrix.dockerfile }}
  959. platforms: linux/amd64,linux/arm64,linux/arm/7
  960. tags: ${{ env.DOCKER_TAGS }}
  961. push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
  962. labels: |
  963. org.opencontainers.image.version=${{ env.VERSION }}
  964. org.opencontainers.image.revision=${{ github.sha }}
  965. #
  966. # Sync images to Docker hub. This takes the images already pushed to GHCR
  967. # and copies them to Docker hub. Runs for releases only.
  968. #
  969. docker-hub:
  970. name: Sync images to Docker hub
  971. 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'))
  972. runs-on: ubuntu-latest
  973. needs:
  974. - docker-ghcr
  975. environment: docker
  976. env:
  977. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  978. DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
  979. steps:
  980. - uses: actions/checkout@v5
  981. - name: Sync images
  982. uses: docker://docker.io/regclient/regsync:latest
  983. with:
  984. args:
  985. -c ./.github/regsync.yml
  986. once
  987. #
  988. # Check for known vulnerabilities in Go dependencies
  989. #
  990. govulncheck:
  991. runs-on: ubuntu-latest
  992. name: Run govulncheck
  993. needs:
  994. - facts
  995. steps:
  996. - uses: actions/checkout@v5
  997. - uses: actions/setup-go@v6
  998. with:
  999. go-version: ${{ needs.facts.outputs.go-version }}
  1000. cache: false
  1001. - name: run govulncheck
  1002. run: |
  1003. go run build.go assets
  1004. go install golang.org/x/vuln/cmd/govulncheck@latest
  1005. govulncheck ./...
  1006. #
  1007. # golangci-lint runs a suite of static analysis checks on the code
  1008. #
  1009. golangci:
  1010. runs-on: ubuntu-latest
  1011. name: Run golangci-lint
  1012. if: github.event_name == 'pull_request'
  1013. steps:
  1014. - uses: actions/checkout@v5
  1015. - uses: actions/setup-go@v6
  1016. with:
  1017. go-version: 'stable'
  1018. - name: ensure asset generation
  1019. run: go run build.go assets
  1020. - name: golangci-lint
  1021. uses: golangci/golangci-lint-action@v8
  1022. with:
  1023. only-new-issues: true
  1024. #
  1025. # Meta checks for formatting, copyright, etc
  1026. #
  1027. meta:
  1028. name: Run meta checks
  1029. runs-on: ubuntu-latest
  1030. steps:
  1031. - uses: actions/checkout@v5
  1032. - uses: actions/setup-go@v6
  1033. with:
  1034. go-version: 'stable'
  1035. - run: |
  1036. go run build.go assets
  1037. go test -v ./meta