-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (126 loc) · 4.52 KB
/
rust.yml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on: [push, pull_request]
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: ⚙️ Create issues from TODO comments
uses: ribtoks/tdg-github-action@master
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
SHA: ${{ github.sha }}
REF: ${{ github.ref }}
- name: ⚙️ Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: ⚙️ Check formatting
run: cargo fmt --all -- --check
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform: [linux, windows, macos]
include:
- platform: linux
os: ubuntu-latest
artifact_name: gyromouse
asset_name: gyromouse-linux
release_name: gyromouse-linux.7z
- platform: windows
os: windows-latest
artifact_name: gyromouse.exe
asset_name: gyromouse-windows
release_name: gyromouse-windows.7z
- platform: macos
os: macos-latest
artifact_name: gyromouse
asset_name: gyromouse-macos
release_name: gyromouse-macos.7z
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: ⚙️ Install clippy
run: rustup component add clippy
- uses: Swatinem/rust-cache@v1
with:
key: v5
- name: ⚙️ Install cargo-vcpkg
run: cargo vcpkg --version || cargo install cargo-vcpkg
# Ubuntu build deps for SDL
# https://hg.libsdl.org/SDL/file/default/docs/README-linux.md
- name: ⚙️ Install OS dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install build-essential git make cmake autoconf automake \
libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev \
libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \
libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev \
\
libusb-1.0-0-dev libxdo-dev libbluetooth-dev libudev-dev libxtst-dev
- name: 🔨 Build SDL
uses: actions-rs/cargo@v1
with:
command: vcpkg
args: --verbose build
#- name: dbg sdl
# if: matrix.platform == 'linux'
# run: |
# cp -f target/vcpkg/installed/x64-linux/*/lib/libSDL2d.a target/vcpkg/installed/x64-linux/lib/libSDL2.a
# cp -f target/vcpkg/installed/x64-linux/*/lib/libSDL2maind.a target/vcpkg/installed/x64-linux/lib/libSDL2main.a
# continue-on-error: true
- name: 🔨 Build gyromouse
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --features sdl2-static
- name: ⚙️ Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --features sdl2-static
- name: ⚙️ Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: ☁️ Upload gyromouse
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.asset_name }}
path: target/release/${{ matrix.artifact_name }}
- name: ⚙️ Prepare Release archives
shell: bash
run: |
mkdir gyromouse
cp -r target/release/${{ matrix.artifact_name }} mappings README.md CHANGELOG.md gyromouse/
7z a ${{ matrix.release_name }} gyromouse
- name: ☁️ Create Release (tag)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
draft: true
discussion_category_name: Release
files: ${{ matrix.release_name }}
- name: ☁️ Create Release (nightly)
if: github.ref == 'refs/heads/master' && matrix.platform == 'linux'
uses: eine/tip@master
with:
tag: nightly
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ matrix.release_name }}