66
77env :
88 CARGO_TERM_COLOR : always
9- REGISTRY : frknorg
10- API_IMAGE_NAME : fcore-api
11- DOCKER_TAG : latest
129
1310jobs :
11+ tests :
12+ runs-on : ubuntu-22.04
13+ steps :
14+ - uses : actions/checkout@v4
15+ - name : Install Rust
16+ uses : dtolnay/rust-toolchain@nightly
17+ - name : Install dependencies
18+ run : sudo apt-get update && sudo apt-get install -y protobuf-compiler
19+ - name : Test
20+ run : cargo test --lib
21+
1422 build-node :
23+ needs : [tests]
1524 runs-on : ubuntu-22.04
1625 strategy :
1726 matrix :
@@ -21,146 +30,96 @@ jobs:
2130 - armv7-unknown-linux-gnueabihf
2231
2332 steps :
24- - name : Checkout
25- uses : actions/checkout@v4
33+ - uses : actions/checkout@v4
2634
27- - name : Install latest rust toolchain
28- uses : actions-rs/ toolchain@v1
35+ - name : Install Rust
36+ uses : dtolnay/rust- toolchain@nightly
2937 with :
30- toolchain : nightly
31- default : true
32- override : true
38+ targets : ${{ matrix.target }}
3339
34- - name : Update apt package index
35- run : sudo apt-get update
36-
37- - name : Install protobuf-compiler
38- run : sudo apt-get install -y protobuf-compiler
39-
40- - name : Install zig
41- run : pip3 install ziglang
42-
43- - name : Install cargo-zigbuild
44- run : cargo install --locked cargo-zigbuild
40+ - uses : Swatinem/rust-cache@v2
41+ with :
42+ key : ${{ matrix.target }}
4543
46- - name : Add target
47- run : rustup target add ${{ matrix.target }}
44+ - name : Install Build Tools
45+ run : |
46+ sudo apt-get update && sudo apt-get install -y protobuf-compiler
47+ pip3 install ziglang
48+ cargo install cargo-zigbuild
4849
49- - name : Build for ${{ matrix.target }}
50- run : cargo zigbuild --release --target ${{ matrix.target }} --bin node --no-default- features
50+ - name : Build Node
51+ run : cargo zigbuild --release --target ${{ matrix.target }} --bin node --features xray,wireguard
5152
52- - name : Upload artifacts
53+ - name : Upload Artifact
5354 uses : actions/upload-artifact@v4
5455 with :
55- name : node-${{ matrix.target }}
56+ name : fcore- node-${{ matrix.target }}
5657 path : target/${{ matrix.target }}/release/node
5758
5859 build-api :
59- runs-on : ubuntu-latest
60-
60+ needs : [tests]
61+ runs-on : ubuntu-22.04
6162 steps :
6263 - name : Checkout
6364 uses : actions/checkout@v4
64-
65- - name : Install latest rust toolchain
66- uses : actions-rs/toolchain@v1
67- with :
68- toolchain : nightly
69- default : true
70- override : true
71-
72- - name : Update apt package index
73- run : sudo apt-get update
74-
75- - name : Install protobuf-compiler
76- run : sudo apt-get install -y protobuf-compiler
77-
78- - name : Build
79- run : cargo build --release --no-default-features --bin api
80-
81- - name : Upload artifacts
65+ - name : Install Rust
66+ uses : dtolnay/rust-toolchain@nightly
67+ - name : Test Lib
68+ run : cargo test --lib
69+ - name : Build API
70+ run : cargo build --release --bin api --no-default-features
71+ - name : Upload Artifact
8272 uses : actions/upload-artifact@v4
8373 with :
84- name : api
74+ name : fcore- api
8575 path : target/release/api
8676
8777 build-auth :
88- runs-on : ubuntu-latest
89-
78+ needs : [tests]
79+ runs-on : ubuntu-22.04
9080 steps :
9181 - name : Checkout
9282 uses : actions/checkout@v4
93-
94- - name : Install latest rust toolchain
95- uses : actions-rs/toolchain@v1
96- with :
97- toolchain : nightly
98- default : true
99- override : true
100-
101- - name : Update apt package index
102- run : sudo apt-get update
103-
104- - name : Install protobuf-compiler
105- run : sudo apt-get install -y protobuf-compiler
106-
107- - name : Build
108- run : cargo build --release --no-default-features --bin auth
109-
110- - name : Upload artifacts
83+ - name : Install Rust
84+ uses : dtolnay/rust-toolchain@nightly
85+ - uses : Swatinem/rust-cache@v2
86+ - name : Build Auth
87+ run : cargo build --release --bin auth --no-default-features --features email
88+ - name : Upload Artifact
11189 uses : actions/upload-artifact@v4
11290 with :
113- name : auth
91+ name : fcore- auth
11492 path : target/release/auth
11593
11694 release :
117- name : Release
95+ name : Create Release
11896 needs : [build-api, build-auth, build-node]
11997 runs-on : ubuntu-latest
120-
12198 steps :
12299 - name : Checkout
123100 uses : actions/checkout@v4
124-
125- - name : Download all node artifacts
101+ - name : Download all artifacts
126102 uses : actions/download-artifact@v4
127103 with :
128104 path : artifacts
129- pattern : node -*
105+ pattern : fcore -*
130106 merge-multiple : false
131107
132- - name : Download API artifact
133- uses : actions/download-artifact@v4
134- with :
135- name : api
136- path : artifacts/api
137-
138- - name : Download Auth artifact
139- uses : actions/download-artifact@v4
140- with :
141- name : auth
142- path : artifacts/auth
143-
144108 - name : Prepare release files
145109 run : |
146- mkdir -p release
147- cp artifacts/node-x86_64-unknown-linux-gnu/node release /node-x86_64
148- cp artifacts/node-aarch64-unknown-linux-gnu/node release /node-aarch64
149- cp artifacts/node-armv7-unknown-linux-gnueabihf/node release /node-armv7
150- cp artifacts/api/api release /api-x86_64
151- cp artifacts/auth/auth release /auth-x86_64
152- chmod +x release /*
153-
154- - name : Release
110+ mkdir -p release_dist
111+ cp artifacts/fcore- node-x86_64-unknown-linux-gnu/node release_dist /node-x86_64
112+ cp artifacts/fcore- node-aarch64-unknown-linux-gnu/node release_dist /node-aarch64
113+ cp artifacts/fcore- node-armv7-unknown-linux-gnueabihf/node release_dist /node-armv7
114+ cp artifacts/fcore- api/api release_dist /api-x86_64
115+ cp artifacts/fcore- auth/auth release_dist /auth-x86_64
116+ chmod +x release_dist /*
117+
118+ - name : Upload to GitHub Release
155119 uses : softprops/action-gh-release@v1
156- if : startsWith(github.ref, 'refs/tags/')
157120 with :
158121 files : |
159- release/api-x86_64
160- release/auth-x86_64
161- release/node-x86_64
162- release/node-aarch64
163- release/node-armv7
122+ release_dist/*
164123 docs/*
165124 README.md
166125 config-node-example.toml
0 commit comments