diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..f6ea319 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,7 @@ +# https://github.com/release-drafter/release-drafter#example +name-template: 'resp-benchmark-v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..33338e1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,122 @@ +name: release + +# Controls when the workflow will run +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + draft: + name: draft + runs-on: ubuntu-latest + steps: + - name: draft release + id: "draft" + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + outputs: + upload_url: ${{ steps.draft.outputs.upload_url }} + + build-and-upload: + needs: draft + name: build - ${{ matrix.platform.release_for }} + strategy: + matrix: + platform: + - release_for: linux-amd64 + os: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + bin: resp-benchmark + name: resp-benchmark-linux-amd64.tar.gz + command: build + + - release_for: linux-arm64 + os: ubuntu-20.04 + target: aarch64-unknown-linux-gnu + bin: resp-benchmark + name: resp-benchmark-linux-arm64.tar.gz + command: build + + - release_for: windows-amd64 + os: windows-latest + target: x86_64-pc-windows-msvc + bin: resp-benchmark.exe + name: resp-benchmark-windows-amd64.zip + command: build + + - release_for: windows-arm64 + os: windows-latest + target: aarch64-pc-windows-msvc + bin: resp-benchmark.exe + name: resp-benchmark-windows-arm64.zip + command: build + + - release_for: macos-amd64 + os: macos-latest + target: x86_64-apple-darwin + bin: resp-benchmark + name: resp-benchmark-macos-amd64.tar.gz + command: build + + - release_for: macos-arm64 + os: macos-latest + target: aarch64-apple-darwin + bin: resp-benchmark + name: resp-benchmark-macos-arm64.tar.gz + command: build + + runs-on: ${{ matrix.platform.os }} + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: cache cargo registry + uses: actions/cache@v3 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: cache cargo index + uses: actions/cache@v3 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- + + - name: build binary + uses: houseabsolute/actions-rust-cross@v0 + with: + command: ${{ matrix.platform.command }} + target: ${{ matrix.platform.target }} + args: "--locked --release" + strip: true + - name: Package as archive + shell: bash + run: | + cd target/${{ matrix.platform.target }}/release + if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then + 7z a ${{ matrix.platform.name }} ${{ matrix.platform.bin }} ../../../workloads + else + tar czvf ${{ matrix.platform.name }} ${{ matrix.platform.bin }} ../../../workloads + fi + - name: upload + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ needs.draft.outputs.upload_url }} + asset_path: ./target/${{ matrix.platform.target }}/release/${{ matrix.platform.name }} + asset_name: ${{ matrix.platform.name }} + asset_content_type: ${{ matrix.platform.os == 'windows-latest' && 'application/zip' || 'application/gzip' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef862 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/ +.idea/