271 lines
8.1 KiB
YAML
271 lines
8.1 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
name: Tests
|
|
|
|
# Yeah I know it's bad practice to have API keys, this is a read-only API key
|
|
# so that we do not get rate limited by Etherscan (and it's free to generate as
|
|
# many as you want)
|
|
env:
|
|
ETHERSCAN_API_KEY_ETHEREUM: I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB
|
|
ETHERSCAN_API_KEY_CELO: B13XSMUT6Q3Q4WZ5DNQR8RXDBA2KNTMT4M
|
|
RINKEBY_PRIVATE_KEY: "a046a5b763923d437855a6fe64962569c9a378efba5c84920212c4b6ae270df5"
|
|
|
|
jobs:
|
|
tests:
|
|
name: ethereum tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v2
|
|
- name: Install ganache-cli
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 10
|
|
- name: Install ganache
|
|
run: npm install -g ganache-cli
|
|
- name: Install Solc
|
|
run: |
|
|
mkdir -p "$HOME/bin"
|
|
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
|
|
chmod u+x "$HOME/bin/solc"
|
|
export PATH=$HOME/bin:$PATH
|
|
solc --version
|
|
|
|
- name: Install geth
|
|
run: |
|
|
mkdir -p "$HOME/bin"
|
|
wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
tar -xvf geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
mv geth-linux-amd64-1.9.23-8c2f2715/geth $HOME/bin/geth
|
|
chmod u+x "$HOME/bin/geth"
|
|
export PATH=$HOME/bin:$PATH
|
|
geth version
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v1
|
|
with:
|
|
cache-on-failure: true
|
|
- name: cargo test
|
|
run: |
|
|
export PATH=$HOME/bin:$PATH
|
|
export ETHERSCAN_API_KEY=$ETHERSCAN_API_KEY_ETHEREUM
|
|
cargo test
|
|
|
|
feature-tests:
|
|
name: celo tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v2
|
|
- name: Install ganache-cli
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 10
|
|
# TODO: can we combine these shared steps in github actions?
|
|
- name: Install ganache
|
|
run: npm install -g ganache-cli
|
|
- name: Install Solc
|
|
run: |
|
|
mkdir -p "$HOME/bin"
|
|
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
|
|
chmod u+x "$HOME/bin/solc"
|
|
export PATH=$HOME/bin:$PATH
|
|
solc --version
|
|
- name: Install geth
|
|
run: |
|
|
mkdir -p "$HOME/bin"
|
|
wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
tar -xvf geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
mv geth-linux-amd64-1.9.23-8c2f2715/geth $HOME/bin/geth
|
|
chmod u+x "$HOME/bin/geth"
|
|
export PATH=$HOME/bin:$PATH
|
|
geth version
|
|
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v1
|
|
with:
|
|
cache-on-failure: true
|
|
- name: cargo test (Celo)
|
|
run: |
|
|
export PATH=$HOME/bin:$PATH
|
|
export ETHERSCAN_API_KEY=$ETHERSCAN_API_KEY_CELO
|
|
cargo test --all-features
|
|
|
|
lint:
|
|
name: lints
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v2
|
|
- name: Install toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
profile: minimal
|
|
components: rustfmt, clippy
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v1
|
|
with:
|
|
cache-on-failure: true
|
|
- name: cargo fmt
|
|
run: cargo +nightly fmt --all -- --check
|
|
- name: cargo clippy
|
|
run: cargo +nightly clippy --all-features -- -D warnings
|
|
|
|
wasm:
|
|
name: WASM
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
- name: Install node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 10
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: wasm32-unknown-unknown
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
with:
|
|
cache-on-failure: true
|
|
|
|
- name: Check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target wasm32-unknown-unknown
|
|
|
|
- name: Launch Ganache
|
|
run: |
|
|
cd examples/ethers-wasm
|
|
npm install
|
|
npm run ganache &
|
|
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
- name: Wasm-pack test firefox
|
|
run: |
|
|
cd examples/ethers-wasm
|
|
wasm-pack test --headless --firefox
|
|
|
|
- name: Wasm-pack test chrome
|
|
run: |
|
|
cd examples/ethers-wasm
|
|
wasm-pack test --headless --chrome
|
|
|
|
examples:
|
|
name: Examples
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v2
|
|
- name: Install ganache-cli
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 10
|
|
- name: Install ganache
|
|
run: npm install -g ganache-cli
|
|
- name: Install Solc
|
|
run: |
|
|
mkdir -p "$HOME/bin"
|
|
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
|
|
chmod u+x "$HOME/bin/solc"
|
|
export PATH=$HOME/bin:$PATH
|
|
solc --version
|
|
|
|
- name: Install geth
|
|
run: |
|
|
mkdir -p "$HOME/bin"
|
|
wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
tar -xvf geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
mv geth-linux-amd64-1.9.23-8c2f2715/geth $HOME/bin/geth
|
|
chmod u+x "$HOME/bin/geth"
|
|
export PATH=$HOME/bin:$PATH
|
|
geth version
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v1
|
|
with:
|
|
cache-on-failure: true
|
|
- name: cargo test
|
|
run: |
|
|
export PATH=$HOME/bin:$PATH
|
|
./scripts/examples.sh
|
|
|
|
windows-build:
|
|
runs-on: windows-latest
|
|
name: (${{ matrix.target }}, ${{ matrix.cfg_release_channel }})
|
|
env:
|
|
CFG_RELEASE_CHANNEL: ${{ matrix.cfg_release_channel }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target: [
|
|
i686-pc-windows-gnu,
|
|
i686-pc-windows-msvc,
|
|
x86_64-pc-windows-gnu,
|
|
x86_64-pc-windows-msvc,
|
|
]
|
|
cfg_release_channel: [nightly]
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
|
|
# Run build
|
|
- name: Install Rustup using win.rustup.rs
|
|
run: |
|
|
# disable download progress bar
|
|
$ProgressPreference = "SilentlyContinue"
|
|
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
|
|
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
|
|
del rustup-init.exe
|
|
rustup target add ${{ matrix.target }}
|
|
shell: powershell
|
|
|
|
- name: Add mingw32 to path for i686-gnu
|
|
run: |
|
|
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
|
|
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
|
|
shell: bash
|
|
|
|
- name: Add mingw64 to path for x86_64-gnu
|
|
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
|
|
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
|
|
shell: bash
|
|
|
|
- name: build
|
|
run: |
|
|
rustc -Vv
|
|
cargo -V
|
|
# we test without --all-features on Windows so that sha2-asm is not activated.
|
|
cargo check
|
|
shell: cmd
|