name: Rust on: push: branches: [ "main" ] tags: - v[0-9]+.* pull_request: branches: [ "main" ] env: CARGO_TERM_COLOR: always jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 - name: Build run: cargo build --release - name: Run tests run: cargo test --release - name: Run clippy run: cargo clippy -- -D warnings - name: Check formatting run: cargo fmt -- --check create-release: if: startsWith(github.ref, 'refs/tags/') permissions: contents: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: taiki-e/create-gh-release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} upload-assets: if: startsWith(github.ref, 'refs/tags/') needs: create-release permissions: contents: write strategy: matrix: include: - target: x86_64-unknown-linux-gnu os: ubuntu-latest - target: x86_64-apple-darwin os: macos-latest - target: x86_64-pc-windows-msvc os: windows-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: taiki-e/upload-rust-binary-action@v1.27.0 with: bin: noentropy target: ${{ matrix.target }} tar: unix zip: windows token: ${{ secrets.GITHUB_TOKEN }}