From cd28cc6f8a861235fe158a9e3062a4e3b52c7c12 Mon Sep 17 00:00:00 2001 From: takashiidobe Date: Tue, 2 Nov 2021 22:04:31 -0500 Subject: [PATCH] update release to v0.0.2 --- .github/workflows/build.yml | 228 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 28 +---- Cargo.lock | 2 +- Cargo.toml | 2 +- 4 files changed, 231 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0fa2ee5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,228 @@ +name: Build + +env: + MIN_SUPPORTED_RUST_VERSION: "1.46.0" + CICD_INTERMEDIATES_DIR: "_cicd-intermediates" + +on: + push: + tags: + - '*' + +jobs: + build: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # Tier 1 + - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # Need to find a way to install gcc + # - { target: i686-pc-windows-gnu , os: windows-2019 } + - { target: i686-pc-windows-msvc , os: windows-2019 } + - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + - { target: x86_64-apple-darwin , os: macos-10.15 } + - { target: x86_64-pc-windows-gnu , os: windows-2019 } + - { target: x86_64-pc-windows-msvc , os: windows-2019 } + - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } + # Tier 2 with Host Tools + - { target: aarch64-apple-darwin , os: macos-11.0 } + - { target: aarch64-pc-windows-msvc , os: windows-2019 } + - { target: aarch64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + - { target: arm-unknown-linux-gnueabi , os: ubuntu-20.04, use-cross: true } + - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } + - { target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } + - { target: mips-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + - { target: mips64-unknown-linux-gnuabi64 , os: ubuntu-20.04, use-cross: true } + - { target: mips64el-unknown-linux-gnuabi64, os: ubuntu-20.04, use-cross: true } + - { target: mipsel-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + - { target: powerpc-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # powerpc64 unknown linux gnu doesn't work + # - { target: powerpc64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + - { target: powerpc64le-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + - { target: riscv64gc-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + - { target: s390x-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # freebsd doesn't work + # - { target: x86_64-unknown-freebsd , os: ubuntu-20.04, use-cross: true } + # illumos doesn't work. + # - { target: x86_64-unknown-illumos , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-musleabihf , os: ubuntu-20.04, use-cross: true } + - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + - { target: x86_64-unknown-netbsd , os: ubuntu-20.04, use-cross: true } + # Tier 2 + # - { target: aarch64-apple-ios , os: macos-11 } + # - { target: aarch64-apple-ios-sim , os: macos-11 } + # - { target: aarch64-fuchsia , os: ubuntu-20.04, use-cross: true } + # - { target: aarch64-linux-android , os: ubuntu-20.04, use-cross: true } + # - { target: aarch64-unknown-none-softfloat , os: ubuntu-20.04, use-cross: true } + # - { target: aarch64-unknown-none , os: ubuntu-20.04, use-cross: true } + # - { target: arm-linux-androideabi , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-musleabi , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-musleabihf , os: ubuntu-20.04, use-cross: true } + # - { target: armebv7r-none-eabi , os: ubuntu-20.04, use-cross: true } + # - { target: armebv7r-none-eabihf , os: ubuntu-20.04, use-cross: true } + # - { target: armv5te-unknown-linux-gnueabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv5te-unknown-linux-musleabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv7-linux-androideabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv7-unknown-linux-gnueabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv7-unknown-linux-musleabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv7-unknown-linux-musleabihf , os: ubuntu-20.04, use-cross: true } + # - { target: armv7a-none-eabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv7r-none-eabi , os: ubuntu-20.04, use-cross: true } + # - { target: armv7r-none-eabihf , os: ubuntu-20.04, use-cross: true } + # + # - { target: x86_64-fortanix-unknown-sgx , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-fuchsia , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-linux-android , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-pc-solaris , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-unknown-linux-gnux32 , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-unknown-redox , os: ubuntu-20.04, use-cross: true } + # Tier 3 + + steps: + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Install prerequisites + shell: bash + run: | + case ${{ matrix.job.target }} in + arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; + aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; + esac + + - name: Extract crate information + shell: bash + run: | + echo "PROJECT_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV + echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV + echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV + echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - 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.job.use-cross }} + command: build + args: --locked --release --target=${{ matrix.job.target }} + + - name: Strip debug information from executable + id: strip + shell: bash + run: | + # Figure out suffix of binary + EXE_suffix="" + case ${{ matrix.job.target }} in + *-pc-windows-*) EXE_suffix=".exe" ;; + esac; + + # Figure out what strip tool to use if any + STRIP="strip" + case ${{ matrix.job.target }} in + arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; + aarch64-pc-*) STRIP="" ;; + aarch64-unknown-*) STRIP="" ;; + armv7-unknown-*) STRIP="" ;; + mips-unknown-*) STRIP="" ;; + mips64-unknown-*) STRIP="" ;; + mips64el-unknown-*) STRIP="" ;; + mipsel-unknown-*) STRIP="" ;; + powerpc-unknown-*) STRIP="" ;; + powerpc64-unknown-*) STRIP="" ;; + powerpc64le-unknown-*) STRIP="" ;; + riscv64gc-unknown-*) STRIP="" ;; + s390x-unknown-*) STRIP="" ;; + x86_64-unknown-freebsd) STRIP="" ;; + x86_64-unknown-illumos) STRIP="" ;; + esac; + + # Setup paths + BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/" + mkdir -p "${BIN_DIR}" + BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}" + BIN_PATH="${BIN_DIR}/${BIN_NAME}" + TRIPLET_NAME="${{ matrix.job.target }}" + + # Copy the release build binary to the result location + cp "target/$TRIPLET_NAME/release/${BIN_NAME}" "${BIN_DIR}" + + # Also strip if possible + if [ -n "${STRIP}" ]; then + "${STRIP}" "${BIN_PATH}" + fi + + # Let subsequent steps know where to find the (stripped) bin + echo ::set-output name=BIN_PATH::${BIN_PATH} + echo ::set-output name=BIN_NAME::${BIN_NAME} + + - name: Create tarball + id: package + shell: bash + run: | + PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac; + PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }} + PKG_NAME=${PKG_BASENAME}${PKG_suffix} + echo ::set-output name=PKG_NAME::${PKG_NAME} + + PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package" + ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" + mkdir -p "${ARCHIVE_DIR}" + mkdir -p "${ARCHIVE_DIR}/autocomplete" + + # Binary + cp "${{ steps.strip.outputs.BIN_PATH }}" "$ARCHIVE_DIR" + + # base compressed package + pushd "${PKG_STAGING}/" >/dev/null + case ${{ matrix.job.target }} in + *-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;; + *) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;; + esac; + popd >/dev/null + + # Let subsequent steps know where to find the compressed package + echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}" + + - name: "Artifact upload: tarball" + uses: actions/upload-artifact@master + with: + name: ${{ steps.package.outputs.PKG_NAME }} + path: ${{ steps.package.outputs.PKG_PATH }} + + - name: Check for release + id: is-release + shell: bash + run: | + unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi + echo ::set-output name=IS_RELEASE::${IS_RELEASE} + + - name: Publish archives and packages + uses: softprops/action-gh-release@v1 + if: steps.is-release.outputs.IS_RELEASE + with: + files: | + ${{ steps.package.outputs.PKG_PATH }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47cec25..1b35aad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,35 +3,9 @@ name: Release on: push: tags: - - v[0-9]+.* + - '*' jobs: - create-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: taiki-e/create-gh-release-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - upload-assets: - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: taiki-e/upload-rust-binary-action@v1 - with: - bin: ${{ github.event.repository.name }} - tar: unix - zip: windows - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - publish-release: runs-on: ubuntu-latest steps: diff --git a/Cargo.lock b/Cargo.lock index 2b4eeaf..26ad43e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -637,7 +637,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "rless" -version = "0.0.1" +version = "0.0.2" dependencies = [ "async-std", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 53037c4..c3b8996 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rless" -version = "0.0.1" +version = "0.0.2" edition = "2018" default-run = "rless" readme = "README.md"