Skip to content

Commit 2fdf66d

Browse files
committed
initial commit
0 parents  commit 2fdf66d

File tree

14 files changed

+1340
-0
lines changed

14 files changed

+1340
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Run command '...'
16+
2. See error
17+
18+
**Expected behavior**
19+
A clear and concise description of what you expected to happen.
20+
21+
**Environment (please complete the following information):**
22+
- OS: [e.g. Ubuntu 22.04, Windows 11, macOS 13]
23+
- mc version: [e.g. v1.0.0, run `mc version`]
24+
- Java version: [e.g. 17.0.2, run `java -version`]
25+
- Minecraft version: [e.g. 1.21.4]
26+
27+
**Output**
28+
If applicable, add the complete command output or error message.
29+
30+
```
31+
Paste command output here
32+
```
33+
34+
**Additional context**
35+
Add any other context about the problem here.
36+
37+
**Config file (if relevant)**
38+
```yaml
39+
# Paste your mc.yml content here if relevant
40+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Use case**
20+
Describe how this feature would be used and who would benefit from it.
21+
22+
**Additional context**
23+
Add any other context or screenshots about the feature request here.

.github/demo.gif

1.95 MB
Loading

.github/dependabot.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 2
2+
updates:
3+
# Go modules
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
commit-message:
10+
prefix: "deps"
11+
include: "scope"
12+
reviewers:
13+
- "Mindgamesnl"
14+
labels:
15+
- "dependencies"
16+
open-pull-requests-limit: 5
17+
18+
# GitHub Actions
19+
- package-ecosystem: "github-actions"
20+
directory: "/"
21+
schedule:
22+
interval: "weekly"
23+
day: "monday"
24+
commit-message:
25+
prefix: "ci"
26+
include: "scope"
27+
reviewers:
28+
- "Mindgamesnl"
29+
labels:
30+
- "dependencies"
31+
- "github-actions"
32+
open-pull-requests-limit: 5

.github/workflows/release.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Build and Upload Release Assets
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
BINARY_NAME: mc
9+
10+
jobs:
11+
build-and-upload:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
strategy:
16+
matrix:
17+
include:
18+
- goos: linux
19+
goarch: amd64
20+
suffix: linux-amd64
21+
- goos: windows
22+
goarch: amd64
23+
suffix: windows-amd64.exe
24+
- goos: darwin
25+
goarch: amd64
26+
suffix: darwin-amd64
27+
- goos: darwin
28+
goarch: arm64
29+
suffix: darwin-arm64
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: '1.24.5'
38+
39+
- name: Cache Go modules
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/go/pkg/mod
43+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
44+
restore-keys: |
45+
${{ runner.os }}-go-
46+
47+
- name: Get version from tag
48+
id: get_version
49+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
50+
51+
- name: Download dependencies
52+
run: go mod download
53+
54+
- name: Build binary
55+
env:
56+
GOOS: ${{ matrix.goos }}
57+
GOARCH: ${{ matrix.goarch }}
58+
CGO_ENABLED: 0
59+
run: |
60+
go build -a -installsuffix cgo -ldflags="-w -s -X main.Version=${{ steps.get_version.outputs.version }}" -o ${{ env.BINARY_NAME }}-${{ matrix.suffix }}
61+
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: ${{ env.BINARY_NAME }}-${{ matrix.suffix }}
66+
path: ${{ env.BINARY_NAME }}-${{ matrix.suffix }}
67+
68+
upload-assets:
69+
needs: build-and-upload
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: write
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Get version from tag
77+
id: get_version
78+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
79+
80+
- name: Download all artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
path: ./artifacts
84+
85+
- name: Move artifacts to release directory
86+
run: |
87+
mkdir -p release
88+
find ./artifacts -type f -name "${{ env.BINARY_NAME }}-*" -exec cp {} ./release/ \;
89+
ls -la ./release/
90+
91+
- name: Generate checksums
92+
run: |
93+
cd release
94+
sha256sum * > checksums.txt
95+
ls -la
96+
97+
- name: Upload assets to existing release
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
run: |
101+
# Upload all binaries and checksums to the existing release
102+
gh release upload ${{ github.event.release.tag_name }} ./release/* --clobber
103+
104+
- name: Update release notes with checksums
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
run: |
108+
# Get current release notes
109+
CURRENT_NOTES=$(gh release view ${{ github.event.release.tag_name }} --json body --jq '.body')
110+
111+
# Append installation instructions and checksums if not already present
112+
if ! echo "$CURRENT_NOTES" | grep -q "### Installation"; then
113+
cat > additional_notes.md << 'EOF'
114+
115+
### Installation
116+
117+
**Linux/macOS (one-liner):**
118+
```bash
119+
curl -sfL https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mc-linux-amd64 -o mc && chmod +x mc && sudo mv mc /usr/local/bin/
120+
```
121+
122+
**Windows (PowerShell):**
123+
```powershell
124+
Invoke-WebRequest -Uri "https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mc-windows-amd64.exe" -OutFile "mc.exe"
125+
```
126+
127+
### Manual Downloads
128+
- **Linux (x64):** [mc-linux-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mc-linux-amd64)
129+
- **Windows (x64):** [mc-windows-amd64.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mc-windows-amd64.exe)
130+
- **macOS (Intel):** [mc-darwin-amd64](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mc-darwin-amd64)
131+
- **macOS (Apple Silicon):** [mc-darwin-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mc-darwin-arm64)
132+
133+
## Checksums (SHA256)
134+
```
135+
$(cat release/checksums.txt)
136+
```
137+
EOF
138+
139+
# Combine current notes with additional notes
140+
echo "$CURRENT_NOTES" > combined_notes.md
141+
cat additional_notes.md >> combined_notes.md
142+
143+
# Update the release with the combined notes
144+
gh release edit ${{ github.event.release.tag_name }} --notes-file combined_notes.md
145+
fi

.github/workflows/test.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.24.5']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: ${{ matrix.go-version }}
23+
24+
- name: Cache Go modules
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/go/pkg/mod
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Download dependencies
33+
run: go mod download
34+
35+
- name: Verify dependencies
36+
run: go mod verify
37+
38+
- name: Run tests
39+
run: go test -v -race -coverprofile=coverage.out
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v5
43+
with:
44+
file: ./coverage.out
45+
flags: unittests
46+
name: codecov-umbrella
47+
48+
- name: Run go vet
49+
run: go vet ./...
50+
51+
test-build:
52+
runs-on: ubuntu-latest
53+
needs: test
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Set up Go
59+
uses: actions/setup-go@v5
60+
with:
61+
go-version: '1.24.5'
62+
63+
- name: Build for multiple platforms
64+
run: |
65+
GOOS=linux GOARCH=amd64 go build -o mc-linux-amd64
66+
GOOS=windows GOARCH=amd64 go build -o mc-windows-amd64.exe
67+
GOOS=darwin GOARCH=amd64 go build -o mc-darwin-amd64
68+
GOOS=darwin GOARCH=arm64 go build -o mc-darwin-arm64
69+
70+
- name: Test binaries
71+
run: |
72+
./mc-linux-amd64 test || echo "Java not available in CI, expected failure"
73+
file mc-*
74+
75+
integration-test:
76+
runs-on: ubuntu-latest
77+
needs: test
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Set up Go
83+
uses: actions/setup-go@v5
84+
with:
85+
go-version: '1.24.5'
86+
87+
- name: Set up Java
88+
uses: actions/setup-java@v4
89+
with:
90+
distribution: 'temurin'
91+
java-version: '17'
92+
93+
- name: Build
94+
run: go build -o mc
95+
96+
- name: Test Java validation
97+
run: ./mc test
98+
99+
- name: Test config creation
100+
run: |
101+
mkdir test-dir
102+
cd test-dir
103+
echo "1.21.4" | ../mc || true # May fail due to network or Paper API
104+
test -f mc.yml && echo "✓ Config file created" || echo "⚠ Config test skipped"
105+
test -f eula.txt && echo "✓ EULA file created" || echo "⚠ EULA test skipped"

0 commit comments

Comments
 (0)