chore: enable strip in cargo

This commit is contained in:
Yujia Qiao 2022-02-25 12:35:04 +08:00
parent 860e3ce2ed
commit 4682581038
No known key found for this signature in database
GPG Key ID: DC129173B148701B
2 changed files with 44 additions and 54 deletions

View File

@ -3,7 +3,7 @@ name: Release
on: on:
push: push:
tags: tags:
- '*' - "*"
workflow_dispatch: workflow_dispatch:
@ -62,56 +62,45 @@ jobs:
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
exe: rathole.exe exe: rathole.exe
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Install cross - name: Install cross
run: cargo install --version 0.1.16 cross run: cargo install --version 0.1.16 cross
- name: Run tests - name: Run tests
run: cross test --release --target ${{ matrix.target }} --verbose run: cross test --release --target ${{ matrix.target }} --verbose
- name: Build release - name: Build release
run: cross build --release --target ${{ matrix.target }} run: cross build --release --target ${{ matrix.target }}
- name: Install LLVM Strip - name: Run UPX
if: matrix.os == 'ubuntu-latest' # Upx may not support some platforms. Ignore the errors
run: sudo apt-get install llvm continue-on-error: true
- name: LLVM Strip # Disable upx for mips. See https://github.com/upx/upx/issues/387
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest' && !contains(matrix.target, 'mips')
continue-on-error: true uses: crazy-max/ghaction-upx@v1
run: llvm-strip target/${{ matrix.target }}/release/${{ matrix.exe }} with:
- name: MacOS Strip version: v3.96
if: matrix.os == 'macos-latest' files: target/${{ matrix.target }}/release/${{ matrix.exe }}
continue-on-error: true args: -q --best --lzma
run: strip target/${{ matrix.target }}/release/${{ matrix.exe }} - uses: actions/upload-artifact@v2
- name: Run UPX with:
# Upx may not support some platforms. Ignore the errors name: rathole-${{ matrix.target }}
continue-on-error: true path: target/${{ matrix.target }}/release/${{ matrix.exe }}
# Disable upx for mips. See https://github.com/upx/upx/issues/387 - name: Zip Release
if: matrix.os == 'ubuntu-latest' && !contains(matrix.target, 'mips') uses: TheDoctor0/zip-release@0.6.1
uses: crazy-max/ghaction-upx@v1 with:
with: type: zip
version: v3.96 filename: rathole-${{ matrix.target }}.zip
files: target/${{ matrix.target }}/release/${{ matrix.exe }} directory: target/${{ matrix.target }}/release/
args: -q --best --lzma path: ${{ matrix.exe }}
- uses: actions/upload-artifact@v2 - name: Publish
with: uses: softprops/action-gh-release@v1
name: rathole-${{ matrix.target }} if: startsWith(github.ref, 'refs/tags/')
path: target/${{ matrix.target }}/release/${{ matrix.exe }} with:
- name: Zip Release files: target/${{ matrix.target }}/release/rathole-${{ matrix.target }}.zip
uses: TheDoctor0/zip-release@0.6.1 generate_release_notes: true
with: draft: true
type: zip
filename: rathole-${{ matrix.target }}.zip
directory: target/${{ matrix.target }}/release/
path: ${{ matrix.exe }}
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/${{ matrix.target }}/release/rathole-${{ matrix.target }}.zip
generate_release_notes: true
draft: true
docker: docker:
name: Publish to Docker Hub name: Publish to Docker Hub
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')

View File

@ -36,6 +36,7 @@ panic = "abort"
panic = "abort" panic = "abort"
lto = true lto = true
codegen-units = 1 codegen-units = 1
strip = true
[profile.bench] [profile.bench]
debug = 1 debug = 1