More code cleanup #354
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |