name: Deduplicator Release Build CI Pipeline on: push: tags: - 'v*.*.*' jobs: lint_test: runs-on: ubuntu-latest env: RUSTFLAGS: "-C target-feature=+aes,+sse2" steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: components: clippy - name: Run cargo check run: cargo check - name: Run cargo clippy run: cargo clippy -- -D warnings - name: Run tests run: cargo test -- --test-threads=1 build: needs: lint_test runs-on: ${{ matrix.os }} strategy: matrix: include: - target: aarch64-unknown-linux-gnu os: ubuntu-latest artifact_name: linux-aarch64 rustflags: "-C target-feature=+aes,+neon" - target: x86_64-unknown-linux-gnu os: ubuntu-latest artifact_name: linux-amd64 rustflags: "-C target-feature=+aes,+sse2" - target: x86_64-apple-darwin os: macos-14 artifact_name: macos-amd64 rustflags: "-C target-feature=+aes,+sse2" - target: aarch64-apple-darwin os: macos-14 artifact_name: macos-arm64 rustflags: "-C target-feature=+aes,+neon" steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Add target run: rustup target add ${{ matrix.target }} - name: Install cross-compilation toolchain (Linux ARM only) if: matrix.target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu - name: Build release binary env: RUSTFLAGS: ${{ matrix.rustflags }} CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'aarch64-linux-gnu-gcc' || '' }} run: | if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc fi cargo build --release --target ${{ matrix.target }} - name: Package binary run: | if [[ "${{ matrix.os }}" == macos* ]]; then BINARY_NAME=$(find target/${{ matrix.target }}/release -maxdepth 1 -type f -perm +111 -print0 | xargs -0 basename | head -1) else BINARY_NAME=$(find target/${{ matrix.target }}/release -maxdepth 1 -type f -executable -print0 | xargs -0 basename | head -1) fi echo "Packaging binary: $BINARY_NAME" mkdir -p release cp target/${{ matrix.target }}/release/$BINARY_NAME release/$BINARY_NAME tar -C release -czf ${{ matrix.artifact_name }}.tar.gz $BINARY_NAME - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact_name }}-binary path: ${{ matrix.artifact_name }}.tar.gz create_release: needs: build runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Create GitHub Release id: create_release uses: softprops/action-gh-release@v1 with: tag_name: ${{ github.ref_name }} name: Release ${{ github.ref_name }} body: "Automated release for version ${{ github.ref_name }}" files: | artifacts/*/*.tar.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}