Update Github actions #110
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 releases | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
publish: | |
name: Publish for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- name: linux | |
os: ubuntu-latest | |
artifact_name: target/release/legion-kb-rgb | |
asset_name: legion-kb-rgb-linux | |
triplet: x64-linux | |
vcpkgCommitId: 'f6a5d4e8eb7476b8d7fc12a56dff300c1c986131' | |
- name: windows | |
os: windows-latest | |
artifact_name: target/release/legion-kb-rgb.exe | |
asset_name: legion-kb-rgb-windows | |
triplet: x64-windows-static | |
vcpkgCommitId: 'f6a5d4e8eb7476b8d7fc12a56dff300c1c986131' | |
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 | |
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 | |
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 --release --verbose | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.asset_name }} | |
path: ${{ matrix.artifact_name }} |