diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..213ba74 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: build-plugin +on: + workflow_dispatch: + push: + branches: [ main ] + paths: + - "src/**" + - Cargo.lock + - rust-toolchain.toml + - flake.nix + - flake.lock + - shell.nix + + pull_request: + branches: [ main ] + paths: + - "src/**" + - Cargo.lock + - rust-toolchain.toml + - flake.nix + - flake.lock + - shell.nix + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + profile: [ dev release ] + + env: + BUILD_NAME: ${{ matrix.profile == 'dev' && 'debug' || matrix.profile }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: nixbuild/nix-quick-install-action@v28 + + - name: Check + run: nix develop --command cargo clippy --profile ${{ matrix.profile }} -- -D warnings + + - name: Build + run: nix develop --command cargo build --profile ${{ matrix.profile }} + + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: mpv-rpc_${{ env.BUILD_NAME }} + path: target/${{ env.BUILD_NAME }}/libmpv_rpc.so