Finish the migration to GitHub Actions (#1500)

This commit is contained in:
Pierre Krieger 2020-03-23 12:04:31 +01:00 committed by GitHub
parent 7bf5266a02
commit 42290d94f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 120 deletions

View File

@ -1,114 +0,0 @@
version: 2
workflows:
version: 2
build:
jobs:
- test
- test-wasm
- check-rustdoc-links
- integration-test
jobs:
test:
machine:
enabled: true
steps:
- checkout
- run:
name: Enable ipv6
command: |
cat <<'EOF' | sudo tee /etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"
}
EOF
sudo service docker restart
- restore_cache:
key: test-cache
- run:
name: Prepare docker container for building
command: docker build --pull --no-cache -t rust-libp2p -f .circleci/images/rust-libp2p/Dockerfile .
- run:
name: Run tests, inside a docker image, with no feature
command: docker run --rm -v "/cache/cargo/registry:/usr/local/cargo/registry" -v "/cache/target:/app/target" -it rust-libp2p cargo test --all --no-default-features
- run:
name: Run tests, inside a docker image, with all features
command: docker run --rm -v "/cache/cargo/registry:/usr/local/cargo/registry" -v "/cache/target:/app/target" -it rust-libp2p cargo test --all --all-features
- save_cache:
key: test-cache
paths:
- "/cache"
check-rustdoc-links:
docker:
- image: rust:latest
steps:
- checkout
- restore_cache:
key: test-rustdoc-cache-{{ epoch }}
- run:
name: Install nightly Rust
# TODO: intra-doc links are available on nightly only
# see https://doc.rust-lang.org/nightly/rustdoc/lints.html#intra_doc_link_resolution_failure
command: rustup default nightly
- run:
name: Print Rust version
command: |
rustc --version
- run:
name: Check Rustdoc links
command: RUSTDOCFLAGS="--deny intra_doc_link_resolution_failure" cargo +nightly doc --verbose --workspace --no-deps --document-private-items
- save_cache:
key: test-rustdoc-cache-{{ epoch }}
paths:
- ./target
- /usr/local/cargo
test-wasm:
docker:
- image: parity/rust-builder:latest
steps:
- checkout
- restore_cache:
keys:
- test-wasm-cache-{{ epoch }}
- run:
name: Print Rust version
command: |
rustc --version
- run:
name: Build for wasm32
# TODO: also run tests but with --no-run; important to detect linking errors
command: |
sccache -s
cargo web build
sccache -s
- save_cache:
key: test-wasm-cache-{{ epoch }}
paths:
- ./target
- /usr/local/cargo
- /root/.cache/sccache
integration-test:
docker:
- image: rust
- image: ipfs/go-ipfs
steps:
- checkout
- restore_cache:
key: integration-test-cache-{{ epoch }}
- run:
name: Print Rust version
command: |
rustc --version
- run:
command: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad
- save_cache:
key: integration-test-cache-{{ epoch }}
paths:
- "~/.cargo"
- "./target"

View File

@ -1,5 +0,0 @@
FROM rust
RUN mkdir /app
WORKDIR /app
COPY . /app

View File

@ -3,7 +3,7 @@ name: Continuous integration
on: on:
pull_request: pull_request:
push: push:
branches: branches:
- master - master
jobs: jobs:
@ -88,3 +88,28 @@ jobs:
run: rustup default nightly run: rustup default nightly
- name: Check rustdoc links - name: Check rustdoc links
run: RUSTDOCFLAGS="--deny intra_doc_link_resolution_failure" cargo +nightly doc --verbose --workspace --no-deps --document-private-items run: RUSTDOCFLAGS="--deny intra_doc_link_resolution_failure" cargo +nightly doc --verbose --workspace --no-deps --document-private-items
integration-test:
name: Integration tests
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v1
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: cargo-index-${{ hashFiles('Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: cargo-build-target-${{ hashFiles('Cargo.toml') }}
- name: Run ipfs-kad example
run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad