Skip to content

Commit a5b051d

Browse files
authored
Port complete boundary implementation (#38)
1 parent 1e687be commit a5b051d

37 files changed

+2072
-1847
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,11 @@ name: Build Binaries
33
on:
44
push:
55
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
86

97
jobs:
108
build:
11-
name: Build Cross-Platform Binaries
9+
name: Build All Platforms
1210
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
include:
16-
# Linux builds
17-
- goos: linux
18-
goarch: amd64
19-
name: jail-linux-amd64
20-
- goos: linux
21-
goarch: arm64
22-
name: jail-linux-arm64
23-
# macOS builds
24-
- goos: darwin
25-
goarch: amd64
26-
name: jail-darwin-amd64
27-
- goos: darwin
28-
goarch: arm64
29-
name: jail-darwin-arm64
3011

3112
steps:
3213
- name: Check out code
@@ -48,33 +29,38 @@ jobs:
4829
restore-keys: |
4930
${{ runner.os }}-go-
5031
51-
- name: Download dependencies
52-
run: go mod download
32+
- name: Download and verify dependencies
33+
run: make deps
5334

54-
- name: Verify dependencies
55-
run: go mod verify
35+
- name: Build all platforms
36+
run: make build-all
5637

57-
- name: Build binary
58-
run: |
59-
# Set target for cross-compilation
60-
export GOOS=${{ matrix.goos }}
61-
export GOARCH=${{ matrix.goarch }}
62-
export CGO_ENABLED=0
63-
64-
# Add version info if available
65-
VERSION="dev-${{ github.sha }}"
66-
if [ "${{ github.ref_type }}" = "tag" ]; then
67-
VERSION="${{ github.ref_name }}"
68-
fi
69-
70-
# Build using Go directly for cross-compilation
71-
go build -ldflags="-s -w -X main.version=$VERSION" -o ${{ matrix.name }} ./cmd/jail
38+
- name: Upload Linux x64 binary
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: boundary-linux-amd64
42+
path: build/boundary-linux-amd64
43+
retention-days: 30
44+
45+
- name: Upload Linux ARM64 binary
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: boundary-linux-arm64
49+
path: build/boundary-linux-arm64
50+
retention-days: 30
51+
52+
- name: Upload macOS Intel binary
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: boundary-darwin-amd64
56+
path: build/boundary-darwin-amd64
57+
retention-days: 30
7258

73-
- name: Upload binary as artifact
59+
- name: Upload macOS Apple Silicon binary
7460
uses: actions/upload-artifact@v4
7561
with:
76-
name: ${{ matrix.name }}
77-
path: ${{ matrix.name }}
62+
name: boundary-darwin-arm64
63+
path: build/boundary-darwin-arm64
7864
retention-days: 30
7965

8066
summary:
@@ -92,14 +78,11 @@ jobs:
9278
echo "" >> $GITHUB_STEP_SUMMARY
9379
echo "### 📦 Available Binaries" >> $GITHUB_STEP_SUMMARY
9480
echo "" >> $GITHUB_STEP_SUMMARY
95-
echo "- 🐧 **Linux (x64)**: jail-linux-amd64" >> $GITHUB_STEP_SUMMARY
96-
echo "- 🐧 **Linux (ARM64)**: jail-linux-arm64" >> $GITHUB_STEP_SUMMARY
97-
echo "- 🍎 **macOS (Intel)**: jail-darwin-amd64" >> $GITHUB_STEP_SUMMARY
98-
echo "- 🍎 **macOS (Apple Silicon)**: jail-darwin-arm64" >> $GITHUB_STEP_SUMMARY
81+
echo "- 🐧 **Linux (x64)**: boundary-linux-amd64" >> $GITHUB_STEP_SUMMARY
82+
echo "- 🐧 **Linux (ARM64)**: boundary-linux-arm64" >> $GITHUB_STEP_SUMMARY
83+
echo "- 🍎 **macOS (Intel)**: boundary-darwin-amd64" >> $GITHUB_STEP_SUMMARY
84+
echo "- 🍎 **macOS (Apple Silicon)**: boundary-darwin-arm64" >> $GITHUB_STEP_SUMMARY
9985
echo "" >> $GITHUB_STEP_SUMMARY
10086
echo "### 📎 Download Instructions" >> $GITHUB_STEP_SUMMARY
10187
echo "" >> $GITHUB_STEP_SUMMARY
102-
echo "1. Go to the **Actions** tab" >> $GITHUB_STEP_SUMMARY
103-
echo "2. Click on this workflow run" >> $GITHUB_STEP_SUMMARY
104-
echo "3. Scroll down to **Artifacts** section" >> $GITHUB_STEP_SUMMARY
105-
echo "4. Download the binary for your platform" >> $GITHUB_STEP_SUMMARY
88+
echo "Artifacts can be downloaded from the [Actions tab](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." >> $GITHUB_STEP_SUMMARY

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ jobs:
3535
restore-keys: |
3636
${{ runner.os }}-go-
3737
38-
- name: Download dependencies
39-
run: go mod download
40-
41-
- name: Verify dependencies
42-
run: go mod verify
38+
- name: Download and verify dependencies
39+
run: make deps
4340

4441
- name: Run tests
4542
run: make test

.github/workflows/release.yml

Lines changed: 42 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,8 @@ on:
88

99
jobs:
1010
build:
11-
name: Build Binaries
11+
name: Build All Platforms
1212
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
include:
16-
# Linux builds
17-
- goos: linux
18-
goarch: amd64
19-
name: jail-linux-amd64
20-
- goos: linux
21-
goarch: arm64
22-
name: jail-linux-arm64
23-
# macOS builds
24-
- goos: darwin
25-
goarch: amd64
26-
name: jail-darwin-amd64
27-
- goos: darwin
28-
goarch: arm64
29-
name: jail-darwin-arm64
3013

3114
steps:
3215
- name: Check out code
@@ -48,27 +31,38 @@ jobs:
4831
restore-keys: |
4932
${{ runner.os }}-go-
5033
51-
- name: Download dependencies
52-
run: go mod download
34+
- name: Download and verify dependencies
35+
run: make deps
5336

54-
- name: Verify dependencies
55-
run: go mod verify
37+
- name: Build all platforms
38+
run: make build-all
5639

57-
- name: Build binary
58-
run: |
59-
# Set target for cross-compilation
60-
export GOOS=${{ matrix.goos }}
61-
export GOARCH=${{ matrix.goarch }}
62-
export CGO_ENABLED=0
63-
64-
# Build using Go directly for cross-compilation
65-
go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o ${{ matrix.name }} ./cmd/jail
40+
- name: Upload Linux x64 binary
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: boundary-linux-amd64
44+
path: build/boundary-linux-amd64
45+
retention-days: 7
46+
47+
- name: Upload Linux ARM64 binary
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: boundary-linux-arm64
51+
path: build/boundary-linux-arm64
52+
retention-days: 7
53+
54+
- name: Upload macOS Intel binary
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: boundary-darwin-amd64
58+
path: build/boundary-darwin-amd64
59+
retention-days: 7
6660

67-
- name: Upload binary as artifact
61+
- name: Upload macOS Apple Silicon binary
6862
uses: actions/upload-artifact@v4
6963
with:
70-
name: ${{ matrix.name }}
71-
path: ${{ matrix.name }}
64+
name: boundary-darwin-arm64
65+
path: build/boundary-darwin-arm64
7266
retention-days: 7
7367

7468
release:
@@ -81,55 +75,31 @@ jobs:
8175
- name: Check out code
8276
uses: actions/checkout@v4
8377

78+
- name: Set up Go
79+
uses: actions/setup-go@v5
80+
with:
81+
go-version: '1.25'
82+
check-latest: true
83+
8484
- name: Download all artifacts
8585
uses: actions/download-artifact@v4
8686
with:
8787
path: ./binaries
8888

8989
- name: Prepare release assets
9090
run: |
91-
cd binaries
92-
# Create compressed archives for each binary
93-
for dir in */; do
94-
binary_name=$(basename "$dir")
95-
cd "$dir"
96-
# Unix: create tar.gz
97-
tar -czf "../${binary_name}.tar.gz" "$binary_name"
98-
cd ..
99-
done
91+
# Create archives directly from artifacts using make target
92+
make release-archives
93+
10094
# List all release assets
101-
ls -la *.tar.gz
102-
103-
- name: Generate release notes
104-
id: release_notes
105-
run: |
106-
echo "## 🚀 Release ${{ github.ref_name }}" > release_notes.md
107-
echo "" >> release_notes.md
108-
echo "### 📦 Downloads" >> release_notes.md
109-
echo "" >> release_notes.md
110-
echo "Choose the appropriate binary for your platform:" >> release_notes.md
111-
echo "" >> release_notes.md
112-
echo "- **Linux (x64)**: \`jail-linux-amd64.tar.gz\`" >> release_notes.md
113-
echo "- **Linux (ARM64)**: \`jail-linux-arm64.tar.gz\`" >> release_notes.md
114-
echo "- **macOS (Intel)**: \`jail-darwin-amd64.tar.gz\`" >> release_notes.md
115-
echo "- **macOS (Apple Silicon)**: \`jail-darwin-arm64.tar.gz\`" >> release_notes.md
116-
echo "" >> release_notes.md
117-
echo "### 🛠️ Installation" >> release_notes.md
118-
echo "" >> release_notes.md
119-
echo "1. Download the appropriate binary for your platform" >> release_notes.md
120-
echo "2. Extract the archive" >> release_notes.md
121-
echo "3. Make the binary executable (Unix): `chmod +x jail`" >> release_notes.md
122-
echo "4. Move to your PATH: `sudo mv jail /usr/local/bin/` (Unix)" >> release_notes.md
123-
echo "" >> release_notes.md
124-
echo "### ✅ Verification" >> release_notes.md
125-
echo "" >> release_notes.md
126-
echo "Verify installation: `jail --help`" >> release_notes.md
95+
ls -la archives/*.tar.gz
12796
12897
- name: Create GitHub Release
12998
uses: softprops/action-gh-release@v2
13099
with:
131-
files: |
132-
binaries/*.tar.gz
133-
body_path: release_notes.md
100+
files: 'archives/*.tar.gz'
101+
draft: false
102+
prerelease: ${{ contains(github.ref_name, '-') }}
103+
generate_release_notes: true
134104
env:
135105
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

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

0 commit comments

Comments
 (0)