-
Notifications
You must be signed in to change notification settings - Fork 7
120 lines (118 loc) · 3.54 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Go
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build issue-creator
run: go build .
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Test
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
env:
TEST_TOKEN: ${{ secrets.TEST_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
docker_image_test:
runs-on: ubuntu-latest
name: Test Docker Image
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check # Run https://github.com/rerost/issue-creator/blob/bf8f39be0ca7d96d22d2f946b20360978c80ea9f/action.yml#L21
# https://github.com/rerost/issue-creator-for-test/issues/102 を元にissueを作るテスト
run: |
docker build -t test .
docker run test '' rerost/issue-creator-for-test 102 true "echo 'OK'" $TEST_TOKEN false
docker run test https://github.com/rerost/issue-creator-for-test/issues/102 '' '' true "echo 'OK'" $TEST_TOKEN false
env:
TEST_TOKEN: ${{ secrets.TEST_TOKEN }}
docker_build_and_push:
name: Docker Build and Push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/rerost/issue-creator
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
check-generate:
name: Check Go Generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Check Go Generate
run: go generate ./... && go mod tidy && git diff --exit-code
check-goreleaser:
name: Check GoReleaser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: check
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
check-renovate-config:
name: Check Renovate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Renovate config
run: npx --yes --package renovate -- renovate-config-validator --strict
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60