Skip to content

Commit 998fa15

Browse files
committed
chore: add various configs
1 parent 91cce67 commit 998fa15

25 files changed

+4227
-60
lines changed

.editorconfig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# EditorConfig is awesome: https://EditorConfig.org
2-
3-
# top-most EditorConfig file
41
root = true
52

63
[*]
74
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
87
indent_style = space
98
indent_size = tab
109
tab_width = 4
11-
end_of_line = crlf
1210
trim_trailing_whitespace = true
13-
insert_final_newline = true
11+
12+
[*.go]
13+
indent_style = tab
1414

1515
[*.md]
1616
trim_trailing_whitespace = false
1717

1818
[*.{yml,yaml}]
19-
indent_size = 2
19+
tab_width = 2
2020

2121
[Makefile]
2222
indent_style = tab

.github/workflows/checks.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Checks
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
name: Lint and Format Check
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v5
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version-file: go.mod
18+
cache: false
19+
20+
- name: Cache Go modules
21+
uses: actions/cache@v4
22+
with:
23+
path: |
24+
~/.cache/go-build
25+
~/go/pkg/mod
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
30+
- name: Install dependencies
31+
run: make deps
32+
33+
- name: Run linting
34+
run: make lint-dev
35+
36+
- name: Check formatting and go mod tidy
37+
run: make verify
38+
39+
security:
40+
name: Security Scan
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v5
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v5
48+
with:
49+
go-version-file: go.mod
50+
51+
- name: Install dependencies
52+
run: make deps
53+
54+
- name: Run vulnerability check
55+
run: make vuln-check
56+
57+
test:
58+
name: Test
59+
strategy:
60+
matrix:
61+
os: [ubuntu-latest, windows-latest, macos-latest]
62+
go-version: ["1.23", "1.24", "1.25"]
63+
runs-on: ${{ matrix.os }}
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v5
67+
68+
- name: Set up Go
69+
uses: actions/setup-go@v5
70+
with:
71+
go-version: ${{ matrix.go-version }}
72+
cache: false
73+
74+
- name: Cache Go modules
75+
uses: actions/cache@v4
76+
with:
77+
path: |
78+
~/.cache/go-build
79+
~/go/pkg/mod
80+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
81+
restore-keys: |
82+
${{ runner.os }}-go-${{ matrix.go-version }}-
83+
84+
- name: Install dependencies
85+
run: make deps
86+
87+
- name: Run tests with coverage
88+
run: make test-coverage
89+
90+
- name: Run benchmarks
91+
run: make benchmark
92+
93+
- name: Upload coverage to Codecov
94+
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.25'
95+
uses: codecov/codecov-action@v5
96+
with:
97+
files: ./coverage.out
98+
token: ${{ secrets.CODECOV_TOKEN }}
99+
100+
integration:
101+
name: Integration Tests
102+
runs-on: ubuntu-latest
103+
needs: [test]
104+
steps:
105+
- name: Checkout code
106+
uses: actions/checkout@v5
107+
108+
- name: Set up Go
109+
uses: actions/setup-go@v5
110+
with:
111+
go-version-file: go.mod
112+
113+
- name: Build binary
114+
run: make build
115+
116+
- name: Run integration tests
117+
run: make test-integration

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
pull_request:
7+
branches: [master, develop]
8+
9+
jobs:
10+
checks:
11+
name: Run Checks
12+
uses: ./.github/workflows/checks.yml
13+
permissions:
14+
contents: read
15+
statuses: write
16+
secrets: inherit
17+
18+
build:
19+
name: Build Cross-Platform
20+
runs-on: ubuntu-latest
21+
needs: [checks]
22+
strategy:
23+
matrix:
24+
goos: [windows]
25+
goarch: [amd64]
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v5
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version-file: go.mod
34+
35+
- name: Build optimized cross-platform binary
36+
env:
37+
GOOS: ${{ matrix.goos }}
38+
GOARCH: ${{ matrix.goarch }}
39+
run: |
40+
EXT=""
41+
if [ "$GOOS" = "windows" ]; then
42+
EXT=".exe"
43+
fi
44+
make release
45+
mv build/emojify "emojify-$GOOS-$GOARCH$EXT"
46+
47+
- name: Upload build artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: emojify-${{ matrix.goos }}-${{ matrix.goarch }}
51+
path: emojify-*
52+
retention-days: 30
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release Pre-checks
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
goreleaser-test:
9+
name: GoReleaser Test
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
cache: false
22+
23+
- name: Cache Go modules
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cache/go-build
28+
~/go/pkg/mod
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
32+
33+
- name: Install dependencies
34+
run: make deps
35+
36+
- name: Install GoReleaser
37+
uses: goreleaser/goreleaser-action@v6
38+
with:
39+
distribution: goreleaser
40+
version: "~> v2"
41+
install-only: true
42+
43+
- name: Setup Rust Toolchain
44+
uses: actions-rust-lang/setup-rust-toolchain@v1
45+
46+
- name: Cache Rust tools
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.cargo/bin
50+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
51+
52+
- name: Install Rust tools
53+
run: |
54+
if ! command -v git-cliff &> /dev/null
55+
then
56+
cargo install git-cliff --force
57+
fi
58+
59+
if ! command -v typos &> /dev/null
60+
then
61+
cargo install typos-cli --force
62+
fi
63+
64+
- name: Import GPG key
65+
uses: crazy-max/ghaction-import-gpg@v6
66+
with:
67+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
68+
69+
- name: Run GoReleaser test
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
73+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
74+
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
75+
run: |
76+
make goreleaser-test

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
checks:
11+
name: Run Checks
12+
uses: ./.github/workflows/checks.yml
13+
14+
release-prechecks:
15+
name: Release Pre-checks
16+
uses: ./.github/workflows/release-prechecks.yml
17+
secrets: inherit
18+
19+
release:
20+
name: Release
21+
runs-on: ubuntu-latest
22+
needs: [checks, release-prechecks]
23+
permissions:
24+
contents: write
25+
packages: write
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v5
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version-file: go.mod
36+
37+
- name: Install dependencies
38+
run: make deps
39+
40+
- name: Setup Rust Toolchain
41+
uses: actions-rust-lang/setup-rust-toolchain@v1
42+
43+
- name: Cache Rust tools
44+
uses: actions/cache@v4
45+
with:
46+
path: ~/.cargo/bin
47+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
48+
49+
- name: Install Rust tools
50+
run: |
51+
if ! command -v git-cliff &> /dev/null
52+
then
53+
cargo install git-cliff --force
54+
fi
55+
56+
if ! command -v typos &> /dev/null
57+
then
58+
cargo install typos-cli --force
59+
fi
60+
61+
- name: Import GPG key
62+
uses: crazy-max/ghaction-import-gpg@v6
63+
with:
64+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
65+
66+
- name: Run GoReleaser
67+
uses: goreleaser/goreleaser-action@v6
68+
with:
69+
distribution: goreleaser
70+
version: "~> v2"
71+
args: release --clean
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
75+
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
76+
77+
- name: Update GitHub Release with Release Notes
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
run: |
81+
echo "Uploading release notes to GitHub Release..."
82+
gh release edit ${{ github.ref_name }} --notes-file RELEASE_NOTES.md
83+
84+
- name: Commit Changelog
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
run: |
88+
echo "Committing updated CHANGELOG.md..."
89+
./scripts/commit-changelog.sh ${{ github.ref_name }}

0 commit comments

Comments
 (0)