Skip to content

Commit 397a553

Browse files
committed
ci(repo): fix github actions
1 parent a248c45 commit 397a553

File tree

9 files changed

+113
-58
lines changed

9 files changed

+113
-58
lines changed

.github/workflows/ci.yaml

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ jobs:
115115
publish-crates-check:
116116
name: Publish Check
117117
needs:
118-
- validate-title
119118
- lockfile
120119
- pre-commit
121120
- commitlint
@@ -139,7 +138,6 @@ jobs:
139138
cargo-verifications:
140139
name: Cargo verifications
141140
needs:
142-
- validate-title
143141
- lockfile
144142
- pre-commit
145143
- commitlint
@@ -167,10 +165,10 @@ jobs:
167165
- name: Lint project
168166
run: make lint
169167

170-
test-coverage:
168+
test:
171169
needs:
172170
- cargo-verifications
173-
name: Test & Coverage
171+
name: Test
174172
runs-on: ubuntu-latest
175173
env:
176174
NATS_URL: nats://127.0.0.1:4222
@@ -187,6 +185,8 @@ jobs:
187185
188186
- name: Install Rust
189187
uses: ./.github/actions/setup-rust
188+
with:
189+
toolchain: ${{ env.RUST_NIGHTLY_VERSION }}
190190

191191
- name: Start Nats
192192
run: |
@@ -195,24 +195,54 @@ jobs:
195195
- name: Run tests
196196
run: make test
197197

198+
- name: Stop Nats
199+
if: always()
200+
run: make stop/nats
201+
202+
test-coverage:
203+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
204+
needs:
205+
- cargo-verifications
206+
name: Test & Coverage
207+
runs-on: ubuntu-latest
208+
env:
209+
NATS_URL: nats://127.0.0.1:4222
210+
NATS_ADMIN_PASS: secret
211+
NATS_PUBLIC_PASS: secret
212+
steps:
213+
- uses: actions/checkout@v4
214+
215+
- name: Create .env file with NATS environment variables
216+
run: |
217+
echo "NATS_URL=${{ env.NATS_URL }}" > .env
218+
echo "NATS_ADMIN_PASS=${{ env.NATS_ADMIN_PASS }}" >> .env
219+
echo "NATS_PUBLIC_PASS=${{ env.NATS_PUBLIC_PASS }}" >> .env
220+
221+
- name: Install Rust
222+
uses: ./.github/actions/setup-rust
223+
with:
224+
toolchain: ${{ env.RUST_NIGHTLY_VERSION }}
225+
target: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
226+
cache: false
227+
228+
- name: Start Nats
229+
run: |
230+
make start/nats
231+
198232
- name: Install dependencies
199-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
200233
run: |
201234
sudo apt-get update
202235
sudo apt-get install -y libclang-dev curl
203236
204237
- name: Install Tarpaulin (Pre-built Binary)
205-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
206238
uses: taiki-e/cache-cargo-install-action@v2
207239
with:
208240
tool: cargo-tarpaulin@0.31
209241

210242
- name: Generate Code Coverage
211-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
212243
run: make coverage
213244

214245
- name: Upload to codecov.io
215-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
216246
uses: codecov/codecov-action@v4
217247
with:
218248
name: codecov-data-systems
@@ -317,36 +347,31 @@ jobs:
317347

318348
release:
319349
name: Create Release with Knope
320-
if: (github.head_ref == 'changeset/release-main' && github.event.pull_request.merged == true) || github.event_name
321-
== 'workflow_dispatch'
350+
if: >-
351+
(github.event_name == 'push' &&
352+
github.ref == 'refs/heads/main' &&
353+
contains(github.event.head_commit.message, 'ci(release): Preparing')) ||
354+
github.event_name == 'workflow_dispatch'
322355
needs:
323-
- test-coverage
356+
- test
324357
- build
325358
runs-on: ubuntu-latest
326359
permissions:
327360
contents: read
328361
actions: write
329362
steps:
330363
- name: Checkout Repository
331-
uses: actions/checkout@v4.1.6
364+
uses: actions/checkout@v4
332365

333366
- name: Download Artifacts
334-
uses: actions/download-artifact@v4.1.7
367+
uses: actions/download-artifact@v4
335368
with:
336369
path: artifacts
337370
merge-multiple: true
338371

339372
- name: List Artifacts
340373
run: ls -R artifacts
341374

342-
- name: Cache Artifacts
343-
uses: actions/cache@v4
344-
with:
345-
path: artifacts
346-
key: ${{ runner.os }}-artifacts-${{ github.sha }}
347-
restore-keys: |
348-
${{ runner.os }}-artifacts-
349-
350375
- name: Run Knope Action
351376
uses: knope-dev/action@v2.1.0
352377
with:
@@ -355,31 +380,4 @@ jobs:
355380
- name: Knope Release
356381
run: knope release
357382
env:
358-
github-token: ${{ secrets.REPO_TOKEN }}
359-
360-
publish-crates:
361-
name: Publish on Crates.io
362-
needs:
363-
- publish-crates-check
364-
- release
365-
runs-on: ubuntu-latest
366-
steps:
367-
- name: Checkout Repository
368-
uses: actions/checkout@v4
369-
370-
- name: Restore Artifacts Cache
371-
uses: actions/cache@v4
372-
with:
373-
path: artifacts
374-
key: ${{ runner.os }}-artifacts-${{ github.sha }}
375-
restore-keys: |
376-
${{ runner.os }}-artifacts-
377-
378-
- name: Install Rust Toolchain
379-
uses: dtolnay/rust-toolchain@master
380-
381-
- name: Publish Crate
382-
uses: FuelLabs/publish-crates@v1
383-
with:
384-
publish-delay: 60000
385-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
383+
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish on Crates.io
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
CI: true
10+
RUST_VERSION: 1.79.0
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
publish-crates:
18+
name: Publish on Crates.io
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install toolchain
24+
uses: dtolnay/rust-toolchain@master
25+
with:
26+
toolchain: ${{ env.RUST_VERSION }}
27+
target: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
28+
29+
- name: Publish Crate
30+
uses: katyo/publish-crates@v2
31+
id: publish-crates
32+
with:
33+
publish-delay: 60000
34+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
35+
ignore-unpublished-changes: true
36+
37+
- name: if my-crate published
38+
if: fromJSON(steps.publish-crates.outputs.published).*
39+
run: |-
40+
LIST="${{ join(fromJSON(steps.publish-crates.outputs.published).*.name, ', ')) }}"
41+
echo "Published crates: $LIST"

crates/fuel-data-parser/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "fuel-data-parser"
3+
description = "A parser for Fuel blockchain data structures and formats"
34
authors = { workspace = true }
45
keywords = { workspace = true }
56
edition = { workspace = true }
@@ -16,7 +17,7 @@ chrono = { workspace = true }
1617
displaydoc = { workspace = true }
1718
fuel-core = { workspace = true }
1819
fuel-core-types = { workspace = true }
19-
fuel-streams-macros = { path = "../fuel-streams-macros" }
20+
fuel-streams-macros = { path = "../fuel-streams-macros", version = "0.0.1" }
2021
paste = "1.0.15"
2122
postcard = "1.0.8"
2223
prost = "0.13.1"

crates/fuel-streams-core/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "fuel-streams-core"
3+
description = "Core components for working with streams of Fuel blockchain data"
34
authors = { workspace = true }
45
keywords = { workspace = true }
56
edition = { workspace = true }
@@ -15,8 +16,8 @@ displaydoc = { workspace = true }
1516
dotenvy = { workspace = true }
1617
fuel-core = { workspace = true }
1718
fuel-core-types = { workspace = true }
18-
fuel-data-parser = { path = "../fuel-data-parser" }
19-
fuel-streams-macros = { path = "../fuel-streams-macros" }
19+
fuel-data-parser = { path = "../fuel-data-parser", version = "0.0.1" }
20+
fuel-streams-macros = { path = "../fuel-streams-macros", version = "0.0.1" }
2021
futures = { workspace = true }
2122
pretty_assertions = { workspace = true, optional = true }
2223
rand = { workspace = true }

crates/fuel-streams-macros/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "fuel-streams-macros"
3+
description = "Macros for implementing traits and deriving functionality in the fuel-streams crate"
34
authors = { workspace = true }
45
keywords = { workspace = true }
56
edition = { workspace = true }
@@ -9,4 +10,4 @@ repository = { workspace = true }
910
version = { workspace = true }
1011

1112
[dependencies]
12-
subject-derive = { path = "./subject-derive" }
13+
subject-derive = { path = "./subject-derive", version = "0.0.1" }

crates/fuel-streams-macros/subject-derive/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "subject-derive"
3+
description = "Derive macro for implementing the Subject trait in the fuel-streams crate"
34
authors = { workspace = true }
45
keywords = { workspace = true }
56
edition = { workspace = true }

crates/fuel-streams/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = "0.0.1"
1111
[dependencies]
1212
async-trait = { workspace = true }
1313
displaydoc = { workspace = true }
14-
fuel-streams-core = { path = "../fuel-streams-core" }
14+
fuel-streams-core = { path = "../fuel-streams-core", version = "0.0.1" }
1515
futures = { workspace = true }
1616
thiserror = { workspace = true }
1717

knope.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,22 @@ extra_changelog_sections = [
1717
]
1818

1919
[[packages.fuel-streams.assets]]
20-
path = "artifacts/fuel-streams-publisher-x86_64-unknown-linux-gnu.tgz"
20+
path = "artifacts/fuel-streams-publisher-Linux-aarch64-gnu.tar.gz"
2121

2222
[[packages.fuel-streams.assets]]
23-
path = "artifacts/fuel-streams-x86_64-unknown-linux-gnu.tgz"
23+
path = "artifacts/fuel-streams-publisher-Linux-aarch64-musl.tar.gz"
24+
25+
[[packages.fuel-streams.assets]]
26+
path = "artifacts/fuel-streams-publisher-Linux-x86_64-gnu.tar.gz"
27+
28+
[[packages.fuel-streams.assets]]
29+
path = "artifacts/fuel-streams-publisher-Linux-x86_64-musl.tar.gz"
30+
31+
[[packages.fuel-streams.assets]]
32+
path = "artifacts/fuel-streams-publisher-macOS-aarch64.tar.gz"
33+
34+
[[packages.fuel-streams.assets]]
35+
path = "artifacts/fuel-streams-publisher-macOS-x86_64.tar.gz"
2436

2537
# ------------------------------------------------------------
2638
# Workflow to get the current version

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "data-systems",
3-
"version": "0.0.0",
2+
"name": "fuel-streams",
3+
"version": "0.0.1",
44
"license": "MIT",
55
"private": true,
66
"scripts": {

0 commit comments

Comments
 (0)