-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (89 loc) · 3.08 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Build
on: [push]
jobs:
notify_start:
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
env:
HAS_ROOM_ID: ${{ secrets.MATRIX_ROOM_ID }}
steps:
- name: Build started notification
uses: s3krit/[email protected]
if: ${{ env.HAS_ROOM_ID }}
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "mxrxtx ${{ github.sha }} build started. [Progress.](https://github.com/eras/mxrxtx/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
build:
needs: notify_start
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
# macos-latest removed as it segfaults
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install build deps
run: sudo apt-get install git
if: ${{ matrix.os == 'ubuntu-latest' }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Clippy
run: 'cargo clippy --no-deps'
- name: Unit tests
run: 'cargo test'
- name: Build
run: 'cargo build --locked'
if: ${{ matrix.os != 'windows-latest' }}
- name: Build
run: 'cargo build' # difficult to create proper lock file for Windows outside ci
if: ${{ matrix.os == 'windows-latest' }}
- uses: actions/upload-artifact@v2
with:
name: mxrxtx-${{ runner.os }}
path: |
target/debug/mxrxtx
Cargo.lock
if: ${{ matrix.os != 'windows-latest' }}
- uses: actions/upload-artifact@v2
with:
name: mxrxtx-${{ runner.os }}.exe
path: |
target/debug/mxrxtx.exe
Cargo.lock
if: ${{ matrix.os == 'windows-latest' }}
notify_end_success:
runs-on: ubuntu-latest
if: ${{ success() }}
needs: [notify_start, build]
env:
HAS_ROOM_ID: ${{ secrets.MATRIX_ROOM_ID }}
steps:
- name: Build succeeded notification
uses: s3krit/[email protected]
if: ${{ env.HAS_ROOM_ID }}
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "mxrxtx ${{ github.sha }} build complete OK. [Logs.](https://github.com/eras/mxrxtx/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
notify_end_failed:
runs-on: ubuntu-latest
needs: [notify_start, build]
if: ${{ failure() }}
env:
HAS_ROOM_ID: ${{ secrets.MATRIX_ROOM_ID }}
steps:
- name: Build failed notification
uses: s3krit/[email protected]
if: ${{ env.HAS_ROOM_ID }}
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "mxrxtx ${{ github.sha }} build failed. [Logs.](https://github.com/eras/mxrxtx/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}