Skip to content

Commit

Permalink
Crates.io publishing (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Voxelot authored Dec 24, 2021
1 parent 540739b commit 634a202
Show file tree
Hide file tree
Showing 29 changed files with 111 additions and 38 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/cargo_test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Compile and Test
name: CI

on:
push:
branches:
- master
tags:
- v*
pull_request:
release:
types: [published]

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -73,3 +73,30 @@ jobs:
with:
command: test
args: --verbose --all-targets

publish:
# Only do this job if publishing a release
needs: build
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Verify tag version
run: |
cargo install toml-cli
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} fuel-client/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} fuel-core/Cargo.toml
- name: Publish crate
uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/scripts/verify_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -e

err() {
echo -e "\e[31m\e[1merror:\e[0m $@" 1>&2;
}

status() {
WIDTH=12
printf "\e[32m\e[1m%${WIDTH}s\e[0m %s\n" "$1" "$2"
}

REF=$1
MANIFEST=$2

if [ -z "$REF" ]; then
err "Expected ref to be set"
exit 1
fi

if [ -z "$MANIFEST" ]; then
err "Expected manifest to be set"
exit 1
fi

# strip preceeding 'v' if it exists on tag
REF=${REF/#v}
TOML_VERSION=$(toml get $MANIFEST package.version | tr -d '"')

if [ "$TOML_VERSION" != "$REF" ]; then
err "Crate version $TOML_VERSION, doesn't match tag version $REF"
exit 1
else
status "Crate version matches tag $TOML_VERSION"
fi
50 changes: 25 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Fuel Client

[![build](https://github.com/FuelLabs/fuel-core/actions/workflows/ci.yml/badge.svg)](https://github.com/FuelLabs/fuel-core/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/fuel-core?label=latest)](https://crates.io/crates/fuel-core)
[![docs](https://docs.rs/fuel-core/badge.svg)](https://docs.rs/fuel-core/)
[![discord](https://img.shields.io/badge/chat%20on-discord-orange?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/xfpK4Pe)

Fuel client implementation.

## Testing
Expand Down Expand Up @@ -135,6 +140,6 @@ RET(REG_ONE),
```

```
$ cargo run --bin fuel-client -- transaction submit \
$ cargo run --bin fuel-gql-cli -- transaction submit \
"{\"Script\":{\"gas_price\":0,\"gas_limit\":1000000,\"maturity\":0,\"script\":[80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0],\"script_data\":[],\"inputs\":[],\"outputs\":[{\"Coin\":{\"to\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], \"amount\": 10, \"color\": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}],\"witnesses\":[],\"receipts_root\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}"
```
1 change: 1 addition & 0 deletions examples/simple-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "simple-wasm"
version = "0.1.0"
edition = "2021"
publish = false

[lib]
crate-type = ['cdylib']
Expand Down
6 changes: 3 additions & 3 deletions fuel-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "fuel-client"
name = "fuel-gql-client"
version = "0.1.0"
authors = ["Fuel Labs <[email protected]>"]
categories = ["concurrency", "cryptography::cryptocurrencies", "emulators"]
Expand All @@ -16,7 +16,7 @@ autotests = false
autobenches = false

[[bin]]
name = "fuel-client"
name = "fuel-gql-cli"
path = "src/main.rs"

[dependencies]
Expand All @@ -36,7 +36,7 @@ surf = "2.2"
thiserror = "1.0"

[dev-dependencies]
fuel-client = { path = ".", features = ["test-helpers"] }
fuel-gql-client = { path = ".", features = ["test-helpers"] }
fuel-core = { path = "../fuel-core", features = ["test-helpers"] }
fuel-vm = { git = "ssh://[email protected]/FuelLabs/fuel-vm.git", features = ["serde-types", "random"] }
insta = "1.8"
Expand Down
2 changes: 1 addition & 1 deletion fuel-client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use fuel_client::client::FuelClient;
use fuel_gql_client::client::FuelClient;
use fuel_tx::Transaction;
use serde_json::json;
use structopt::StructOpt;
Expand Down
2 changes: 1 addition & 1 deletion fuel-client/tests/blocks.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use chrono::{TimeZone, Utc};
use fuel_client::client::{FuelClient, PageDirection, PaginationRequest};
use fuel_core::database::Database;
use fuel_core::{
model::fuel_block::FuelBlock,
schema::scalars::HexString256,
service::{Config, FuelService},
};
use fuel_gql_client::client::{FuelClient, PageDirection, PaginationRequest};
use fuel_storage::Storage;
use fuel_vm::prelude::Bytes32;
use itertools::{rev, Itertools};
Expand Down
2 changes: 1 addition & 1 deletion fuel-client/tests/coin.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use fuel_client::client::{FuelClient, PageDirection, PaginationRequest};
use fuel_core::{
database::Database,
model::coin::{Coin, CoinStatus, UtxoId},
service::{Config, FuelService},
};
use fuel_gql_client::client::{FuelClient, PageDirection, PaginationRequest};
use fuel_storage::Storage;
use fuel_vm::prelude::{Address, Bytes32, Word};

Expand Down
2 changes: 1 addition & 1 deletion fuel-client/tests/dap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fuel_client::client::FuelClient;
use fuel_core::service::{Config, FuelService};
use fuel_gql_client::client::FuelClient;
use fuel_vm::{consts::*, prelude::*};
use std::convert::TryInto;

Expand Down
2 changes: 1 addition & 1 deletion fuel-client/tests/health.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fuel_client::client::FuelClient;
use fuel_core::service::{Config, FuelService};
use fuel_gql_client::client::FuelClient;

#[tokio::test]
async fn health() {
Expand Down
2 changes: 1 addition & 1 deletion fuel-client/tests/tx.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use chrono::Utc;
use fuel_client::client::{FuelClient, PageDirection, PaginationRequest};
use fuel_core::{
database::Database,
executor::Executor,
model::{coin::UtxoId, fuel_block::FuelBlock},
service::{Config, FuelService},
};
use fuel_gql_client::client::{FuelClient, PageDirection, PaginationRequest};
use fuel_storage::Storage;
use fuel_vm::{consts::*, prelude::*};
use itertools::Itertools;
Expand Down
1 change: 1 addition & 0 deletions fuel-indexer/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "fuel-indexer-derive"
version = "0.1.0"
edition = "2021"
license = "BUSL-1.1"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
Expand Down
1 change: 1 addition & 0 deletions fuel-indexer/indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "fuel-wasm-executor"
version = "0.1.0"
edition = "2021"
license = "BUSL-1.1"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions fuel-indexer/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "fuel-indexer"
version = "0.1.0"
edition = "2021"
license = "BUSL-1.1"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
Expand Down
1 change: 1 addition & 0 deletions fuel-indexer/schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "fuel-indexer-schema"
version = "0.1.0"
edition = "2021"
license = "BUSL-1.1"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ edition = "2021"
name = "xtask"
version = "0.1.0"
license = "BUSL-1.1"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down

0 comments on commit 634a202

Please sign in to comment.