-
-
Notifications
You must be signed in to change notification settings - Fork 43
91 lines (80 loc) · 2.96 KB
/
compile-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
name: Compile changes
on:
push:
branches-ignore: 'main'
pull_request:
branches-ignore: 'main'
env:
CARGO_TERM_COLOR: always
jobs:
compile:
name: Compile for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-latest
artifact_name: target/debug/legion-kb-rgb
asset_name: legion-kb-rgb-linux
triplet: x64-linux
vcpkgCommitId: '335a153de3e398208df4d25eff89d831727bc5da'
- name: windows
os: windows-latest
artifact_name: target/debug/legion-kb-rgb.exe
asset_name: legion-kb-rgb-windows
triplet: x64-windows-static
vcpkgCommitId: '335a153de3e398208df4d25eff89d831727bc5da'
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up cargo cache
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Download dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update -y
sudo apt install -y libunwind-dev
sudo apt-get install -y libx11-dev nasm libdbus-1-dev libudev-dev libxcb-randr0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libxi-dev libxtst-dev libusb-1.0-0-dev libpango1.0-dev libgtk-3-dev libxdo-dev libappindicator3-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install nasm
elif [ "$RUNNER_OS" == "Windows" ]; then
echo "Nothing to do."
fi
shell: bash
- name: Set up VCPKG deps
uses: lukka/run-vcpkg@v11
id: runvcpkg
# if: ${{ runner.os != 'Linux' }}
with:
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}'
# Run vcpkg with the command specified by the `runVcpkgFormatString` input.
runVcpkgInstall: true
vcpkgJsonGlob: '**/vcpkg.json'
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
# - name: Prints output of run-vcpkg's action.
# run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
# - name: Set VCPKG_ROOT
# run: echo "VCPKG_ROOT=$(echo $VCPKG_INSTALLATION_ROOT)" >> $GITHUB_ENV
# shell: bash
- name: Build
shell: bash
run: cargo build --verbose
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.artifact_name }}