Skip to content

Commit 83daad6

Browse files
committed
ci: add ci
1 parent f6e4a4f commit 83daad6

File tree

3 files changed

+269
-2
lines changed

3 files changed

+269
-2
lines changed

.github/workflows/ci.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
SQLX_OFFLINE: true
12+
13+
jobs:
14+
test:
15+
name: Test
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
27+
- name: Cache cargo registry
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.cargo/registry
31+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
32+
33+
- name: Cache cargo index
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.cargo/git
37+
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
38+
39+
- name: Cache target directory
40+
uses: actions/cache@v4
41+
with:
42+
path: target
43+
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
44+
45+
- name: Run tests
46+
run: cargo test --verbose
47+
48+
- name: Run clippy
49+
run: cargo clippy -- -D warnings
50+
51+
build:
52+
name: Build
53+
runs-on: ${{ matrix.os }}
54+
strategy:
55+
matrix:
56+
os: [ubuntu-latest, windows-latest, macos-latest]
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v4
60+
61+
- name: Install Rust
62+
uses: dtolnay/rust-toolchain@stable
63+
64+
- name: Cache cargo registry
65+
uses: actions/cache@v4
66+
with:
67+
path: ~/.cargo/registry
68+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
69+
70+
- name: Cache cargo index
71+
uses: actions/cache@v4
72+
with:
73+
path: ~/.cargo/git
74+
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
75+
76+
- name: Cache target directory
77+
uses: actions/cache@v4
78+
with:
79+
path: target
80+
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
81+
82+
- name: Build
83+
run: cargo build --release --verbose
84+
85+
fmt:
86+
name: Format
87+
runs-on: ubuntu-latest
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v4
91+
92+
- name: Install Rust
93+
uses: dtolnay/rust-toolchain@stable
94+
with:
95+
components: rustfmt
96+
97+
- name: Check formatting
98+
run: cargo fmt -- --check

.github/workflows/release.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
SQLX_OFFLINE: true
11+
12+
jobs:
13+
create-release:
14+
name: Create Release
15+
runs-on: ubuntu-latest
16+
outputs:
17+
upload_url: ${{ steps.create_release.outputs.upload_url }}
18+
version: ${{ steps.get_version.outputs.version }}
19+
steps:
20+
- name: Get version from tag
21+
id: get_version
22+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
23+
24+
- name: Create Release
25+
id: create_release
26+
uses: actions/create-release@v1
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
with:
30+
tag_name: ${{ github.ref }}
31+
release_name: Release ${{ github.ref }}
32+
draft: false
33+
prerelease: false
34+
35+
build:
36+
name: Build ${{ matrix.target }}
37+
needs: create-release
38+
runs-on: ${{ matrix.os }}
39+
strategy:
40+
matrix:
41+
include:
42+
- os: ubuntu-latest
43+
target: x86_64-unknown-linux-gnu
44+
artifact_name: tari-advent
45+
asset_name: tari-advent-linux-x86_64
46+
- os: ubuntu-latest
47+
target: x86_64-unknown-linux-musl
48+
artifact_name: tari-advent
49+
asset_name: tari-advent-linux-x86_64-musl
50+
- os: windows-latest
51+
target: x86_64-pc-windows-msvc
52+
artifact_name: tari-advent.exe
53+
asset_name: tari-advent-windows-x86_64.exe
54+
- os: macos-latest
55+
target: x86_64-apple-darwin
56+
artifact_name: tari-advent
57+
asset_name: tari-advent-macos-x86_64
58+
- os: macos-latest
59+
target: aarch64-apple-darwin
60+
artifact_name: tari-advent
61+
asset_name: tari-advent-macos-aarch64
62+
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
67+
- name: Install Rust
68+
uses: dtolnay/rust-toolchain@stable
69+
with:
70+
targets: ${{ matrix.target }}
71+
72+
- name: Install musl tools (Linux musl only)
73+
if: matrix.target == 'x86_64-unknown-linux-musl'
74+
run: |
75+
sudo apt-get update
76+
sudo apt-get install -y musl-tools
77+
78+
- name: Cache cargo registry
79+
uses: actions/cache@v4
80+
with:
81+
path: ~/.cargo/registry
82+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
83+
84+
- name: Cache cargo index
85+
uses: actions/cache@v4
86+
with:
87+
path: ~/.cargo/git
88+
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
89+
90+
- name: Cache target directory
91+
uses: actions/cache@v4
92+
with:
93+
path: target
94+
key: ${{ runner.os }}-${{ matrix.target }}-target-${{ hashFiles('**/Cargo.lock') }}
95+
96+
- name: Build
97+
run: cargo build --release --target ${{ matrix.target }}
98+
99+
- name: Strip binary (Linux and macOS)
100+
if: matrix.os != 'windows-latest'
101+
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
102+
103+
- name: Create archive (Linux and macOS)
104+
if: matrix.os != 'windows-latest'
105+
run: |
106+
cd target/${{ matrix.target }}/release
107+
tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
108+
cd -
109+
mv target/${{ matrix.target }}/release/${{ matrix.asset_name }}.tar.gz .
110+
111+
- name: Create archive (Windows)
112+
if: matrix.os == 'windows-latest'
113+
run: |
114+
cd target/${{ matrix.target }}/release
115+
7z a ${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
116+
cd -
117+
mv target/${{ matrix.target }}/release/${{ matrix.asset_name }}.zip .
118+
119+
- name: Upload Release Asset (Linux and macOS)
120+
if: matrix.os != 'windows-latest'
121+
uses: actions/upload-release-asset@v1
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
with:
125+
upload_url: ${{ needs.create-release.outputs.upload_url }}
126+
asset_path: ./${{ matrix.asset_name }}.tar.gz
127+
asset_name: ${{ matrix.asset_name }}.tar.gz
128+
asset_content_type: application/gzip
129+
130+
- name: Upload Release Asset (Windows)
131+
if: matrix.os == 'windows-latest'
132+
uses: actions/upload-release-asset@v1
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
with:
136+
upload_url: ${{ needs.create-release.outputs.upload_url }}
137+
asset_path: ./${{ matrix.asset_name }}.zip
138+
asset_name: ${{ matrix.asset_name }}.zip
139+
asset_content_type: application/zip

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,26 @@ Note this repo implements the [Tari Hidden Address Protocol](https://github.com/
2121

2222
### Prerequisites
2323

24-
- Rust 2024 edition or later
2524
- [Minotari](https://github.com/tari-project/tari) executable (wallet client)
2625
- Windows, macOS, or Linux
2726

27+
### Download Pre-built Binaries
28+
29+
Download the latest release for your platform from the [Releases](https://github.com/YOUR_USERNAME/tari-advent/releases) page:
30+
31+
- **Windows**: `tari-advent-windows-x86_64.zip`
32+
- **Linux (glibc)**: `tari-advent-linux-x86_64.tar.gz`
33+
- **Linux (musl)**: `tari-advent-linux-x86_64-musl.tar.gz`
34+
- **macOS (Intel)**: `tari-advent-macos-x86_64.tar.gz`
35+
- **macOS (Apple Silicon)**: `tari-advent-macos-aarch64.tar.gz`
36+
37+
Extract the archive and run the executable.
38+
2839
### Building from Source
2940

41+
Requirements:
42+
- Rust 2024 edition or later
43+
3044
1. Clone the repository:
3145
```bash
3246
git clone <repository-url>
@@ -193,4 +207,20 @@ See repository for license information.
193207

194208
## Contributing
195209

196-
Contributions are welcome! Please open an issue or pull request.
210+
Contributions are welcome! Please open an issue or pull request.
211+
212+
## Creating a Release
213+
214+
To create a new release:
215+
216+
1. Update the version in [Cargo.toml](Cargo.toml)
217+
2. Commit the changes
218+
3. Create and push a tag:
219+
```bash
220+
git tag v0.1.0
221+
git push origin v0.1.0
222+
```
223+
4. GitHub Actions will automatically:
224+
- Build binaries for Windows, Linux (glibc and musl), and macOS (Intel and Apple Silicon)
225+
- Create a GitHub release
226+
- Upload all binaries to the release

0 commit comments

Comments
 (0)