From ff462008291cdc76948e411c0363b5a735b381e6 Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Mon, 6 Apr 2026 11:48:20 -0700 Subject: [PATCH] CI: test on push/PR, auto-publish to crates.io on tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ci.yml: test on ubuntu + check on macos for every push/PR - release.yml: test → publish to crates.io → create GitHub Release --- .github/workflows/ci.yml | 21 +++++++++++++++ .github/workflows/release.yml | 49 ++++++++++++++--------------------- 2 files changed, 40 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a263387 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo test + + check-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6232e5..d1eb05e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,41 +9,30 @@ permissions: contents: write jobs: - build: + test: runs-on: ubuntu-latest - strategy: - matrix: - target: - - x86_64-unknown-linux-gnu - - aarch64-unknown-linux-gnu - steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} + - run: cargo test - - name: Install cross-compilation tools - if: matrix.target == 'aarch64-unknown-linux-gnu' - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - echo 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc' >> $GITHUB_ENV + publish: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Publish to crates.io + run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - name: Build - run: cargo build --release --target ${{ matrix.target }} - - - name: Package - run: | - cd target/${{ matrix.target }}/release - for bin in freemkv-info freemkv-test; do - if [ -f "$bin" ]; then - tar czf "../../../${bin}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" "$bin" - fi - done - - - name: Upload to release + release: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: - files: '*.tar.gz' + generate_release_notes: true