-
Notifications
You must be signed in to change notification settings - Fork 9
109 lines (107 loc) · 3.87 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
name: Intiface Engine Build
on: push
jobs:
build-stable:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Fix ~/.cargo directory permissions
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Update package list
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get -y update
- name: Install required packages
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get -y install libudev-dev libusb-1.0-0-dev libdbus-1-dev
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('.github/workflows/cache_version') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('.github/workflows/cache_version') }}
- name: Rust toolchain fetch
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Formatting check
continue-on-error: true
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# - name: Build Debug
# run: cargo build
# - name: Run tests
# run: cargo test
# - name: Run doc gen
# run: cargo doc --no-deps
- name: Build Release
run: cargo build --release
- name: Copy executable (Linux, MacOS)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: |
mkdir ci-output-release
cp target/release/intiface-engine ci-output-release/intiface-engine
- name: Copy Info.plist (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
cp src/Info.plist ci-output-release/Info.plist
- name: Copy executable (Windows)
if: startsWith(matrix.os, 'windows')
run: |
mkdir ci-output-release
copy target\release\intiface-engine.exe ci-output-release\intiface-engine.exe
- name: Upload artifacts (release)
uses: actions/upload-artifact@v1
with:
name: intiface-engine-${{ runner.os }}-release
path: ci-output-release
release:
name: Release artifacts
needs: build-stable
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Download Artifact (Linux)
uses: actions/download-artifact@v1
with:
name: intiface-engine-Linux-release
- name: Download Artifact (Windows)
uses: actions/download-artifact@v1
with:
name: intiface-engine-Windows-release
- name: Download Artifact (MacOS)
uses: actions/download-artifact@v1
with:
name: intiface-engine-macOS-release
- name: Zip executables
# This follows the naming convention from C# and JS. Use -j to junk the
# directory structure.
run: |
zip -j intiface-engine-linux-x64-Release.zip intiface-engine-Linux-release/intiface-engine README.md CHANGELOG.md
zip -j intiface-engine-win-x64-Release.zip intiface-engine-Windows-release/intiface-engine.exe README.md CHANGELOG.md
zip -j intiface-engine-macos-x64-Release.zip intiface-engine-macOS-release/intiface-engine README.md CHANGELOG.md Info.plist
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
intiface-engine-linux-x64-Release.zip
intiface-engine-win-x64-Release.zip
intiface-engine-macos-x64-Release.zip
README.md
CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}