|
| 1 | +name: CI (master only) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build_and_test: |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + target: |
| 13 | + - { name: Linux, os: ubuntu-latest, triple: x86_64-unknown-linux-gnu } |
| 14 | + - { name: macOS, os: macos-latest, triple: x86_64-apple-darwin } |
| 15 | + - { name: Windows, os: windows-latest, triple: x86_64-pc-windows-msvc } |
| 16 | + - { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu } |
| 17 | + - { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc } |
| 18 | + version: |
| 19 | + - nightly |
| 20 | + |
| 21 | + name: ${{ matrix.target.name }} / ${{ matrix.version }} |
| 22 | + runs-on: ${{ matrix.target.os }} |
| 23 | + |
| 24 | + env: |
| 25 | + VCPKGRS_DYNAMIC: 1 |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Setup Routing |
| 29 | + if: matrix.target.os == 'macos-latest' |
| 30 | + run: sudo ifconfig lo0 alias 127.0.0.3 |
| 31 | + |
| 32 | + - uses: actions/checkout@v2 |
| 33 | + |
| 34 | + # install OpenSSL on Windows |
| 35 | + - name: Set vcpkg root |
| 36 | + if: matrix.target.triple == 'x86_64-pc-windows-msvc' || matrix.target.triple == 'i686-pc-windows-msvc' |
| 37 | + run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 38 | + - name: Install OpenSSL |
| 39 | + if: matrix.target.triple == 'x86_64-pc-windows-msvc' |
| 40 | + run: vcpkg install openssl:x64-windows |
| 41 | + - name: Install OpenSSL |
| 42 | + if: matrix.target.triple == 'i686-pc-windows-msvc' |
| 43 | + run: vcpkg install openssl:x86-windows |
| 44 | + |
| 45 | + - name: Install ${{ matrix.version }} |
| 46 | + uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + toolchain: ${{ matrix.version }}-${{ matrix.target.triple }} |
| 49 | + profile: minimal |
| 50 | + override: true |
| 51 | + |
| 52 | + # - name: Install MSYS2 |
| 53 | + # if: matrix.target.triple == 'x86_64-pc-windows-gnu' |
| 54 | + # uses: msys2/setup-msys2@v2 |
| 55 | + # - name: Install MinGW Packages |
| 56 | + # if: matrix.target.triple == 'x86_64-pc-windows-gnu' |
| 57 | + # run: | |
| 58 | + # msys2 -c 'pacman -Sy --noconfirm pacman' |
| 59 | + # msys2 -c 'pacman --noconfirm -S base-devel pkg-config' |
| 60 | + |
| 61 | + # - name: Generate Cargo.lock |
| 62 | + # uses: actions-rs/cargo@v1 |
| 63 | + # with: { command: generate-lockfile } |
| 64 | + # - name: Cache Dependencies |
| 65 | + # uses: Swatinem/[email protected] |
| 66 | + |
| 67 | + - name: Install cargo-hack |
| 68 | + uses: actions-rs/cargo@v1 |
| 69 | + with: |
| 70 | + command: install |
| 71 | + args: cargo-hack |
| 72 | + |
| 73 | + - name: check lib |
| 74 | + if: > |
| 75 | + matrix.target.os != 'ubuntu-latest' |
| 76 | + && matrix.target.triple != 'x86_64-pc-windows-gnu' |
| 77 | + uses: actions-rs/cargo@v1 |
| 78 | + with: { command: ci-check-lib } |
| 79 | + - name: check lib |
| 80 | + if: matrix.target.os == 'ubuntu-latest' |
| 81 | + uses: actions-rs/cargo@v1 |
| 82 | + with: { command: ci-check-lib-linux } |
| 83 | + - name: check lib |
| 84 | + if: matrix.target.triple == 'x86_64-pc-windows-gnu' |
| 85 | + uses: actions-rs/cargo@v1 |
| 86 | + with: { command: ci-check-min } |
| 87 | + |
| 88 | + - name: check full |
| 89 | + # TODO: compile OpenSSL and run tests on MinGW |
| 90 | + if: > |
| 91 | + matrix.target.os != 'ubuntu-latest' |
| 92 | + && matrix.target.triple != 'x86_64-pc-windows-gnu' |
| 93 | + uses: actions-rs/cargo@v1 |
| 94 | + with: { command: ci-check } |
| 95 | + - name: check all |
| 96 | + if: matrix.target.os == 'ubuntu-latest' |
| 97 | + uses: actions-rs/cargo@v1 |
| 98 | + with: { command: ci-check-linux } |
| 99 | + |
| 100 | + - name: tests |
| 101 | + if: > |
| 102 | + matrix.target.os != 'ubuntu-latest' |
| 103 | + && matrix.target.triple != 'x86_64-pc-windows-gnu' |
| 104 | + run: | |
| 105 | + cargo ci-test |
| 106 | + cargo ci-test-rt |
| 107 | + cargo ci-test-server |
| 108 | + - name: tests |
| 109 | + if: matrix.target.os == 'ubuntu-latest' |
| 110 | + run: | |
| 111 | + sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-rt-linux && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-server-linux" |
| 112 | +
|
| 113 | + - name: Clear the cargo caches |
| 114 | + run: | |
| 115 | + cargo install cargo-cache --version 0.6.2 --no-default-features --features ci-autoclean |
| 116 | + cargo-cache |
| 117 | +
|
| 118 | + coverage: |
| 119 | + name: coverage |
| 120 | + runs-on: ubuntu-latest |
| 121 | + steps: |
| 122 | + - uses: actions/checkout@v2 |
| 123 | + |
| 124 | + - name: Install Rust (nightly) |
| 125 | + uses: actions-rs/toolchain@v1 |
| 126 | + with: |
| 127 | + toolchain: stable-x86_64-unknown-linux-gnu |
| 128 | + profile: minimal |
| 129 | + override: true |
| 130 | + |
| 131 | + - name: Generate Cargo.lock |
| 132 | + uses: actions-rs/cargo@v1 |
| 133 | + with: { command: generate-lockfile } |
| 134 | + - name: Cache Dependencies |
| 135 | + |
| 136 | + |
| 137 | + - name: Generate coverage file |
| 138 | + if: github.ref == 'refs/heads/master' |
| 139 | + run: | |
| 140 | + cargo install cargo-tarpaulin |
| 141 | + cargo tarpaulin --out Xml --verbose |
| 142 | + - name: Upload to Codecov |
| 143 | + if: github.ref == 'refs/heads/master' |
| 144 | + uses: codecov/codecov-action@v1 |
| 145 | + with: { file: cobertura.xml } |
0 commit comments