diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2635b0e..2d22974 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,12 +15,12 @@ jobs: - uses: actions/checkout@v2 - name: Build release run: - cargo build --release + cargo build --profile release-github - uses: softprops/action-gh-release@v1 with: body: This release and its artifacts were built with a GitHub action files: | - target/release/rqbit.exe + target/release-github/rqbit.exe cross-compile-on-macos: runs-on: macos-11 @@ -31,37 +31,41 @@ jobs: brew tap messense/macos-cross-toolchains && brew install x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu arm-unknown-linux-gnueabihf + - name: Make a directory for output artifacts + run: + mkdir -p target/artifacts + - name: Build release linux x86_64 binary run: rustup target install x86_64-unknown-linux-gnu && make release-linux-x86_64 && - mv target/x86_64-unknown-linux-gnu/release/rqbit target/release/rqbit-linux-static-x86_64 - + mv target/x86_64-unknown-linux-gnu/release-github/rqbit target/artifacts/rqbit-linux-static-x86_64 + - name: Build release linux arm32bit binary run: rustup target install arm-unknown-linux-gnueabihf && make release-linux-armv6 && - mv target/arm-unknown-linux-gnueabihf/release/rqbit target/release/rqbit-linux-static-arm32 + mv target/arm-unknown-linux-gnueabihf/release-github/rqbit target/artifacts/rqbit-linux-static-arm32 - name: Build release linux aarch64 binary run: rustup target install aarch64-unknown-linux-gnu && make release-linux-aarch64 && - mv target/aarch64-unknown-linux-gnu/release/rqbit target/release/rqbit-linux-static-aarch64 + mv target/aarch64-unknown-linux-gnu/release-github/rqbit target/artifacts/rqbit-linux-static-aarch64 - name: Build release OSX universal binary run: rustup target install aarch64-apple-darwin && - cargo build --release && - cargo build --release --target aarch64-apple-darwin && - lipo ./target/release/rqbit ./target/aarch64-apple-darwin/release/rqbit -create -output ./target/release/rqbit-osx-universal + cargo build --profile release-github && + cargo build --profile release-github --target aarch64-apple-darwin && + lipo ./target/release-github/rqbit ./target/aarch64-apple-darwin/release-github/rqbit -create -output ./target/artifacts/rqbit-osx-universal - uses: softprops/action-gh-release@v1 with: body: This release and its artifacts were built with a GitHub action files: | - target/release/rqbit-osx-universal - target/release/rqbit-linux-static-x86_64 - target/release/rqbit-linux-static-aarch64 - target/release/rqbit-linux-static-arm32 + target/artifacts/rqbit-osx-universal + target/artifacts/rqbit-linux-static-x86_64 + target/artifactsrqbit-linux-static-aarch64 + target/artifacts/rqbit-linux-static-arm32 diff --git a/Cargo.toml b/Cargo.toml index 42dc033..3340933 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,4 +16,9 @@ panic = "abort" [profile.release] panic = "abort" -debug = true \ No newline at end of file +debug = true + +[profile.release-github] +inherits = "release" +lto = true +debug = false \ No newline at end of file diff --git a/Makefile b/Makefile index 3df86c6..04072b9 100644 --- a/Makefile +++ b/Makefile @@ -26,19 +26,19 @@ install: build-release @PHONY: release-macos-universal release-macos-universal: - cargo build --target aarch64-apple-darwin --release - cargo build --target x86_64-apple-darwin --release + cargo build --target aarch64-apple-darwin --profile release-github + cargo build --target x86_64-apple-darwin --profile release-github lipo \ - ./target/aarch64-apple-darwin/release/rqbit \ - ./target/x86_64-apple-darwin/release/rqbit \ + ./target/aarch64-apple-darwin/release-github/rqbit \ + ./target/x86_64-apple-darwin/release-github/rqbit \ -create \ - -output ./target/x86_64-apple-darwin/release/rqbit-osx-universal + -output ./target/x86_64-apple-darwin/release-github/rqbit-osx-universal @PHONY: release-windows release-windows: # prereqs: # brew install mingw-w64 - cargo build --target x86_64-pc-windows-gnu --release + cargo build --target x86_64-pc-windows-gnu --profile release-github target/openssl-linux/openssl-$(OPENSSL_VERSION).tar.gz: mkdir -p target/openssl-linux @@ -61,7 +61,7 @@ release-linux-current-target: target/openssl-linux/$(TARGET)/lib/libssl.a AR_$(TARGET_SNAKE_CASE)=$(CROSS_COMPILE_PREFIX)-ar \ CARGO_TARGET_$(TARGET_SNAKE_UPPER_CASE)_LINKER=$(CROSS_COMPILE_PREFIX)-gcc \ OPENSSL_DIR=$(PWD)/target/openssl-linux/$(TARGET)/ \ - cargo build --release --target=$(TARGET) + cargo build --profile release-github --target=$(TARGET) @PHONY: release-linux release-linux: release-linux-x86_64 release-linux-aarch64 release-linux-armv6 @@ -99,7 +99,7 @@ release-linux-armv6: release-all: release-windows release-linux release-macos-universal rm -rf /tmp/rqbit-release mkdir -p /tmp/rqbit-release - cp ./target/x86_64-pc-windows-gnu/release/rqbit.exe /tmp/rqbit-release - cp ./target/x86_64-apple-darwin/release/rqbit-osx-universal /tmp/rqbit-release - cp ./target/x86_64-unknown-linux-gnu/release/rqbit /tmp/rqbit-release/rqbit-linux-x86_64 + cp ./target/x86_64-pc-windows-gnu/release-github/rqbit.exe /tmp/rqbit-release + cp ./target/x86_64-apple-darwin/release-github/rqbit-osx-universal /tmp/rqbit-release + cp ./target/x86_64-unknown-linux-gnu/release-github/rqbit /tmp/rqbit-release/rqbit-linux-x86_64 echo "The release was built in /tmp/rqbit-release" \ No newline at end of file