Skip to content

Commit 8311be1

Browse files
authored
chore: improvements to ci (#673)
1 parent 4481852 commit 8311be1

17 files changed

+439
-253
lines changed

.github/.kodiak.toml

-8
This file was deleted.

.github/dependabot.yml

-15
This file was deleted.

.github/workflows/pull_request_target_opened.yml .github/workflows/assign_labels.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request_target:
44
types: [opened]
55

6-
name: "pull_request_target_opened"
6+
name: "assign labels"
77
jobs:
88
# labeler will label pull requests based on their title.
99
# the configuration is at .github/labeler.yml.
@@ -14,4 +14,4 @@ jobs:
1414
name: Label Pull Request
1515
uses: jimschubert/labeler-action@v2
1616
with:
17-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
17+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/checks.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: "check and build"
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
tests:
11+
uses: ./.github/workflows/wf_check.yaml
12+
13+
build_artifacts:
14+
uses: ./.github/workflows/wf_build_artifacts.yaml
15+
with:
16+
VERSION: ${{ github.sha }}
17+
secrets:
18+
CERT_FULL_CHAIN: ${{ secrets.CERT_FULL_CHAIN }}
19+
CERT_PRIV_KEY: ${{ secrets.CERT_PRIV_KEY }}
20+

.github/workflows/push.yml

-104
This file was deleted.

.github/workflows/release.yaml

+20-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# .github/workflows/release.yaml
1+
---
22
on:
33
release:
44
types: [published]
@@ -11,17 +11,24 @@ jobs:
1111
id-token: write
1212
contents: write
1313
steps:
14-
- uses: actions/[email protected]
15-
16-
- name: Get go.mod details
17-
18-
id: go-mod-details
14+
- uses: actions/checkout@v3
1915

20-
- name: Install Go
21-
uses: actions/setup-go@v4
16+
- uses: nixbuild/nix-quick-install-action@v22
17+
with:
18+
nix_version: 2.14.1
19+
nix_conf: |
20+
experimental-features = nix-command flakes
21+
sandbox = false
22+
substituters = https://cache.nixos.org/?priority=40
23+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
24+
builders-use-substitutes = true
25+
extra-platforms = aarch64-linux
2226
27+
- name: Cache nix store
28+
uses: actions/cache@v3
2329
with:
24-
go-version: ${{ steps.go-mod-details.outputs.go_version }}
30+
path: /nix
31+
key: nix-build-${{ hashFiles('flake.nix', 'flake.lock', '**.nix') }}
2532

2633
- name: place let's encrypt cert
2734
run: |
@@ -33,13 +40,10 @@ jobs:
3340
EOF
3441
shell: bash
3542

36-
- name: GoReleaser
37-
uses: goreleaser/[email protected]
38-
with:
39-
version: latest
40-
args: release --skip-validate
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
- name: "Build artifact"
44+
run: |
45+
export GORELEASER_CURRENT_TAG=${{ steps.vars.outputs.VERSION }}
46+
nix develop .\#cibuild -c goreleaser release --skip-validate
4347
4448
- name: Upload assets
4549
shell: bash

.github/workflows/release_drafter.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "release drafter"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
# draft your next release notes as pull requests are merged into "master"
9+
# the configuration is at /.github/release-drafter.yml.
10+
update_release_draft:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: release-drafter/release-drafter@v5
14+
with:
15+
config-name: release-drafter.yml
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
on:
3+
workflow_call:
4+
inputs:
5+
GIT_REF:
6+
type: string
7+
required: false
8+
VERSION:
9+
type: string
10+
required: true
11+
secrets:
12+
CERT_FULL_CHAIN:
13+
required: true
14+
CERT_PRIV_KEY:
15+
required: true
16+
17+
jobs:
18+
artifacts:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: "Check out repository"
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
ref: ${{ inputs.GIT_REF }}
27+
submodules: true
28+
29+
- uses: nixbuild/nix-quick-install-action@v22
30+
with:
31+
nix_version: 2.14.1
32+
nix_conf: |
33+
experimental-features = nix-command flakes
34+
sandbox = false
35+
substituters = https://cache.nixos.org/?priority=40
36+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
37+
builders-use-substitutes = true
38+
extra-platforms = aarch64-linux
39+
40+
- name: Cache nix store
41+
uses: actions/cache@v3
42+
with:
43+
path: /nix
44+
key: nix-build-${{ hashFiles('flake.nix', 'flake.lock', '**.nix') }}
45+
- name: Compute common env vars
46+
id: vars
47+
run: |
48+
echo "VERSION=$(make get-version VERSION=v0.0.0-${{ inputs.VERSION }})" >> $GITHUB_OUTPUT
49+
50+
- name: place let's encrypt cert
51+
run: |
52+
cat <<EOF > ssl/.ssl/fullchain.pem
53+
${{ secrets.CERT_FULL_CHAIN }}
54+
EOF
55+
cat <<EOF > ssl/.ssl/privkey.pem
56+
${{ secrets.CERT_PRIV_KEY }}
57+
EOF
58+
shell: bash
59+
60+
- name: "Build artifact"
61+
run: |
62+
export GORELEASER_CURRENT_TAG=${{ steps.vars.outputs.VERSION }}
63+
nix develop .\#cibuild -c goreleaser release --skip-validate
64+
65+
- name: "Push artifact to artifact repository"
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: cli-${{ steps.vars.outputs.VERSION }}-darwin-arm64.tar.gz
69+
path: dist/cli-${{ steps.vars.outputs.VERSION }}-darwin-arm64.tar.gz
70+
retention-days: 7
71+
72+
- name: "Push artifact to artifact repository"
73+
uses: actions/upload-artifact@v3
74+
with:
75+
name: cli-${{ steps.vars.outputs.VERSION }}-darwin-amd64.tar.gz
76+
path: dist/cli-${{ steps.vars.outputs.VERSION }}-darwin-amd64.tar.gz
77+
retention-days: 7
78+
79+
- name: "Push artifact to artifact repository"
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: cli-${{ steps.vars.outputs.VERSION }}-linux-arm64.tar.gz
83+
path: dist/cli-${{ steps.vars.outputs.VERSION }}-linux-arm64.tar.gz
84+
retention-days: 7
85+
86+
- name: "Push artifact to artifact repository"
87+
uses: actions/upload-artifact@v3
88+
with:
89+
name: cli-${{ steps.vars.outputs.VERSION }}-linux-amd64.tar.gz
90+
path: dist/cli-${{ steps.vars.outputs.VERSION }}-linux-amd64.tar.gz
91+
retention-days: 7

.github/workflows/wf_check.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
on:
3+
workflow_call:
4+
inputs:
5+
GIT_REF:
6+
type: string
7+
required: false
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: "Check out repository"
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
ref: ${{ inputs.GIT_REF }}
19+
submodules: true
20+
21+
- uses: nixbuild/nix-quick-install-action@v22
22+
with:
23+
nix_version: 2.14.1
24+
nix_conf: |
25+
experimental-features = nix-command flakes
26+
sandbox = false
27+
substituters = https://cache.nixos.org/?priority=40
28+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
29+
builders-use-substitutes = true
30+
extra-platforms = aarch64-linux
31+
32+
- name: Cache nix store
33+
uses: actions/cache@v3
34+
with:
35+
path: /nix
36+
key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock', '**.nix') }}
37+
38+
- name: "Run checks"
39+
run: make check

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ generate-changelog.sh
4141
/.idea
4242
/.vscode
4343
letsencrypt/*
44+
result
45+
dist/

.goreleaser.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ builds:
1515
goarch: arm64
1616
archives:
1717
- name_template: "{{ .ProjectName }}-v{{.Version}}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
18-
replacements:
19-
darwin: "darwin"
20-
linux: "linux"
21-
windows: "windows"
22-
386: "386"
23-
amd64: "amd64"
18+
rlcp: true
2419
format_overrides:
2520
- goos: "windows"
2621
format: "zip"

0 commit comments

Comments
 (0)