From 9c6a62e273cc8cab21901b1f71d97345ff96c735 Mon Sep 17 00:00:00 2001 From: masan4444 Date: Sat, 5 Mar 2022 18:30:10 +0900 Subject: [PATCH 1/2] :recycle: use cargo profile instead of RUSTFLAGS --- .github/workflows/release.yml | 24 ++++++------------------ Cargo.toml | 3 +++ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b50578b..0469a84 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,7 +59,6 @@ jobs: runs-on: ${{ matrix.os }} env: CARGO: cargo - RUSTFLAGS: -C strip=symbols TARGET_FLAGS: --target ${{ matrix.target }} TARGET_DIR: ./target/${{ matrix.target }} RUST_BACKTRACE: 1 @@ -72,30 +71,26 @@ jobs: rust: stable target: x86_64-unknown-linux-musl arch: x86_64 - strip: strip - build: linux-armv7 os: ubuntu-18.04 rust: stable target: armv7-unknown-linux-gnueabihf arch: armv7 - strip: arm-linux-gnueabihf-strip - build: linux-aarch64 os: ubuntu-18.04 rust: stable target: aarch64-unknown-linux-musl arch: aarch64 - strip: aarch64-linux-musl-strip - build: macos os: macOS-latest rust: stable target: x86_64-apple-darwin arch: x86_64 - strip: strip # - build: macos-aarch64 # os: macOS-latest # rust: stable # target: aarch64-apple-darwin - # strip: strip + # arch: aarch64 steps: - name: Checkout repository @@ -116,7 +111,7 @@ jobs: target: ${{ matrix.target }} - name: Use Cross - if: matrix.build == 'linux-armv7' || matrix.build == 'linux-aarch64' + if: matrix.arch == 'armv7' || matrix.arch == 'aarch64' run: | cargo install cross echo "CARGO=cross" >> $GITHUB_ENV @@ -138,24 +133,17 @@ jobs: echo "release version: $RELEASE_VERSION" - name: Build release binary - run: RUSTFLAGS="${{ env.RUSTFLAGS }}" ${{ env.CARGO }} build ${{ env.TARGET_FLAGS }} --verbose --release + run: ${{ env.CARGO }} build ${{ env.TARGET_FLAGS }} --verbose --release - - name: Strip release binary (arm) - if: matrix.build == 'linux-armv7' || matrix.build == 'linux-aarch64' - run: | - docker run --rm -v $PWD/target:/target:Z \ - rustembedded/cross:${{ matrix.target }} \ - ${{ matrix.strip }} /target/${{ matrix.target }}/release/phpup - - - name: Generate completion files - if: matrix.build == 'linux' || matrix.build == 'macos' + - name: Generate completion files (x86_64) + if: matrix.arch == 'x86_64' run: | mkdir -p completions/{bash,zsh} ./target/${{ matrix.target }}/release/phpup completions --shell bash > completions/bash/_phpup ./target/${{ matrix.target }}/release/phpup completions --shell zsh > completions/zsh/_phpup - name: Generate completion files (arm) - if: matrix.build == 'linux-armv7' || matrix.build == 'linux-aarch64' + if: matrix.arch == 'armv7' || matrix.build == 'aarch64' uses: uraimo/run-on-arch-action@v2.1.1 with: arch: ${{ matrix.arch }} diff --git a/Cargo.toml b/Cargo.toml index d01abd0..d15a20b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,3 +35,6 @@ indoc = "1.0.3" indicatif = "0.16.2" md5 = "0.7.0" sha2 = "0.10.2" + +[profile.release] +strip = "symbols" From 116e7a475f9722d2595f29f65dc4ab99c4b649da Mon Sep 17 00:00:00 2001 From: masan4444 Date: Sat, 5 Mar 2022 18:35:31 +0900 Subject: [PATCH 2/2] :bug: fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0469a84..a6f430d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -143,7 +143,7 @@ jobs: ./target/${{ matrix.target }}/release/phpup completions --shell zsh > completions/zsh/_phpup - name: Generate completion files (arm) - if: matrix.arch == 'armv7' || matrix.build == 'aarch64' + if: matrix.arch == 'armv7' || matrix.arch == 'aarch64' uses: uraimo/run-on-arch-action@v2.1.1 with: arch: ${{ matrix.arch }}