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

Start migrating CI to Github Actions #2531

Merged
merged 15 commits into from
May 24, 2020
Merged
Changes from 14 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
125 changes: 125 additions & 0 deletions .github/workflows/test_tokio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
on: [push, pull_request]

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

name: Test tokio

env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
nightly: nightly-2020-01-25

jobs:
test_tokio:
name: Test tokio full
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@master

# Run `tokio` with only `full`
- uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full
name: tokio - cargo test --features full

# Run `tokio` with "unstable" cfg flag
- uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full
env:
RUSTFLAGS: '--cfg tokio_unstable'
name: tokio - cargo test --features full --cfg tokio_unstable

test_cross_subcrates:
name: Test ${{ matrix.crate }} (${{ matrix.os }}) all-features
runs-on: ${{ matrix.os }}
strategy:
matrix:
crate:
- tokio
- tests-integration
os:
- windows-latest
- ubuntu-latest
- macos-latest
include:
- crate: tokio-macros
os: ubuntu-latest
- crate: tokio-test
os: ubuntu-latest
- crate: tokio-util
os: ubuntu-latest
- crate: examples
os: ubuntu-latest

steps:
- uses: actions/checkout@master

# Run with all crate features
- name: ${{ matrix.crate }} - cargo test --all-features
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features

# Check benches
- name: ${{ matrix.crate }} - cargo check --benches
uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches

- name: Patch Cargo.toml
shell: bash
run: |
set -e

# Remove any existing patch statements
mv Cargo.toml Cargo.toml.bck
sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml

# Patch all crates
cat ci/patch.toml >> Cargo.toml

# Print `Cargo.toml` for debugging
echo "~~~~ Cargo.toml ~~~~"
cat Cargo.toml
echo "~~~~~~~~~~~~~~~~~~~~"

# Run with all crate features
- name: ${{ matrix.crate }} - cargo test --all-features
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features

test_integration:
name: Integration tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@master
- run: cargo install cargo-hack
name: Install cargo-hack
- uses: actions-rs/cargo@v1
name: cargo hack test --each-feature
with:
command: hack
args: test --manifest-path ${{ github.workspace }}/tests-integration/Cargo.toml --each-feature