Merge pull request #45 from rust-bitcoin/github-ci
Add github actions files for CI
This commit is contained in:
commit
8f43d91d3f
|
@ -0,0 +1,100 @@
|
|||
on: [push, pull_request]
|
||||
|
||||
name: Continuous integration
|
||||
|
||||
jobs:
|
||||
Stable:
|
||||
name: Test - stable toolchain
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout Crate
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Toolchain
|
||||
# https://github.com/dtolnay/rust-toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Running test script
|
||||
env:
|
||||
DO_NO_STD: true
|
||||
DO_FEATURE_MATRIX: true
|
||||
run: ./contrib/test.sh
|
||||
|
||||
Beta:
|
||||
name: Test - beta toolchain
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout Crate
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Toolchain
|
||||
uses: dtolnay/rust-toolchain@beta
|
||||
- name: Running test script
|
||||
env:
|
||||
DO_NO_STD: true
|
||||
run: ./contrib/test.sh
|
||||
|
||||
Nightly:
|
||||
name: Test - nightly toolchain
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout Crate
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Toolchain
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
- name: Running test script
|
||||
env:
|
||||
DO_NO_STD: true
|
||||
run: ./contrib/test.sh
|
||||
|
||||
MSRV:
|
||||
name: Test - 1.41.1 toolchain
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout Crate
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Toolchain
|
||||
uses: dtolnay/rust-toolchain@1.41.1
|
||||
- name: Running test script
|
||||
env:
|
||||
DO_NO_STD: true
|
||||
DO_FEATURE_MATRIX: true
|
||||
run: ./contrib/test.sh
|
||||
|
||||
Arch32bit:
|
||||
name: Test 32-bit version
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Crate
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Add architecture i386
|
||||
run: sudo dpkg --add-architecture i386
|
||||
- name: Install i686 gcc
|
||||
run: sudo apt-get update -y && sudo apt-get install -y gcc-multilib
|
||||
- name: Install target
|
||||
run: rustup target add i686-unknown-linux-gnu
|
||||
- name: Run test on i686
|
||||
run: cargo test --target i686-unknown-linux-gnu
|
||||
|
||||
Cross:
|
||||
name: Cross test
|
||||
if: ${{ !github.event.act }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Crate
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Install target
|
||||
run: rustup target add s390x-unknown-linux-gnu
|
||||
- name: install cross
|
||||
run: cargo install cross --locked
|
||||
- name: run cross test
|
||||
run: cross test --target s390x-unknown-linux-gnu
|
28
.travis.yml
28
.travis.yml
|
@ -1,28 +0,0 @@
|
|||
language: rust
|
||||
cache: cargo
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- rust: stable
|
||||
env: BENCHES=false
|
||||
- rust: beta
|
||||
env: BENCHES=false
|
||||
- rust: nightly
|
||||
env: BENCHES=true
|
||||
- rust: 1.29.0
|
||||
env: BENCHES=false
|
||||
|
||||
before_install:
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install -y binutils-dev libunwind8-dev
|
||||
|
||||
script:
|
||||
- cargo build --verbose
|
||||
- cargo test --verbose
|
||||
- cargo build --verbose --no-default-features --features all-languages
|
||||
- cargo test --verbose --no-default-features --features all-languages
|
||||
- cargo build --verbose --features rand,all-languages
|
||||
- cargo test --verbose --features rand,all-languages
|
||||
# benchmarks
|
||||
- if ${BENCHES}; then cargo bench --verbose --features rand; fi
|
||||
- if ${BENCHES}; then cargo bench --verbose --features rand,japanese; fi
|
|
@ -45,7 +45,7 @@ rand_core = "0.4.0"
|
|||
|
||||
unicode-normalization = { version = "=0.1.9", optional = true }
|
||||
rand = { version = "0.6.0", optional = true }
|
||||
serde = { version = "1.0", default-features = false, optional = true }
|
||||
serde = { version = "1.0", default-features = false, features = [ "alloc" ], optional = true }
|
||||
# Enabling this feature raises the MSRV to 1.51
|
||||
zeroize = {version = "1.5", features = ["zeroize_derive"], optional = true}
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
FEATURES="serde rand all-languages"
|
||||
|
||||
cargo --version
|
||||
rustc --version
|
||||
|
||||
# Work out if we are using a nightly toolchain.
|
||||
NIGHTLY=false
|
||||
if cargo --version | grep nightly; then
|
||||
NIGHTLY=true
|
||||
fi
|
||||
|
||||
# Pin dependencies as required if we are using MSRV toolchain.
|
||||
# if cargo --version | grep "1\.41"; then
|
||||
# fi
|
||||
|
||||
echo "********* Testing std *************"
|
||||
# Test without any features other than std first
|
||||
cargo test --verbose --no-default-features --features="std"
|
||||
|
||||
echo "********* Testing default *************"
|
||||
# Then test with the default features
|
||||
cargo test --verbose
|
||||
|
||||
if [ "$DO_NO_STD" = true ]
|
||||
then
|
||||
echo "********* Testing no-std build *************"
|
||||
# Build no_std, to make sure that cfg(test) doesn't hide any issues
|
||||
cargo build --verbose --no-default-features
|
||||
|
||||
# Build std + no_std, to make sure they are not incompatible
|
||||
cargo build --verbose
|
||||
# Test no_std
|
||||
cargo test --verbose --no-default-features
|
||||
|
||||
# Build all features
|
||||
cargo build --verbose --features="$FEATURES" --no-default-features
|
||||
|
||||
# Build specific features
|
||||
for feature in ${FEATURES}
|
||||
do
|
||||
cargo build --verbose --features="$feature" --no-default-features
|
||||
done
|
||||
fi
|
||||
|
||||
# Test each feature
|
||||
for feature in ${FEATURES}
|
||||
do
|
||||
echo "********* Testing $feature *************"
|
||||
cargo test --verbose --features="$feature"
|
||||
done
|
|
@ -8,8 +8,9 @@ macro_rules! serde_string_impl {
|
|||
where
|
||||
D: $crate::serde::de::Deserializer<'de>,
|
||||
{
|
||||
use std::fmt::{self, Formatter};
|
||||
use std::str::FromStr;
|
||||
use core::fmt::{self, Formatter};
|
||||
use core::str::FromStr;
|
||||
use alloc::string::String;
|
||||
|
||||
struct Visitor;
|
||||
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#[cfg(any(test, feature = "std"))]
|
||||
pub extern crate core;
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
extern crate bitcoin_hashes;
|
||||
extern crate rand_core;
|
||||
|
||||
|
|
Loading…
Reference in New Issue