Skip to content

Commit 439b376

Browse files
committed
feat: add SQLite tracking, gain command, and CI/CD
- Add SQLite tracking for all commands (90-day history) - Add rtk gain command with ASCII graph visualization - Add config.rs for TOML configuration support - Integrate tracking in all command modules - Add CI/CD workflow for multi-platform releases (deb, rpm, win, mac) - Add LICENSE file and improve .gitignore
1 parent 3bd5021 commit 439b376

23 files changed

Lines changed: 1471 additions & 490 deletions

.github/workflows/release.yml

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
os: ubuntu-latest
4040
archive: tar.gz
4141
cross: true
42+
# Windows
43+
- target: x86_64-pc-windows-msvc
44+
os: windows-latest
45+
archive: zip
4246

4347
steps:
4448
- name: Checkout
@@ -57,24 +61,80 @@ jobs:
5761
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
5862
5963
- name: Build
60-
run: |
61-
cargo build --release --target ${{ matrix.target }}
64+
run: cargo build --release --target ${{ matrix.target }}
6265

6366
- name: Package (Unix)
67+
if: matrix.os != 'windows-latest'
6468
run: |
6569
cd target/${{ matrix.target }}/release
6670
tar -czvf ../../../rtk-${{ matrix.target }}.${{ matrix.archive }} rtk
6771
cd ../../..
6872
73+
- name: Package (Windows)
74+
if: matrix.os == 'windows-latest'
75+
run: |
76+
cd target/${{ matrix.target }}/release
77+
7z a ../../../rtk-${{ matrix.target }}.${{ matrix.archive }} rtk.exe
78+
cd ../../..
79+
6980
- name: Upload artifact
7081
uses: actions/upload-artifact@v4
7182
with:
7283
name: rtk-${{ matrix.target }}
7384
path: rtk-${{ matrix.target }}.${{ matrix.archive }}
7485

86+
build-deb:
87+
name: Build DEB package
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Install Rust
94+
uses: dtolnay/rust-action@stable
95+
96+
- name: Install cargo-deb
97+
run: cargo install cargo-deb
98+
99+
- name: Build DEB
100+
run: cargo deb
101+
102+
- name: Upload DEB
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: rtk-deb
106+
path: target/debian/*.deb
107+
108+
build-rpm:
109+
name: Build RPM package
110+
runs-on: ubuntu-latest
111+
container: fedora:latest
112+
steps:
113+
- name: Checkout
114+
uses: actions/checkout@v4
115+
116+
- name: Install dependencies
117+
run: |
118+
dnf install -y rust cargo rpm-build
119+
120+
- name: Install cargo-generate-rpm
121+
run: cargo install cargo-generate-rpm
122+
123+
- name: Build release
124+
run: cargo build --release
125+
126+
- name: Generate RPM
127+
run: cargo generate-rpm
128+
129+
- name: Upload RPM
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: rtk-rpm
133+
path: target/generate-rpm/*.rpm
134+
75135
release:
76136
name: Create Release
77-
needs: build
137+
needs: [build, build-deb, build-rpm]
78138
runs-on: ubuntu-latest
79139
steps:
80140
- name: Checkout
@@ -94,17 +154,15 @@ jobs:
94154
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
95155
fi
96156
157+
- name: Flatten artifacts
158+
run: |
159+
mkdir -p release
160+
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \) -exec cp {} release/ \;
161+
97162
- name: Create checksums
98163
run: |
99-
cd artifacts
100-
for dir in */; do
101-
cd "$dir"
102-
for file in *; do
103-
sha256sum "$file" >> ../checksums.txt
104-
done
105-
cd ..
106-
done
107-
mv checksums.txt ../
164+
cd release
165+
sha256sum * > checksums.txt
108166
109167
- name: Create Release
110168
uses: softprops/action-gh-release@v2
@@ -114,9 +172,7 @@ jobs:
114172
draft: false
115173
prerelease: false
116174
generate_release_notes: true
117-
files: |
118-
artifacts/**/*
119-
checksums.txt
175+
files: release/*
120176
env:
121177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122178

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1+
# Build
12
/target
3+
4+
# Environment & Secrets
5+
.env
6+
.env.*
7+
*.pem
8+
*.key
9+
*.crt
10+
*.p12
11+
credentials.json
12+
secrets.json
13+
*.secret
14+
15+
# IDE
16+
.idea/
17+
.vscode/
18+
*.swp
19+
*.swo
20+
*~
21+
22+
# OS
23+
.DS_Store
24+
Thumbs.db
25+
26+
# Test artifacts
27+
*.cast.bak
28+
29+
# SQLite databases
30+
*.db
31+
*.sqlite
32+
*.sqlite3
33+
rtk_tracking.db

0 commit comments

Comments
 (0)