Skip to content

Commit 020b3bf

Browse files
authored
Merge pull request #1 from masato-hi/feat/go
🎉 [feat] goで再実装する
2 parents b545072 + 1e2df0a commit 020b3bf

File tree

22 files changed

+772
-1009
lines changed

22 files changed

+772
-1009
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Release
2+
13
on:
24
push:
35
tags:
@@ -6,55 +8,17 @@ on:
68
jobs:
79
release:
810
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
BUILD_TARGET: [x86_64-unknown-linux-gnu]
1211
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/cache@v4
12+
- uses: actions/checkout@v5
13+
- name: Set up Go
14+
uses: actions/setup-go@v5
1515
with:
16-
path: |
17-
~/.cargo/bin/
18-
~/.cargo/registry/index/
19-
~/.cargo/registry/cache/
20-
~/.cargo/git/db/
21-
target/
22-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
23-
24-
- name: Set environment variable
25-
run: |
26-
PACKAGE_NAME=$(echo ${{ github.repository }} | sed -e "s#.*/##")
27-
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
28-
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> "$GITHUB_ENV"
29-
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
30-
31-
- name: Run tests
32-
run: cargo test
33-
34-
- name: Build
35-
run: cargo build --release --target ${{ matrix.BUILD_TARGET }}
36-
37-
- name: Upload release artifact
38-
uses: actions/upload-artifact@v4
16+
go-version: '1.25'
17+
cache: true
18+
- name: Run GoReleaser
19+
uses: goreleaser/goreleaser-action@v6
3920
with:
40-
name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }}
41-
path: target/${{ matrix.BUILD_TARGET }}/release/${{ env.PACKAGE_NAME }}
42-
43-
- name: Download release artifact
44-
uses: actions/download-artifact@v4
45-
with:
46-
name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }}
47-
path: ./artifacts/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }}
48-
49-
- name: Compress release artifact
50-
run: |
51-
BASENAME="${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.BUILD_TARGET }}"
52-
mkdir -p ./releases/
53-
chmod +x "./artifacts/${BASENAME}/${PACKAGE_NAME}"
54-
tar -zcf "./releases/${BASENAME}.tar.gz" -C "./artifacts/${BASENAME}" $(ls -A "./artifacts/${BASENAME}")
55-
56-
- name: Upload built binary to GitHub releases
57-
run: |
58-
gh release upload ${VERSION} ./releases/*
21+
distribution: goreleaser
22+
args: release --clean
5923
env:
60-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version: '1.25'
17+
cache: true
18+
- name: Run tests
19+
run: make test

.gitignore

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
1-
# Generated by Cargo
2-
# will have compiled files and executables
3-
debug/
4-
target/
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
510

6-
# These are backup files generated by rustfmt
7-
**/*.rs.bk
11+
# Test binary, built with `go test -c`
12+
*.test
813

9-
# MSVC Windows builds of rustc generate these, which store debugging information
10-
*.pdb
14+
# Code coverage profiles and other test artifacts
15+
*.out
16+
coverage.*
17+
*.coverprofile
18+
profile.cov
1119

12-
# RustRover
13-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
14-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
15-
# and can be added to the global gitignore or merged into this file. For a more nuclear
16-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
17-
#.idea/
20+
# Dependency directories (remove the comment below to include it)
21+
# vendor/
1822

19-
# Visual Studio Code
20-
/.vscode
23+
# Go workspace file
24+
go.work
25+
go.work.sum
2126

22-
# Added by cargo
27+
# env file
28+
.env
2329

24-
/target
30+
# Editor/IDE
31+
# .idea/
32+
# .vscode/

0 commit comments

Comments
 (0)