78 lines
2.2 KiB
YAML
78 lines
2.2 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-macos:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
- name: Build
|
|
run: cargo build --verbose --bin hyper_headset_cli
|
|
- name: test
|
|
run: cargo test --bin hyper_headset_cli
|
|
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
- name: Install Dependencies
|
|
run: sudo apt update && sudo apt install -y libdbus-1-dev libhidapi-dev libusb-1.0-0-dev libudev-dev
|
|
- name: Build
|
|
run: cargo build --verbose
|
|
- name: test
|
|
run: cargo test
|
|
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
- name: Build
|
|
run: cargo build --verbose
|
|
- name: test
|
|
run: cargo test
|
|
|
|
publish-aur:
|
|
runs-on: ubuntu-latest
|
|
needs: [build-linux, build-macos, build-windows]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # needed to get full commit history for rev-list
|
|
|
|
- name: Clone AUR repo
|
|
run: git clone https://aur.archlinux.org/hyper-headset-git.git aur-pkg
|
|
|
|
- name: Compute and update pkgver
|
|
run: |
|
|
PKGVER=$(git describe --long --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
|
|
sed -i "s/^pkgver=.*/pkgver=$PKGVER/" aur-pkg/PKGBUILD
|
|
sed -i "s/^pkgrel=.*/pkgrel=1/" aur-pkg/PKGBUILD
|
|
|
|
- name: Publish to AUR
|
|
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
|
|
|
|
with:
|
|
pkgname: hyper-headset-git
|
|
pkgbuild: ./aur-pkg/PKGBUILD
|
|
commit_username: ${{ secrets.AUR_USERNAME }}
|
|
commit_email: ${{ secrets.AUR_EMAIL }}
|
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
commit_message: Automatic update to latest
|
|
updpkgsums: false
|
|
allow_empty_commits: false
|