-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (115 loc) · 3.23 KB
/
test.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
121
122
123
124
125
126
127
128
129
name: Test
on:
pull_request:
push:
permissions:
contents: write
packages: write
issues: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.0
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
local-prefix: github.com/jelloeater/stampy
threshold-file: 0
threshold-package: 0
threshold-total: 60
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges
# git checkout --orphan badges
# git rm -rf .
# rm -f .gitignore
# echo '# Badges' > README.md
# git add README.md
# git commit -m 'init'
# git push origin badges
goreleaser:
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install Deps
run: |
sudo apt-get install tree git-extras -y
- name: Release config
run: |
cat << EOF > .goreleaser-github.yaml
project_name: stampy
version: 2
builds:
- env: [CGO_ENABLED=0]
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
nfpms:
-
maintainer: Jelloeater <[email protected]>
bindir: /usr/local/bin
description: Copy formatted timestamp to system clipboard
homepage: https://github.com/Jelloeater/stampy
license: MIT
formats:
- deb
- rpm
- apk
- termux.deb
- archlinux
- ipk
EOF
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "~> v2"
args: release --clean --verbose --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: List Dist
run: |
tree dist
- name: Add changelog
run: |
git-changelog -a -x -t >> dist/CHANGELOG.md
- name: Generate artifact name
id: artifact_name
run: |
REPO_NAME=${GITHUB_REPOSITORY##*/}
SHORT_SHA=${GITHUB_SHA::7}
ARTIFACT_NAME="${REPO_NAME}-${GITHUB_REF_NAME}-${SHORT_SHA}"
echo "name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
- name: Upload Dist
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact_name.outputs.name }}
path: dist/*
retention-days: 14