Skip to content

Commit 85dde8e

Browse files
committed
Add monthly Go update workflow and shared setup action
1 parent 45722e9 commit 85dde8e

3 files changed

Lines changed: 80 additions & 45 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Common Setup'
2+
description: 'Install Just and Go'
3+
4+
inputs:
5+
go-version:
6+
description: 'Go version to install (defaults to version from go.mod)'
7+
required: false
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Install Just
13+
uses: extractions/setup-just@v3
14+
env:
15+
GITHUB_TOKEN: ${{ github.token }}
16+
- name: Setup Go
17+
uses: actions/setup-go@v6
18+
with:
19+
go-version: ${{ inputs.go-version }}
20+
go-version-file: ${{ inputs.go-version && '' || 'go.mod' }}

.github/workflows/test.yml

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,40 @@ on:
77

88
jobs:
99
lint:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v5
14-
with:
15-
fetch-depth: 0
16-
- name: Install Just
17-
uses: extractions/setup-just@v3
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20-
- name: Setup Go
21-
uses: actions/setup-go@v6
22-
with:
23-
go-version-file: "go.mod"
24-
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v8
26-
with:
27-
verify: false
28-
- run: just lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
- name: Run Common Setup
17+
uses: ./.github/actions/setup
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v8
20+
with:
21+
verify: false
22+
- run: just lint
2923

3024
test:
3125
runs-on: ubuntu-latest
3226
steps:
3327
- name: Checkout code
34-
uses: actions/checkout@v5
28+
uses: actions/checkout@v6
3529
with:
3630
fetch-depth: 0
37-
- name: Install Just
38-
uses: extractions/setup-just@v3
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
- name: Setup Go
42-
uses: actions/setup-go@v6
43-
with:
44-
go-version-file: "go.mod"
31+
- name: Run Common Setup
32+
uses: ./.github/actions/setup
4533
- run: just test
4634

4735
test-integration:
4836
runs-on: ubuntu-latest
4937
steps:
5038
- name: Checkout code
51-
uses: actions/checkout@v5
39+
uses: actions/checkout@v6
5240
with:
5341
fetch-depth: 0
54-
- name: Install Just
55-
uses: extractions/setup-just@v3
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
- name: Run Common Setup
43+
uses: ./.github/actions/setup
5844
- run: just test-integration
5945

6046
test-cross-platform:
@@ -66,18 +52,10 @@ jobs:
6652
test: ['test', 'build', 'test-cpu-detection', 'test-os-detection']
6753
steps:
6854
- name: Checkout code
69-
uses: actions/checkout@v5
70-
- name: Install Just
71-
uses: extractions/setup-just@v3
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
- name: Setup Go
75-
uses: actions/setup-go@v6
76-
with:
77-
go-version-file: "go.mod"
78-
- name: Update APT
79-
run: sudo apt-get update
55+
uses: actions/checkout@v6
56+
- name: Run Common Setup
57+
uses: ./.github/actions/setup
8058
- name: Install Qemu
81-
run: sudo apt-get install qemu-user
59+
run: sudo apt-get update && sudo apt-get install -y qemu-user
8260
- name: ${{ matrix.test }} on ${{ matrix.arch }}
8361
run: just ${{ matrix.arch }} ${{ matrix.test }}

.github/workflows/update-go.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Update Go
2+
3+
on:
4+
schedule:
5+
- cron: "0 2 1 * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v6
14+
with:
15+
token: ${{ secrets.MAINTENANCE_TOKEN }}
16+
fetch-depth: 0
17+
- name: Run Common Setup
18+
uses: ./.github/actions/setup
19+
with:
20+
go-version: stable
21+
- name: Install golangci-lint
22+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
23+
- name: Install Qemu
24+
run: sudo apt-get update && sudo apt-get install -y qemu-user
25+
- name: Update Go dependencies
26+
run: just update
27+
- name: Format code
28+
run: just fmt
29+
- name: Run all tests
30+
run: just test-all
31+
- name: Commit updates
32+
uses: stefanzweifel/git-auto-commit-action@v7
33+
with:
34+
commit_message: Update Go dependencies
35+
commit_user_name: Maintenance Bob
36+
commit_user_email: bob@archlinux.de
37+
commit_author: Maintenance Bob <bob@archlinux.de>

0 commit comments

Comments
 (0)