|
| 1 | +name: Cross-platform CICD |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + cicd-linux: |
| 7 | + name: CICD Linux |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout sources |
| 11 | + uses: actions/checkout@v2 |
| 12 | + |
| 13 | + - name: Install stable toolchain |
| 14 | + uses: actions-rs/toolchain@v1 |
| 15 | + with: |
| 16 | + toolchain: stable |
| 17 | + |
| 18 | + - name: Get temporary secret key |
| 19 | + shell: sh |
| 20 | + run: | |
| 21 | + mv src/secret.key.sample src/secret.key |
| 22 | + |
| 23 | + - name: Cache cargo registry |
| 24 | + uses: actions/cache@v1 |
| 25 | + with: |
| 26 | + path: ~/.cargo/registry |
| 27 | + key: ${{ runner.os }}-registry-${{ hashFiles('**/Cargo.lock') }} |
| 28 | + restore-keys: | |
| 29 | + ${{ runner.os }}-registry- |
| 30 | + ${{ runner.os }}- |
| 31 | +
|
| 32 | + - name: Cache cargo index |
| 33 | + uses: actions/cache@v1 |
| 34 | + with: |
| 35 | + path: ~/.cargo/git |
| 36 | + key: ${{ runner.os }}-index-${{ hashFiles('**/Cargo.lock') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-index- |
| 39 | + ${{ runner.os }}- |
| 40 | +
|
| 41 | + - name: Cache cargo build |
| 42 | + uses: actions/cache@v1 |
| 43 | + with: |
| 44 | + path: target |
| 45 | + key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }} |
| 46 | + restore-keys: | |
| 47 | + ${{ runner.os }}-build- |
| 48 | + ${{ runner.os }}- |
| 49 | +
|
| 50 | + - name: Run cargo check |
| 51 | + uses: actions-rs/cargo@v1 |
| 52 | + with: |
| 53 | + command: check |
| 54 | + args: --release |
| 55 | + |
| 56 | + - name: Run cargo fmt |
| 57 | + uses: actions-rs/cargo@v1 |
| 58 | + continue-on-error: true |
| 59 | + with: |
| 60 | + command: fmt |
| 61 | + args: --all -- --check |
| 62 | + |
| 63 | + - name: Run cargo clippy |
| 64 | + uses: actions-rs/cargo@v1 |
| 65 | + continue-on-error: true |
| 66 | + with: |
| 67 | + command: clippy |
| 68 | + args: -- -D warnings |
| 69 | + |
| 70 | + - name: Run cargo build |
| 71 | + uses: actions-rs/cargo@v1 |
| 72 | + with: |
| 73 | + command: build |
| 74 | + args: --release |
| 75 | + |
| 76 | + cicd-windows: |
| 77 | + name: CICD Windows |
| 78 | + runs-on: windows-latest |
| 79 | + steps: |
| 80 | + - name: Checkout sources |
| 81 | + uses: actions/checkout@v2 |
| 82 | + |
| 83 | + - name: Install stable toolchain |
| 84 | + uses: actions-rs/toolchain@v1 |
| 85 | + with: |
| 86 | + toolchain: stable |
| 87 | + |
| 88 | + - name: Download libpq.lib |
| 89 | + run: | |
| 90 | + New-Item -Path "." -Name "libs" -ItemType "directory" |
| 91 | + Invoke-WebRequest -Uri https://sakadream.me/cloud/index.php/s/JXnJvyjifGBPuR2/download -OutFile libs\libpq.lib |
| 92 | +
|
| 93 | + - name: Get temporary secret key |
| 94 | + shell: cmd |
| 95 | + run: ren src\secret.key.sample secret.key |
| 96 | + |
| 97 | + - name: Cache cargo registry |
| 98 | + uses: actions/cache@v1 |
| 99 | + with: |
| 100 | + path: ~/.cargo/registry |
| 101 | + key: ${{ runner.os }}-registry-${{ hashFiles('**/Cargo.lock') }} |
| 102 | + restore-keys: | |
| 103 | + ${{ runner.os }}-registry- |
| 104 | + ${{ runner.os }}- |
| 105 | +
|
| 106 | + - name: Cache cargo index |
| 107 | + uses: actions/cache@v1 |
| 108 | + with: |
| 109 | + path: ~/.cargo/git |
| 110 | + key: ${{ runner.os }}-index-${{ hashFiles('**/Cargo.lock') }} |
| 111 | + restore-keys: | |
| 112 | + ${{ runner.os }}-index- |
| 113 | + ${{ runner.os }}- |
| 114 | + |
| 115 | + - name: Cache cargo build |
| 116 | + uses: actions/cache@v1 |
| 117 | + with: |
| 118 | + path: target |
| 119 | + key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }} |
| 120 | + restore-keys: | |
| 121 | + ${{ runner.os }}-build- |
| 122 | + ${{ runner.os }}- |
| 123 | +
|
| 124 | + - name: Run cargo check |
| 125 | + uses: actions-rs/cargo@v1 |
| 126 | + with: |
| 127 | + command: check |
| 128 | + args: --release |
| 129 | + env: |
| 130 | + RUSTFLAGS: -L D:\a\actix-web-rest-api-with-jwt\actix-web-rest-api-with-jwt\libs |
| 131 | + |
| 132 | + - name: Run cargo fmt |
| 133 | + uses: actions-rs/cargo@v1 |
| 134 | + continue-on-error: true |
| 135 | + with: |
| 136 | + command: fmt |
| 137 | + args: --all -- --check |
| 138 | + |
| 139 | + - name: Run cargo clippy |
| 140 | + uses: actions-rs/cargo@v1 |
| 141 | + continue-on-error: true |
| 142 | + with: |
| 143 | + command: clippy |
| 144 | + args: -- -D warnings |
| 145 | + |
| 146 | + - name: Run cargo build |
| 147 | + uses: actions-rs/cargo@v1 |
| 148 | + with: |
| 149 | + command: build |
| 150 | + args: --release |
| 151 | + env: |
| 152 | + RUSTFLAGS: -L D:\a\actix-web-rest-api-with-jwt\actix-web-rest-api-with-jwt\libs |
| 153 | + |
| 154 | + cicd-macos: |
| 155 | + name: CICD macOS |
| 156 | + runs-on: macos-latest |
| 157 | + steps: |
| 158 | + - name: Checkout sources |
| 159 | + uses: actions/checkout@v2 |
| 160 | + |
| 161 | + - name: Install stable toolchain |
| 162 | + uses: actions-rs/toolchain@v1 |
| 163 | + with: |
| 164 | + toolchain: stable |
| 165 | + |
| 166 | + - name: Get temporary secret key |
| 167 | + shell: sh |
| 168 | + run: | |
| 169 | + mv src/secret.key.sample src/secret.key |
| 170 | + |
| 171 | + - name: Cache cargo registry |
| 172 | + uses: actions/cache@v1 |
| 173 | + with: |
| 174 | + path: ~/.cargo/registry |
| 175 | + key: ${{ runner.os }}-registry-${{ hashFiles('**/Cargo.lock') }} |
| 176 | + restore-keys: | |
| 177 | + ${{ runner.os }}-registry- |
| 178 | + ${{ runner.os }}- |
| 179 | +
|
| 180 | + - name: Cache cargo index |
| 181 | + uses: actions/cache@v1 |
| 182 | + with: |
| 183 | + path: ~/.cargo/git |
| 184 | + key: ${{ runner.os }}-index-${{ hashFiles('**/Cargo.lock') }} |
| 185 | + restore-keys: | |
| 186 | + ${{ runner.os }}-index- |
| 187 | + ${{ runner.os }}- |
| 188 | + |
| 189 | + - name: Cache cargo build |
| 190 | + uses: actions/cache@v1 |
| 191 | + with: |
| 192 | + path: target |
| 193 | + key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }} |
| 194 | + restore-keys: | |
| 195 | + ${{ runner.os }}-build- |
| 196 | + ${{ runner.os }}- |
| 197 | +
|
| 198 | + - name: Run cargo check |
| 199 | + uses: actions-rs/cargo@v1 |
| 200 | + with: |
| 201 | + command: check |
| 202 | + args: --release |
| 203 | + |
| 204 | + - name: Run cargo fmt |
| 205 | + uses: actions-rs/cargo@v1 |
| 206 | + continue-on-error: true |
| 207 | + with: |
| 208 | + command: fmt |
| 209 | + args: --all -- --check |
| 210 | + |
| 211 | + - name: Run cargo clippy |
| 212 | + uses: actions-rs/cargo@v1 |
| 213 | + continue-on-error: true |
| 214 | + with: |
| 215 | + command: clippy |
| 216 | + args: -- -D warnings |
| 217 | + |
| 218 | + - name: Run cargo build |
| 219 | + uses: actions-rs/cargo@v1 |
| 220 | + with: |
| 221 | + command: build |
| 222 | + args: --release |
0 commit comments