Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor improvements #25

Merged
merged 10 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, stable, 1.77.0 ]
name: [ linux, windows, macos ]
include:
- name: linux
os: ubuntu-latest
- name: windows
os: windows-latest
- name: macos
os: macos-latest
steps:
- uses: ilammy/setup-nasm@v1
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}

- name: Build all targets
run: cargo build --all-targets
26 changes: 26 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check format

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
format:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt

- name: Format
run: cargo fmt -- --check
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check lint

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy

- name: Lint
run: cargo clippy --all-targets -- -D warnings
29 changes: 2 additions & 27 deletions .github/workflows/checks.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code checks
name: Run tests

on:
push:
Expand All @@ -10,40 +10,15 @@ env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Lint
run: cargo clippy --all-targets -- -D warnings

format:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Format
run: cargo fmt --all -- --check

test_and_coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Setup rust toolchain
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: llvm-tools-preview
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [
"Nicola Busanello <[email protected]>",
]
edition = "2021"
rust-version = "1.75.0"
rust-version = "1.77.0"
repository = "https://github.com/RGB-WG/rgb-tests"
homepage = "https://github.com/RGB-WG/rgb-tests"
license = "Apache-2.0"
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,20 @@ The GitHub organizations of submodule repositories are:
A helper to change the revision for all submodules is available in the form of
the `sub-rev-change.sh` script.

As an example, it can be used to update all submodules to the `master` branch
As an example, it can be used to point all submodules to the `master` branch
with:
```sh
./sub-rev-change.sh --branch master
./submodules-rev.sh change --branch master
```

See the help for more details on its usage:
```sh
./sub-rev-change.sh --help
./submodules-rev.sh help
```

To check which revision is checked-out for each submodule run:
```sh
./submodules-rev.sh status
```

### PRs showing bugs
Expand Down
2 changes: 1 addition & 1 deletion bp-std
2 changes: 1 addition & 1 deletion bp-wallet
51 changes: 44 additions & 7 deletions sub-rev-change.sh → submodules-rev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,58 @@ _war() {

# CLI handling
help() {
echo "$0 [-h] [-f] [-r <remote>] (-b) <branch>"
echo "$0 <command>"
echo ""
echo "commands:"
echo " status show all submodule revs"
echo " change change submodule revs"
echo " help show this help message"
}

change_help() {
echo "$0 change [-h] [-f] [-r <remote>] (-b) <branch>"
echo ""
echo "options:"
echo " -h --help show this help message"
echo " -b --branch change to the specified branch"
echo " -f --fetch fetch provided remote (or all if none specified)"
echo " -r --remote remote to be used"
echo " -t --tag change to the specified tag"
}

status() {
git submodule foreach --quiet \
'echo "" $(git rev-list -n1 HEAD) $sm_path $(git describe --all | sed "s,^\(tags\|remotes\|heads\)/,(,;s/$/)/")'
}

if [ -z "$1" ]; then
help
_die "please provide a command"
fi

case $1 in
help)
help
exit 0
;;
status)
status
exit 0
;;
change)
shift
;;
*)
help
_die "unsupported command \"$1\""
;;
esac

while [ -n "$1" ]; do
case $1 in
-h | --help)
help
exit 0
;;
change_help
exit 0
;;
-b | --branch)
BRANCH="$2"
shift
Expand All @@ -74,15 +110,16 @@ while [ -n "$1" ]; do
shift
;;
*)
help
_die "unsupported argument \"$1\""
change_help
_die "unsupported option \"$1\""
;;
esac
shift
done

# check a branch or tag have been specified
if [ -z "$BRANCH" ] && [ -z "$TAG" ]; then
change_help
_die "please specify a branch or a tag to switch to"
fi
if [ -n "$BRANCH" ] && [ -n "$TAG" ]; then
Expand Down
6 changes: 3 additions & 3 deletions tests/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ fn rbf_transfer() {
}

#[test]
#[ignore = "fix needed"]
#[ignore = "fix needed"] // https://github.com/RGB-WG/rgb-core/issues/283
fn same_transfer_twice_no_update_witnesses() {
initialize();

Expand Down Expand Up @@ -545,7 +545,7 @@ fn same_transfer_twice_no_update_witnesses() {
}

#[test]
#[ignore = "fix needed"]
#[ignore = "fix needed"] // https://github.com/RGB-WG/rgb-core/issues/283
fn same_transfer_twice_update_witnesses() {
initialize();

Expand Down Expand Up @@ -1045,7 +1045,7 @@ fn receive_from_unbroadcasted_transfer_to_blinded() {
consignment: &'cons IndexedConsignment<'cons, TRANSFER>,
fallback: &'a AnyResolver,
}
impl<'a, 'cons, const TRANSFER: bool> ResolveWitness for OffchainResolver<'a, 'cons, TRANSFER> {
impl<const TRANSFER: bool> ResolveWitness for OffchainResolver<'_, '_, TRANSFER> {
fn resolve_pub_witness(
&self,
witness_id: XWitnessId,
Expand Down
Loading
Loading