From 45e5d093c765b19b625aa7f899bfbf740c68e602 Mon Sep 17 00:00:00 2001 From: Aldrin Jenson Date: Wed, 13 Sep 2023 16:30:16 +0530 Subject: [PATCH 1/3] add working github release workflow - targets: Mac(64bit,Arm), Windows, Linux(64bit gnu,Arm) --- .github/workflows/github-release.yml | 152 --------------------------- .github/workflows/release.yml | 93 ++++++++++++++++ 2 files changed, 93 insertions(+), 152 deletions(-) delete mode 100644 .github/workflows/github-release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml deleted file mode 100644 index ff5a0b85c..000000000 --- a/.github/workflows/github-release.yml +++ /dev/null @@ -1,152 +0,0 @@ -name: GitHub Release - -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+* - -jobs: - release: - name: Publish to Github Relases - outputs: - rc: ${{ steps.check-tag.outputs.rc }} - - strategy: - matrix: - include: - - target: aarch64-unknown-linux-musl - os: ubuntu-latest - use-cross: true - cargo-flags: "" - - target: aarch64-apple-darwin - os: macos-latest - use-cross: true - cargo-flags: "" - - target: aarch64-pc-windows-msvc - os: windows-latest - use-cross: true - cargo-flags: "--no-default-features" - - target: x86_64-apple-darwin - os: macos-latest - cargo-flags: "" - - target: x86_64-pc-windows-msvc - os: windows-latest - cargo-flags: "" - - target: x86_64-unknown-linux-musl - os: ubuntu-latest - use-cross: true - cargo-flags: "" - - target: i686-unknown-linux-musl - os: ubuntu-latest - use-cross: true - cargo-flags: "" - - target: i686-pc-windows-msvc - os: windows-latest - use-cross: true - cargo-flags: "" - - target: armv7-unknown-linux-musleabihf - os: ubuntu-latest - use-cross: true - cargo-flags: "" - - target: arm-unknown-linux-musleabihf - os: ubuntu-latest - use-cross: true - cargo-flags: "" - - target: mips-unknown-linux-musl - os: ubuntu-latest - use-cross: true - cargo-flags: "--no-default-features" - - target: mipsel-unknown-linux-musl - os: ubuntu-latest - use-cross: true - cargo-flags: "--no-default-features" - - target: mips64-unknown-linux-gnuabi64 - os: ubuntu-latest - use-cross: true - cargo-flags: "--no-default-features" - - target: mips64el-unknown-linux-gnuabi64 - os: ubuntu-latest - use-cross: true - cargo-flags: "--no-default-features" - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v2 - - - name: Check Tag - id: check-tag - shell: bash - run: | - tag=${GITHUB_REF##*/} - echo "::set-output name=version::$tag" - if [[ "$tag" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then - echo "::set-output name=rc::false" - else - echo "::set-output name=rc::true" - fi - - name: Install Rust Toolchain Components - uses: actions-rs/toolchain@v1 - with: - override: true - target: ${{ matrix.target }} - toolchain: stable - profile: minimal # minimal component installation (ie, no documentation) - - - name: Install OpenSSL - if: runner.os == 'Linux' - run: sudo apt-get install -y libssl-dev - - - name: Show Version Information (Rust, cargo, GCC) - shell: bash - run: | - gcc --version || true - rustup -V - rustup toolchain list - rustup default - cargo -V - rustc -V - - - name: Build - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.use-cross }} - command: build - args: --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }} - - - name: Build Archive - shell: bash - id: package - env: - target: ${{ matrix.target }} - version: ${{ steps.check-tag.outputs.version }} - run: | - set -euxo pipefail - bin=${GITHUB_REPOSITORY##*/} - src=`pwd` - dist=$src/dist - name=$bin-$version-$target - executable=target/$target/release/$bin - if [[ "$RUNNER_OS" == "Windows" ]]; then - executable=$executable.exe - fi - mkdir $dist - cp $executable $dist - cd $dist - if [[ "$RUNNER_OS" == "Windows" ]]; then - archive=$dist/$name.zip - 7z a $archive * - echo "::set-output name=archive::`pwd -W`/$name.zip" - else - archive=$dist/$name.tar.gz - tar czf $archive * - echo "::set-output name=archive::$archive" - fi - - name: Publish Archive - uses: softprops/action-gh-release@v0.1.15 - if: ${{ startsWith(github.ref, 'refs/tags/') }} - with: - draft: false - files: ${{ steps.package.outputs.archive }} - prerelease: ${{ steps.check-tag.outputs.rc == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..faaa6128f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,93 @@ +name: Release builds for Mac(64bit, Arm), Windows and Linux(64 bit, Arm) + +on: + pull_request: + paths-ignore: + - "docs/**" + - "helm/**" + - "assets/**" + - "**.md" + +jobs: + build-linux: + name: Build for ${{matrix.target}} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - aarch64-unknown-linux-gnu # linux(arm) + - x86_64-unknown-linux-gnu # linux(64 bit) + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{matrix.target}} + override: true + + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --release --target ${{matrix.target}} + + - uses: actions/upload-artifact@v3 + with: + name: Parseable_${{ matrix.target }} + path: target/${{ matrix.target }}/release/parseable + + build-win: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Build + run: cargo build --all --release --target x86_64-pc-windows-msvc + + - name: Create artifact for Windows + uses: actions/upload-artifact@v2 + with: + name: Parseable_x86_64-pc-windows-msvc + path: target/x86_64-pc-windows-msvc/release/PARSEABLE.exe + + build-mac: + runs-on: macos-latest + strategy: + matrix: + target: + - aarch64-apple-darwin + - x86_64-apple-darwin + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + default: true + override: true + + - name: Build + run: | + cargo build --release --target ${{ matrix.target }} + strip target/${{ matrix.target }}/release/Parseable + mv target/${{ matrix.target }}/release/Parseable target/${{ matrix.target }}/release/Parseable_darwin + + - name: Create artifact + uses: actions/upload-artifact@v2 + with: + name: Parseable_${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/Parseable_darwin From eea7b232d78305f0717bb0c8c4195315ca4a0705 Mon Sep 17 00:00:00 2001 From: Aldrin Jenson Date: Thu, 14 Sep 2023 08:56:08 +0530 Subject: [PATCH 2/3] Publish the binaries to release on tag push --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index faaa6128f..da1d2bb05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,9 @@ name: Release builds for Mac(64bit, Arm), Windows and Linux(64 bit, Arm) on: - pull_request: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+* paths-ignore: - "docs/**" - "helm/**" @@ -32,12 +34,26 @@ jobs: command: build args: --release --target ${{matrix.target}} - - uses: actions/upload-artifact@v3 + - name: Create Artifact + uses: actions/upload-artifact@v3 with: name: Parseable_${{ matrix.target }} path: target/${{ matrix.target }}/release/parseable - build-win: + - name: Rename binary + run: | + mv target/${{ matrix.target }}/release/parseable Parseable_${{ matrix.target }} + + - name: Publish Archive to Release Page + uses: softprops/action-gh-release@v0.1.15 + if: ${{ startsWith(github.ref, 'refs/tags/') }} + with: + draft: false + files: Parseable_${{ matrix.target }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-windows: runs-on: windows-latest steps: - name: Checkout @@ -59,6 +75,19 @@ jobs: name: Parseable_x86_64-pc-windows-msvc path: target/x86_64-pc-windows-msvc/release/PARSEABLE.exe + - name: Rename binary + run: | + mv target/x86_64-pc-windows-msvc/release/PARSEABLE.exe Parseable_x86_64-pc-windows-msvc.exe + + - name: Publish Archive to Release Page + uses: softprops/action-gh-release@v0.1.15 + if: ${{ startsWith(github.ref, 'refs/tags/') }} + with: + draft: false + files: Parseable_x86_64-pc-windows-msvc.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-mac: runs-on: macos-latest strategy: @@ -83,11 +112,23 @@ jobs: run: | cargo build --release --target ${{ matrix.target }} strip target/${{ matrix.target }}/release/Parseable - mv target/${{ matrix.target }}/release/Parseable target/${{ matrix.target }}/release/Parseable_darwin - name: Create artifact uses: actions/upload-artifact@v2 with: name: Parseable_${{ matrix.target }} path: | - target/${{ matrix.target }}/release/Parseable_darwin + target/${{ matrix.target }}/release/Parseable + + - name: Rename binary + run: | + mv target/${{ matrix.target }}/release/Parseable Parseable_${{ matrix.target }} + + - name: Publish Archive to Release Page + uses: softprops/action-gh-release@v0.1.15 + if: ${{ startsWith(github.ref, 'refs/tags/') }} + with: + draft: false + files: Parseable_${{ matrix.target }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1328dc9354e68610530242b3d7a6e6841311020c Mon Sep 17 00:00:00 2001 From: Aldrin Jenson Date: Thu, 14 Sep 2023 09:03:54 +0530 Subject: [PATCH 3/3] speed up workflow using "minimal" Rust profile --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da1d2bb05..58827033a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable + profile: minimal # minimal component installation (ie, no documentation) target: ${{matrix.target}} override: true @@ -63,6 +64,7 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable + profile: minimal default: true override: true @@ -104,6 +106,7 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable + profile: minimal target: ${{ matrix.target }} default: true override: true