Skip to content

Commit 00d1efc

Browse files
Fix CI tests
Divide the "tests" job in 3 different jobs, one for OS. Needed because different OSes need different compilation methods for tor, as well as different methods for installing the tor binary. Windows is compiled without the tor feature, and cross-compiled from linux with the tor feature.
1 parent ab75952 commit 00d1efc

File tree

1 file changed

+89
-8
lines changed

1 file changed

+89
-8
lines changed

.github/workflows/rust.yml

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ name: CI
33
on: [pull_request]
44

55
jobs:
6-
tests:
6+
linux-tests:
77
strategy:
88
matrix:
99
toolchain:
1010
- nightly
1111
- 1.43
12-
os:
13-
- ubuntu-latest
14-
- macOS-latest
15-
- windows-latest
16-
runs-on: ${{ matrix.os }}
12+
runs-on: ubuntu-latest
1713
steps:
1814
- name: Checkout source code
1915
uses: actions/checkout@v2
@@ -23,14 +19,99 @@ jobs:
2319
toolchain: ${{ matrix.toolchain }}
2420
override: true
2521
profile: minimal
22+
# We need to download Tor for the tests. Not needed if
23+
# you don't run the tor-specific tests, which need to
24+
# start a tor HS from command line.
25+
- name: Download Tor
26+
run: sudo apt-get install -y tor
2627
- name: Build on Rust ${{ matrix.toolchain }}
27-
run: cargo build --verbose --color always
28+
run: cargo build --all-features --verbose --color always
2829
- name: Test on Rust ${{ matrix.toolchain }}
2930
run: cargo test --all-features --verbose --color always
3031
- name: Fuzz
31-
if: matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly'
32+
if: matrix.toolchain == 'nightly'
3233
run: ./fuzz/run.sh
3334

35+
macos-tests:
36+
strategy:
37+
matrix:
38+
toolchain:
39+
- nightly
40+
- 1.43
41+
runs-on: macOS-latest
42+
steps:
43+
- name: Checkout source code
44+
uses: actions/checkout@v2
45+
- name: Install Rust ${{ matrix.toolchain }} toolchain
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
toolchain: ${{ matrix.toolchain }}
49+
override: true
50+
profile: minimal
51+
# We need to download Tor for the tests. Not needed if
52+
# you don't run the tor-specific tests, which need to
53+
# start a tor HS from command line.
54+
- name: Download deps
55+
run: brew install tor autoconf automake
56+
- name: Build on Rust ${{ matrix.toolchain }}
57+
run: cargo build --all-features -vv --color always
58+
- name: Test on Rust ${{ matrix.toolchain }}
59+
run: cargo test --all-features -vv --color always
60+
61+
windows-tests:
62+
strategy:
63+
matrix:
64+
toolchain:
65+
- nightly
66+
- 1.43
67+
runs-on: windows-latest
68+
steps:
69+
- name: Checkout source code
70+
uses: actions/checkout@v2
71+
- name: Install Rust ${{ matrix.toolchain }} toolchain
72+
uses: actions-rs/toolchain@v1
73+
with:
74+
toolchain: ${{ matrix.toolchain }}
75+
override: true
76+
profile: minimal
77+
- name: Build on Rust ${{ matrix.toolchain }}
78+
# We can't compile tor on windows, cross-compile only :)
79+
run: cargo build --verbose --color always
80+
- name: Test on Rust ${{ matrix.toolchain }}
81+
run: cargo test --verbose --color always
82+
83+
# We only cross compile revualt_net with the tor feature for windows,
84+
# but we don't run any test. In the future we could download the artifact
85+
# from CI and try to run it *somehow*, at the moment I think the tests
86+
# are Unix dependent anyways.
87+
windows-cross-compile-tor:
88+
strategy:
89+
matrix:
90+
toolchain:
91+
- nightly
92+
- 1.43
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Checkout source code
96+
uses: actions/checkout@v2
97+
- name: Install needed deps
98+
run: sudo apt-get update && sudo apt-get install -y mingw-w64 tar
99+
- name: Install Rust ${{ matrix.toolchain }} toolchain
100+
uses: actions-rs/toolchain@v1
101+
with:
102+
toolchain: ${{ matrix.toolchain }}
103+
target: x86_64-pc-windows-gnu
104+
override: true
105+
profile: minimal
106+
# libsodium build.rs is broken: https://github.com/sodiumoxide/sodiumoxide/issues/377
107+
# We need to manually download libsodium and give it to cargo while compiling
108+
# Note that we could use the libsodium.a already provided in sodiumoxide, but it's tricky to find
109+
# FIXME: we are not verifying sigs!! In CI who cares but don't forget to verify them in real life lol
110+
- name: Download libsodium
111+
run: wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-mingw.tar.gz && tar xvf libsodium-1.0.18-mingw.tar.gz
112+
- name: Build on Rust ${{ matrix.toolchain }}
113+
run: SODIUM_LIB_DIR=$PWD/libsodium-win64/lib/ cargo build -vv --color always --all-features --target x86_64-pc-windows-gnu
114+
34115
rustfmt_check:
35116
runs-on: ubuntu-latest
36117
steps:

0 commit comments

Comments
 (0)