1
1
on :
2
+ workflow_dispatch :
2
3
push :
3
4
branches :
4
5
- trying
@@ -21,14 +22,17 @@ jobs:
21
22
22
23
platform :
23
24
- target : x86_64-unknown-linux-gnu
25
+ name : ubuntu
24
26
host : ubuntu-latest
25
27
cross : false
26
28
27
29
- target : x86_64-apple-darwin
30
+ name : macos
28
31
host : macos-latest
29
32
cross : false
30
33
31
34
- target : x86_64-pc-windows-msvc
35
+ name : windows
32
36
host : windows-latest
33
37
cross : false
34
38
@@ -37,18 +41,22 @@ jobs:
37
41
# was metered.
38
42
#
39
43
# - target: armv7-linux-androideabi
44
+ # name: android (armv7)
40
45
# host: ubuntu-latest
41
46
# cross: true
42
47
#
43
48
# - target: aarch64-linux-android
49
+ # name: android (aarch64)
44
50
# host: ubuntu-latest
45
51
# cross: true
46
52
#
47
53
# - target: x86_64-apple-ios
54
+ # name: ios (x86_64)
48
55
# host: macos-latest
49
56
# cross: true
50
57
#
51
58
# - target: aarch64-apple-ios
59
+ # name: ios (aarch64)
52
60
# host: macos-latest
53
61
# cross: true
54
62
@@ -62,142 +70,128 @@ jobs:
62
70
DEBUG : ipfsd-ctl:* # enables all debug output from javascript 'debug' lib used by js-ipfsd-ctl
63
71
64
72
runs-on : ${{ matrix.platform.host }}
73
+ name : ${{ matrix.platform.name }}
65
74
steps :
66
75
- name : Checkout sources
67
76
uses : actions/checkout@v2
68
77
69
- - name : Cache cargo folder
70
- uses : actions/cache@v2
71
- with :
72
- path : |
73
- ~/.cargo/registry
74
- ~/.cargo/git
75
- key : ${{ matrix.platform.target }}-dot-cargo-parts-${{ hashFiles('Cargo.lock') }}
76
-
77
- - name : Get npm cache directory
78
- id : npm-cache
79
- if : matrix.platform.cross == false
80
- run : |
81
- echo "::set-output name=dir::$(npm config get cache)"
82
-
83
- - name : Cache npm (non-cross targets)
84
- uses : actions/cache@v2
85
- if : matrix.platform.cross == false
86
- with :
87
- path : ${{ steps.npm-cache.outputs.dir }}
88
- key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json', '**/setup.sh', '**/*.patch') }}
89
- restore-keys : |
90
- ${{ runner.os }}-node-
91
-
92
- - name : Install dependencies ubuntu
78
+ - name : Install dependencies (linux)
93
79
if : matrix.platform.host == 'ubuntu-latest'
94
80
run : sudo apt-get install llvm-dev libssl-dev pkg-config
95
81
96
- - name : Install dependencies macos
82
+ - name : Install dependencies ( macos)
97
83
if : matrix.platform.host == 'macos-latest'
98
84
run : brew install llvm openssl
99
85
100
- - name : Download go-ipfs on Linux
101
- if : matrix.platform.host == 'ubuntu-latest'
102
- run : |
103
- curl -L https://github.com/ipfs/go-ipfs/releases/download/v0.7.0/go-ipfs_v0.7.0_linux-amd64.tar.gz --output go_ipfs.tar.gz
104
- tar -xf go_ipfs.tar.gz
105
-
106
- - name : Install dependencies windows (openssl)
86
+ - name : Install and cache vcpkg (windows)
107
87
uses : lukka/run-vcpkg@v7.4
108
88
id : windows-runvcpkg
109
89
if : matrix.platform.host == 'windows-latest'
110
90
with :
111
91
vcpkgDirectory : ' ${{ runner.workspace }}/vcpkg'
112
92
vcpkgTriplet : ' x64-windows'
113
- vcpkgArguments : ' openssl'
114
93
vcpkgGitCommitId : ' 261c458af6e3eed5d099144aff95d2b5035f656b' # unknown for openssl-sys v0.9.65
94
+ setupOnly : true # required for caching
95
+
96
+ - name : Install depedencies (windows)
97
+ if : matrix.platform.host == 'windows-latest'
98
+ run : " $VCPKG_ROOT/vcpkg install openssl:x64-windows"
99
+ shell : bash
100
+ env :
101
+ VCPKGRS_DYNAMIC : 1
115
102
116
103
- name : Install rust toolchain
117
104
uses : hecrj/setup-rust-action@v1.3.4
118
105
with :
119
106
rust-version : ${{ matrix.toolchain.rust }}
120
107
targets : ${{ matrix.platform.target }}
121
108
122
- - name : Install cargo-ndk
123
- if : contains(matrix.platform.target, 'android')
124
- run : cargo install --version '<2.0.0' cargo-ndk
109
+ - name : Rust cache
110
+ uses : Swatinem/rust-cache@v1
111
+ with :
112
+ # So that cross-compiles don't share a cache.
113
+ key : ${{ matrix.platform.target }}
125
114
126
- - name : Build (others)
115
+ - name : Cargo build
127
116
if : matrix.platform.cross == false
128
117
run : cargo build --workspace --all-targets
129
118
130
- - name : Run interop DHT tests with go-ipfs
131
- if : matrix.platform.host == 'ubuntu-latest' && matrix.platform.cross == false
132
- run : cargo test --features=test_go_interop dht
133
-
134
- - name : Setup conformance tests (non-cross targets)
135
- if : matrix.platform.cross == false
136
- run : ./setup.sh
137
- shell : bash
138
- working-directory : ./conformance
139
-
140
- - name : Build (android)
119
+ - name : Cargo build (cross compile, android)
141
120
if : contains(matrix.platform.target, 'android')
142
- run : cargo ndk --android-platform 29 --target ${{ matrix.platform.target }} build --workspace --exclude ipfs-http
121
+ run : |
122
+ cargo install --version '<2.0.0' cargo-ndk
123
+ cargo ndk --android-platform 29 --target ${{ matrix.platform.target }} build --workspace --exclude ipfs-http
143
124
# exclude http on android because openssl
144
125
145
- - name : Build other cross compilations
126
+ - name : Cargo build ( cross compile, non-android)
146
127
if : contains(matrix.platform.target, 'android') == false && matrix.platform.cross == true
147
128
run : cargo build --workspace --exclude ipfs-http --target ${{ matrix.platform.target }}
148
129
# exclude http on other cross compilation targets because openssl
149
130
150
- - name : Rust tests (macos)
151
- if : matrix.platform.cross == false && matrix.platform.host == 'macos-latest'
152
- run : |
153
- ulimit -c unlimited
154
- sudo touch /cores/test || { ls -ld /cores; exit 1; }
155
- sudo rm /cores/test
156
- retval=0
157
- sudo cargo test --workspace || retval=$?
158
- sudo chmod -R a+rwx /cores
159
- exit $retval
160
-
161
- - name : Rust tests (other non-cross targets)
162
- if : matrix.platform.cross == false && matrix.platform.host != 'macos-latest'
131
+ - name : Cargo test
132
+ if : matrix.platform.cross == false
163
133
run : cargo test --workspace
164
134
165
- - name : Conformance testing (non-cross targets)
135
+ - name : Interop DHT tests with go-ipfs (linux)
136
+ if : matrix.platform.host == 'ubuntu-latest' && matrix.platform.cross == false
137
+ run : |
138
+ curl -L https://github.com/ipfs/go-ipfs/releases/download/v0.7.0/go-ipfs_v0.7.0_linux-amd64.tar.gz --output go_ipfs.tar.gz
139
+ tar -xf go_ipfs.tar.gz
140
+ cargo test --features=test_go_interop dht
141
+
142
+ - name : " Conformance tests: cache config"
143
+ id : conformance-cache-config
144
+ if : matrix.platform.cross == false
145
+ run : |
146
+ echo "::set-output name=dir::$(npm config get cache)"
147
+ echo "::set-output name=ver::$(npm -v)"
148
+
149
+ - name : " Conformance tests: cache"
150
+ id : conformance-cache
151
+ if : matrix.platform.cross == false
152
+ uses : actions/cache@v2
153
+ with :
154
+ path : |
155
+ ${{ steps.conformance-cache-config.outputs.dir }}
156
+ ./conformance/node_modules
157
+ key : ${{ runner.os }}-conformance-${{ steps.conformance-cache-config.outputs.ver }} ${{ hashFiles('**/package-lock.json', '**/setup.sh', '**/*.patch') }}
158
+
159
+ - name : " Conformance tests: setup"
160
+ if : steps.conformance-cache.outputs.cache-hit != 'true' && matrix.platform.cross == false
161
+ run : ./setup.sh
162
+ shell : bash
163
+ working-directory : ./conformance
164
+
165
+ - name : " Conformance tests: run"
166
166
if : matrix.platform.cross == false
167
167
run : IPFS_RUST_EXEC=../target/debug/ipfs-http npm test
168
168
shell : bash
169
169
working-directory : ./conformance
170
170
171
- - name : Upload crashes (macos)
172
- uses : actions/upload-artifact@v2
173
- if : ${{ always() }}
174
- with :
175
- name : macos.crashes
176
- path : /cores
177
- if-no-files-found : ignore
171
+ # Work around for this issue: https://github.com/Swatinem/rust-cache/issues/26
172
+ - name : Fix cache permissions (macos)
173
+ if : matrix.platform.cross == false && matrix.platform.host == 'macos-latest'
174
+ run : sudo chown -R $(whoami):$(id -ng) ./target
178
175
179
176
lint-rust :
180
177
runs-on : ubuntu-latest
181
178
steps :
182
179
- name : Checkout sources
183
180
uses : actions/checkout@v2
184
181
185
- - name : Cache cargo folder
186
- uses : actions/cache@v2
187
- with :
188
- path : ~/.cargo
189
- key : lint-cargo-${{ hashFiles('Cargo.lock') }}
190
-
191
182
- name : Install rust toolchain
192
183
uses : hecrj/setup-rust-action@v1.3.4
193
184
with :
194
185
rust-version : stable
195
186
components : clippy, rustfmt
196
187
197
- - name : cargo fmt
188
+ - name : Rust cache
189
+ uses : Swatinem/rust-cache@v1
190
+
191
+ - name : Cargo fmt
198
192
run : cargo fmt --all -- --check
199
193
200
- - name : cargo clippy
194
+ - name : Cargo clippy
201
195
run : cargo clippy --all-targets --workspace -- -D warnings
202
196
203
197
# adapted from https://github.com/taiki-e/pin-project/blob/5878410863f5f25e21f7cba97b035501749850f9/.github/workflows/ci.yml#L136-L167
0 commit comments