|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - 'staging.tmp' |
| 7 | + - 'trying.tmp' |
| 8 | + |
| 9 | +jobs: |
| 10 | + static_analysis: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout sources |
| 14 | + uses: actions/checkout@v1 |
| 15 | + |
| 16 | + - name: Extract toolchain version from rust-toolchain |
| 17 | + run: echo "::set-env name=RUST_TOOLCHAIN::$(cat rust-toolchain)" |
| 18 | + |
| 19 | + - name: Install ${{ env.RUST_TOOLCHAIN }} toolchain |
| 20 | + uses: actions-rs/toolchain@v1 |
| 21 | + with: |
| 22 | + profile: minimal |
| 23 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 24 | + override: true |
| 25 | + |
| 26 | + - name: Cache ~/.cargo/bin directory |
| 27 | + uses: actions/cache@v1 |
| 28 | + with: |
| 29 | + path: ~/.cargo/bin |
| 30 | + key: ubuntu-rust-${{ env.RUST_TOOLCHAIN }}-cargo-bin-directory |
| 31 | + |
| 32 | + - name: Check formatting |
| 33 | + run: make check_format |
| 34 | + |
| 35 | + - name: Run linter |
| 36 | + run: make clippy |
| 37 | + |
| 38 | + build: |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: [macos-latest, ubuntu-latest] |
| 42 | + runs-on: ${{ matrix.os }} |
| 43 | + steps: |
| 44 | + - name: Checkout sources |
| 45 | + uses: actions/checkout@v1 |
| 46 | + |
| 47 | + - name: Extract toolchain version from rust-toolchain |
| 48 | + run: echo "::set-env name=RUST_TOOLCHAIN::$(cat rust-toolchain)" |
| 49 | + |
| 50 | + - name: Install ${{ env.RUST_TOOLCHAIN }} toolchain |
| 51 | + uses: actions-rs/toolchain@v1 |
| 52 | + with: |
| 53 | + profile: minimal |
| 54 | + toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 55 | + override: true |
| 56 | + |
| 57 | + - name: Cache target directory |
| 58 | + uses: actions/cache@v1 |
| 59 | + with: |
| 60 | + path: target |
| 61 | + key: ${{ matrix.os }}-rust-${{ env.RUST_TOOLCHAIN }}-target-directory-${{ hashFiles('Cargo.lock') }} |
| 62 | + |
| 63 | + - name: Cache ~/.cargo/registry directory |
| 64 | + uses: actions/cache@v1 |
| 65 | + with: |
| 66 | + path: ~/.cargo/registry |
| 67 | + key: ${{ matrix.os }}-rust-${{ env.RUST_TOOLCHAIN }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }} |
| 68 | + |
| 69 | + - name: Build ${{ matrix.os }} binary |
| 70 | + run: make build |
| 71 | + |
| 72 | + # Ignore tests on macos due to missing docker |
| 73 | + - name: Run unit tests |
| 74 | + if: matrix.os != 'macos-latest' |
| 75 | + run: make test |
| 76 | + |
| 77 | + - name: Upload cnd-${{ matrix.os }} archive that contains the cnd binary |
| 78 | + uses: actions/upload-artifact@v1 |
| 79 | + with: |
| 80 | + name: cnd-${{ matrix.os }} |
| 81 | + path: target/debug/cnd |
| 82 | + |
| 83 | + e2e_test: |
| 84 | + strategy: |
| 85 | + matrix: |
| 86 | + os: [macos-latest, ubuntu-latest] |
| 87 | + runs-on: ${{ matrix.os }} |
| 88 | + needs: build |
| 89 | + steps: |
| 90 | + - name: Checkout sources |
| 91 | + uses: actions/checkout@v1 |
| 92 | + |
| 93 | + - name: Download cnd-${{ matrix.os }} archive and extract cnd binary |
| 94 | + uses: actions/download-artifact@v1 |
| 95 | + with: |
| 96 | + name: cnd-${{ matrix.os }} |
| 97 | + path: target/debug/ |
| 98 | + |
| 99 | + - name: Fix missing executable permission |
| 100 | + run: | |
| 101 | + chmod a+x target/debug/cnd |
| 102 | +
|
| 103 | + - name: Install NodeJS 12.x |
| 104 | + uses: actions/setup-node@v1 |
| 105 | + with: |
| 106 | + node-version: '12.x' |
| 107 | + |
| 108 | + - name: Install Go 1.13.3. |
| 109 | + uses: actions/setup-go@v1 |
| 110 | + with: |
| 111 | + go-version: '1.13.3' |
| 112 | + |
| 113 | + - name: Install LND v0.9.1-beta |
| 114 | + run: | |
| 115 | + go get -d github.com/lightningnetwork/lnd |
| 116 | + cd ~/go/src/github.com/lightningnetwork/lnd |
| 117 | + git checkout v0.9.1-beta |
| 118 | + make tags=invoicesrpc |
| 119 | + make tags=invoicesrpc install |
| 120 | +
|
| 121 | + - name: Run e2e tests |
| 122 | + run: | |
| 123 | + export PATH=$HOME/.cargo/bin:$HOME/.local/bin:$HOME/go/bin:$PATH |
| 124 | + make ci_gha |
0 commit comments