Skip to content

Commit d562e58

Browse files
ci: start migrating CI to Github Actions (#2531)
This migrates test_tokio, test_sub_crates, and test_integration to GitHub Actions, as the first step in the migration from Azure Pipelines.
1 parent 9f63911 commit d562e58

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

.github/workflows/test_tokio.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
on:
2+
push:
3+
branches: ["master"]
4+
pull_request:
5+
branches: ["master"]
6+
7+
name: Test tokio
8+
9+
env:
10+
RUSTFLAGS: -Dwarnings
11+
RUST_BACKTRACE: 1
12+
nightly: nightly-2020-01-25
13+
14+
jobs:
15+
test_tokio:
16+
name: Test tokio full
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os:
21+
- windows-latest
22+
- ubuntu-latest
23+
- macos-latest
24+
steps:
25+
- uses: actions/checkout@master
26+
27+
# Run `tokio` with only `full`
28+
- uses: actions-rs/cargo@v1
29+
with:
30+
command: test
31+
args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full
32+
name: tokio - cargo test --features full
33+
34+
# Run `tokio` with "unstable" cfg flag
35+
- uses: actions-rs/cargo@v1
36+
with:
37+
command: test
38+
args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full
39+
env:
40+
RUSTFLAGS: '--cfg tokio_unstable'
41+
name: tokio - cargo test --features full --cfg tokio_unstable
42+
43+
test_cross_subcrates:
44+
name: Test ${{ matrix.crate }} (${{ matrix.os }}) all-features
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
matrix:
48+
crate:
49+
- tokio
50+
- tests-integration
51+
os:
52+
- windows-latest
53+
- ubuntu-latest
54+
- macos-latest
55+
include:
56+
- crate: tokio-macros
57+
os: ubuntu-latest
58+
- crate: tokio-test
59+
os: ubuntu-latest
60+
- crate: tokio-util
61+
os: ubuntu-latest
62+
- crate: examples
63+
os: ubuntu-latest
64+
65+
steps:
66+
- uses: actions/checkout@master
67+
68+
# Run with all crate features
69+
- name: ${{ matrix.crate }} - cargo test --all-features
70+
uses: actions-rs/cargo@v1
71+
with:
72+
command: test
73+
args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features
74+
75+
# Check benches
76+
- name: ${{ matrix.crate }} - cargo check --benches
77+
uses: actions-rs/cargo@v1
78+
with:
79+
command: check
80+
args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches
81+
82+
- name: Patch Cargo.toml
83+
shell: bash
84+
run: |
85+
set -e
86+
87+
# Remove any existing patch statements
88+
mv Cargo.toml Cargo.toml.bck
89+
sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml
90+
91+
# Patch all crates
92+
cat ci/patch.toml >> Cargo.toml
93+
94+
# Print `Cargo.toml` for debugging
95+
echo "~~~~ Cargo.toml ~~~~"
96+
cat Cargo.toml
97+
echo "~~~~~~~~~~~~~~~~~~~~"
98+
99+
# Run with all crate features
100+
- name: ${{ matrix.crate }} - cargo test --all-features
101+
uses: actions-rs/cargo@v1
102+
with:
103+
command: test
104+
args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features
105+
106+
test_integration:
107+
name: Integration tests
108+
runs-on: ${{ matrix.os }}
109+
strategy:
110+
matrix:
111+
os:
112+
- windows-latest
113+
- ubuntu-latest
114+
- macos-latest
115+
steps:
116+
- uses: actions/checkout@master
117+
- run: cargo install cargo-hack
118+
name: Install cargo-hack
119+
- uses: actions-rs/cargo@v1
120+
name: cargo hack test --each-feature
121+
with:
122+
command: hack
123+
args: test --manifest-path ${{ github.workspace }}/tests-integration/Cargo.toml --each-feature

0 commit comments

Comments
 (0)