CI: Replace slashes with dashes in NAME #147
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: Build | |
on: | |
push: | |
paths: | |
- .github/workflows/main.yml | |
- 'src/**' | |
tags: | |
- '*' | |
branches: | |
- '**' | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
PIPEWIRE_VERSION: '0.3.77' | |
jobs: | |
Build: | |
name: 'Build' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- name: Check formatting | |
run: cargo fmt --check --verbose | |
- name: Install system dependencies | |
run: | | |
sudo apt install meson ninja-build libdbus-1-dev llvm-dev libclang-dev clang | |
- uses: actions/cache@v3 | |
name: Restore PipeWire cache | |
id: pipewire-cache | |
with: | |
key: ${{ env.PIPEWIRE_VERSION }} | |
path: 'pipewire' | |
- uses: actions/checkout@v3 | |
name: Checkout PipeWire | |
if: steps.pipewire-cache.outputs.cache-hit != 'true' | |
with: | |
repository: pipewire/pipewire | |
ref: ${{ env.PIPEWIRE_VERSION }} | |
path: 'pipewire' | |
- name: Build PipeWire | |
if: steps.pipewire-cache.outputs.cache-hit != 'true' | |
working-directory: 'pipewire' | |
run: | | |
meson setup builddir | |
meson configure builddir -Dprefix=/usr \ | |
-Dauto_features=disabled \ | |
-Davb=disabled \ | |
-Dlegacy-rtkit=false \ | |
-Dpw-cat=disabled \ | |
-Dsndfile=disabled \ | |
-Daudiotestsrc=disabled \ | |
-Dvideotestsrc=disabled \ | |
-Daudiomixer=disabled \ | |
-Dvideoconvert=disabled \ | |
-Dcontrol=disabled \ | |
-Dsupport=disabled \ | |
-Draop=disabled \ | |
-Dflatpak=disabled \ | |
-Dvolume=disabled \ | |
-Dvulkan=disabled \ | |
-Ddbus=disabled \ | |
-Ddocs=disabled \ | |
-Dman=disabled \ | |
-Dlibcamera=disabled \ | |
-Dsystemd=disabled \ | |
-Dalsa=disabled \ | |
-Dpipewire-alsa=disabled \ | |
-Djack=disabled \ | |
-Dpipewire-jack=disabled \ | |
-Dudev=disabled \ | |
-Dbluez5=disabled \ | |
-Dgstreamer=disabled \ | |
-Dsession-managers=[] \ | |
-Dexamples=disabled \ | |
-Dtests=disabled | |
meson compile -C builddir | |
- name: Install PipeWire | |
working-directory: 'pipewire' | |
run: sudo meson install -C builddir | |
- uses: actions/cache@v3 | |
name: Restore Cargo cache | |
id: cargo-cache | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Cargo tools | |
if: steps.cargo-cache.outputs.cache-hit != 'true' | |
run: cargo install cargo-deb cargo-generate-rpm | |
- name: Build | |
run: cargo build --release --verbose --all-features | |
- uses: actions/upload-artifact@v3 | |
name: Upload binary | |
with: | |
name: coppwr | |
path: target/release/coppwr | |
- name: Package | |
run: | | |
case "$GITHUB_REF" in | |
*tags*) NAME=coppwr-$GITHUB_REF_NAME ;; | |
*) NAME=coppwr-$GITHUB_REF_NAME-$GITHUB_SHA ;; | |
esac | |
NAME="${NAME//\//-}" | |
mkdir out/ | |
cargo deb -v --no-build --output out/"$NAME".deb | |
cargo generate-rpm -o out/"$NAME".rpm | |
mkdir .cargo | |
cargo vendor -v > .cargo/config.toml | |
tar --exclude='out' --exclude='.git*' --exclude='coppwr/pipewire' --exclude='coppwr/target' --transform "s|coppwr|$NAME|" -zcvf out/"$NAME"-vendor.tar.gz -C .. coppwr/ | |
- uses: actions/upload-artifact@v3 | |
name: Upload packages | |
with: | |
name: coppwr-deb-rpm | |
path: | | |
out/*.deb | |
out/*.rpm | |
- uses: actions/upload-artifact@v3 | |
name: Upload vendor archive | |
with: | |
name: coppwr-vendor | |
path: | | |
out/*-vendor.tar.gz |