@@ -23,14 +23,31 @@ jobs:
2323 profile : minimal
2424 override : true
2525
26- - name : Cache cargo binaries, registry and target directory
26+ - name : Install NodeJS 14.x
27+ uses : actions/setup-node@v1
28+ with :
29+ node-version : ' 14.x'
30+
31+ - name : Cache cargo registry
2732 uses : actions/cache@v2
2833 with :
29- path : |
30- ~/.cargo/bin
31- ~/.cargo/registry
32- target
33- key : ubuntu-rust-${{ steps.toolchain.outputs.rustc-hash }}
34+ path : ~/.cargo/registry
35+ # The registry cache is useful as long as we need the same dependencies as another job, regardless of the Rust version and operating system.
36+ key : cargo-registry-${{ hashFiles('Cargo.lock') }}-v2
37+
38+ - name : Cache cargo binaries
39+ uses : actions/cache@v2
40+ with :
41+ path : ~/.cargo/bin
42+ # The cargo binary cache is useful as long as we use the same Rust version but regardless of our dependencies.
43+ key : ubuntu-latest-cargo-binaries-${{ steps.toolchain.outputs.rustc_hash }}-v2
44+
45+ - name : Cache target directory
46+ uses : actions/cache@v2
47+ with :
48+ path : target
49+ # The target directory is only useful with the same Rust version, dependencies and operating system.
50+ key : ubuntu-latest-target-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('Cargo.lock') }}-clippy-v2
3451
3552 - name : Check formatting
3653 run : make check_format
4562 include :
4663 - os : ubuntu-latest
4764 e2e : true
65+ - os : macos-latest
66+ e2e : true
4867 runs-on : ${{ matrix.os }}
4968 steps :
5069 - name : Checkout sources
@@ -57,14 +76,27 @@ jobs:
5776 profile : minimal
5877 override : true
5978
60- - name : Cache cargo binaries, registry and target directory
79+ - name : Cache cargo registry
80+ uses : actions/cache@v2
81+ with :
82+ path : ~/.cargo/registry
83+ # The registry cache is useful as long as we need the same dependencies as another job, regardless of the Rust version and operating system.
84+ key : cargo-registry-${{ hashFiles('Cargo.lock') }}-v3
85+
86+ - name : Cache cargo binaries
6187 uses : actions/cache@v2
6288 with :
63- path : |
64- ~/.cargo/bin
65- ~/.cargo/registry
66- target
67- key : ubuntu-rust-${{ steps.toolchain.outputs.rustc-hash }}
89+ path : ~/.cargo/bin
90+ # The cargo binary cache is useful as long as we use the same Rust version and operating system, but regardless of our dependencies.
91+ key : ${{ matrix.os }}-cargo-binaries-${{ steps.toolchain.outputs.rustc_hash }}-v2
92+
93+ - name : Cache target directory
94+ uses : actions/cache@v2
95+ if : matrix.os == 'ubuntu-latest'
96+ with :
97+ path : target
98+ # The target directory is only useful with the same Rust version, dependencies and operating system.
99+ key : ${{ matrix.os }}-target-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('Cargo.lock') }}-build-v3
68100
69101 - name : Build ${{ matrix.os }} binary
70102 run : make build
@@ -77,59 +109,73 @@ jobs:
77109 if : matrix.os == 'ubuntu-latest'
78110 run : make test
79111
112+ # We've ran `cargo build --all-targets` earlier, that is different to from just building the binary.
113+ # Our e2e tests lazily re-build the binaries, that can timeout our tests so build them here in advance.
114+ - name : Build binaries for e2e test
115+ if : matrix.e2e
116+ run : |
117+ cargo build -p cnd
118+ cargo build -p nectar
119+
80120 - name : Upload cnd-${{ matrix.os }} archive that contains the cnd binary
81- if : matrix.os == 'ubuntu-latest'
121+ if : matrix.e2e
82122 uses : actions/upload-artifact@v1
83123 with :
84124 name : cnd-${{ matrix.os }}
85125 path : target/debug/cnd
86126
87- # # Run e2e tests
88- - name : Install NodeJS 12.x
127+ - name : Upload nectar-${{ matrix.os }} archive that contains the nectar binary
128+ if : matrix.e2e
129+ uses : actions/upload-artifact@v1
130+ with :
131+ name : nectar-${{ matrix.os }}
132+ path : target/debug/nectar
133+
134+ - name : Install NodeJS 14.x
89135 if : matrix.e2e
90136 uses : actions/setup-node@v1
91137 with :
92- node-version : ' 12 .x'
138+ node-version : ' 14 .x'
93139
94140 - name : Cache node_modules directory
95141 if : matrix.e2e
96142 uses : actions/cache@v2
97143 with :
98- path : api_tests /node_modules
99- key : ${{ matrix.os }}-node-modules-directory-${{ hashFiles('api_tests /package.json') }}
144+ path : tests /node_modules
145+ key : ${{ matrix.os }}-node-14-node- modules-directory-${{ hashFiles('tests /package.json') }}
100146
101147 - name : Run e2e tests
102148 if : matrix.e2e
103149 run : |
104150 export PATH=$HOME/.cargo/bin:$HOME/.local/bin:$PATH
105- cd api_tests
151+ cd tests
106152 yarn install
107- yarn ci
153+ yarn test
108154
109155 - name : Upload bitcoind log
110156 if : matrix.e2e && failure()
111157 uses : actions/upload-artifact@v2-preview
112158 with :
113- name : e2e-logs-bitcoind.log
114- path : api_tests /log/bitcoind/regtest/debug.log
159+ name : ${{ matrix.os }}- e2e-logs-bitcoind.log
160+ path : tests /log/bitcoind/regtest/debug.log
115161
116162 - name : Upload parity log
117163 if : matrix.e2e && failure()
118164 uses : actions/upload-artifact@v2-preview
119165 with :
120- name : e2e-logs-parity.log
121- path : api_tests /log/parity/parity.log
166+ name : ${{ matrix.os }}- e2e-logs-parity.log
167+ path : tests /log/parity/parity.log
122168
123169 - name : Upload lnd logs
124170 if : matrix.e2e && failure()
125171 uses : actions/upload-artifact@v2-preview
126172 with :
127- name : e2e-logs-lnd
128- path : api_tests /log/lnd-*/logs/bitcoin/regtest/lnd.log
173+ name : ${{ matrix.os }}- e2e-logs-lnd
174+ path : tests /log/lnd-*/logs/bitcoin/regtest/lnd.log
129175
130176 - name : Upload e2e logs
131177 if : matrix.e2e && failure()
132178 uses : actions/upload-artifact@v2-preview
133179 with :
134- name : e2e-test-logs
135- path : api_tests /log/tests/
180+ name : ${{ matrix.os }}- e2e-test-logs
181+ path : tests /log/tests/
0 commit comments