Skip to content

Commit

Permalink
dev: switch default release profile to best performance (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin authored Aug 19, 2024
1 parent cd21af9 commit 1be8344
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ jobs:
shell: pwsh
run: |
cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.rust-target }} --bin typst-ts-cli
cargo build --profile release-stripped --manifest-path cli/Cargo.toml --target ${{ matrix.rust-target }} --bin typst-ts-cli
cargo build --profile relwithdebinfo --manifest-path cli/Cargo.toml --target ${{ matrix.rust-target }} --bin typst-ts-cli
- uses: actions/upload-artifact@v3
with:
name: typst-ts-${{ env.target }}
path: target/${{ matrix.rust-target }}/release-stripped/typst-ts-*
path: target/${{ matrix.rust-target }}/release/typst-ts-*
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: typst-ts-${{ env.target }}-relwithdebuginfo
path: target/${{ matrix.rust-target }}/release/typst-ts-*
path: target/${{ matrix.rust-target }}/relwithdebinfo/typst-ts-*
if-no-files-found: error

build_linux_riscv64:
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- name: Run Cross Build
run: |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build --manifest-path cli/Cargo.toml --release --target ${CARGO_TARGET} --bin typst-ts-cli
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build --manifest-path cli/Cargo.toml --profile release-stripped --target ${CARGO_TARGET} --bin typst-ts-cli
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build --manifest-path cli/Cargo.toml --profile relwithdebinfo --target ${CARGO_TARGET} --bin typst-ts-cli
env:
CROSS_DOCKER_IN_DOCKER: true
CARGO_TARGET: ${{ matrix.rust-target }}
Expand All @@ -128,12 +128,12 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: typst-ts-${{ env.target }}
path: target/${{ matrix.rust-target }}/release-stripped/typst-ts-*
path: target/${{ matrix.rust-target }}/release/typst-ts-*
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: typst-ts-${{ env.target }}-relwithdebuginfo
path: target/${{ matrix.rust-target }}/release/typst-ts-*
path: target/${{ matrix.rust-target }}/relwithdebinfo/typst-ts-*
if-no-files-found: error

build_alpine:
Expand All @@ -160,7 +160,7 @@ jobs:
- name: build binaries
run: |
cargo build --release --manifest-path cli/Cargo.toml --target $RUST_TARGET --bin typst-ts-cli
cargo build --profile release-stripped --manifest-path cli/Cargo.toml --target $RUST_TARGET --bin typst-ts-cli
cargo build --profile relwithdebinfo --manifest-path cli/Cargo.toml --target $RUST_TARGET --bin typst-ts-cli
- uses: actions/upload-artifact@v3
with:
name: typst-ts-font-assets
Expand All @@ -169,12 +169,12 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: typst-ts-${{ env.target }}
path: target/${{ env.RUST_TARGET }}/release-stripped/typst-ts-*
path: target/${{ env.RUST_TARGET }}/release/typst-ts-*
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: typst-ts-${{ env.target }}-relwithdebuginfo
path: target/${{ env.RUST_TARGET }}/release/typst-ts-*
path: target/${{ env.RUST_TARGET }}/relwithdebinfo/typst-ts-*
if-no-files-found: error

release:
Expand Down Expand Up @@ -215,16 +215,16 @@ jobs:
chmod +x release/$name/bin/typst-ts-*
tar czvf gh-release/$name-relwithdebuginfo.tar.gz -C release $name
mkdir -p release-stripped/$name/bin
cp artifacts/$src/typst-ts-* "release-stripped/$name/bin/"
cp -r CHANGELOG release-stripped/$name/
cp -r docs release-stripped/$name/
mkdir -p release/$name/bin
cp artifacts/$src/typst-ts-* "release/$name/bin/"
cp -r CHANGELOG release/$name/
cp -r docs release/$name/
cp README.md \
LICENSE \
CHANGELOG.md \
release-stripped/$name/
chmod +x release-stripped/$name/bin/typst-ts-*
tar czvf gh-release/$name.tar.gz -C release-stripped $name
release/$name/
chmod +x release/$name/bin/typst-ts-*
tar czvf gh-release/$name.tar.gz -C release $name
}
pack_release win32-x64 x86_64-pc-windows-msvc
pack_release win32-ia32 i686-pc-windows-msvc
Expand Down
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,20 @@ exclude = ["projects"]

[profile.release]
opt-level = 3
debug = true
incremental = true
lto = "thin"

[profile.release-stripped]
inherits = "release"
lto = "fat"
debug = false
strip = true

[profile.relwithdebinfo]
inherits = "release"
lto = "thin"
debug = true
strip = false

[profile.release-ci]
inherits = "release"
opt-level = 1
incremental = true
debug = false
strip = true

Expand Down

0 comments on commit 1be8344

Please sign in to comment.