From cff471495ed069d410b81b0d19ecb73433cd1a80 Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Wed, 9 Nov 2022 19:04:56 +0800 Subject: [PATCH] perf: optimize build --- .github/workflows/release.yml | 26 +++----------------------- Cargo.lock | 2 +- Cargo.toml | 13 ++++++++++++- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82566e5..f857672 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,10 +26,6 @@ jobs: os: ubuntu-latest cross: false file-ext: "" - - target: x86_64-unknown-linux-musl - os: ubuntu-latest - cross: true - file-ext: "" - target: x86_64-pc-windows-msvc os: windows-latest cross: false @@ -42,26 +38,10 @@ jobs: os: macos-latest cross: false file-ext: "" - - target: aarch64-unknown-linux-gnu - os: ubuntu-latest - cross: true - file-ext: "" - - target: aarch64-unknown-linux-musl - os: ubuntu-latest - cross: true - file-ext: "" - target: aarch64-apple-darwin os: macos-latest cross: true file-ext: "" - - target: arm-unknown-linux-gnueabihf - os: ubuntu-latest - cross: true - file-ext: "" - - target: armv7-unknown-linux-musleabihf - os: ubuntu-latest - cross: true - file-ext: "" runs-on: ${{ matrix.os }} steps: @@ -82,15 +62,15 @@ jobs: continue-on-error: true uses: svenstaro/upx-action@v2 with: - file: target/${{ matrix.target }}/release/simple-proxy${{ matrix.file-ext }} + file: target/${{ matrix.target }}/release/simple_proxy${{ matrix.file-ext }} args: -q --best --lzma strip: false - name: pack run: | mkdir -p release-${{ matrix.target }} cd release-${{ matrix.target }} - tar -C ../target/${{ matrix.target }}/release -zcf simple-proxy-${{ matrix.target }}.tar.gz simple-proxy${{ matrix.file-ext }} - openssl dgst -sha256 -r simple-proxy-${{ matrix.target }}.tar.gz > simple-proxy-${{ matrix.target }}.sha256 + tar -C ../target/${{ matrix.target }}/release -zcf simple_proxy-${{ matrix.target }}.tar.gz simple_proxy${{ matrix.file-ext }} + openssl dgst -sha256 -r simple_proxy-${{ matrix.target }}.tar.gz > simple_proxy-${{ matrix.target }}.sha256 - name: release uses: softprops/action-gh-release@v1 with: diff --git a/Cargo.lock b/Cargo.lock index 621e262..d8d2e8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -685,7 +685,7 @@ dependencies = [ [[package]] name = "simple-proxy" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "axum", diff --git a/Cargo.toml b/Cargo.toml index 3cdeb6c..c9e84b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,21 @@ [package] name = "simple-proxy" -version = "0.1.0" +version = "0.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[profile.release] +opt-level = "z" +lto = true +codegen-units = 1 +panic = "abort" +strip = true + +[[bin]] +name = "simple_proxy" +path = "src/main.rs" + [dependencies] dotenvy = "0.15" anyhow = "1"