mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 12:35:28 +00:00
add release build action
No longer using `cross`, so Cross.toml is not needed any more. Instead releases are just built with cargo build --release.
This commit is contained in:
parent
b6191ccf13
commit
4471607f96
5 changed files with 142 additions and 3 deletions
8
.cargo/config
Normal file
8
.cargo/config
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
|
[target.arm-unknown-linux-gnueabihf]
|
||||||
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
|
||||||
|
[target.armv7-unknown-linux-gnueabihf]
|
||||||
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
109
.github/workflows/rust.yml
vendored
Normal file
109
.github/workflows/rust.yml
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
name: Release Builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*' # on every version tag
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# first just a small job to draft the release so all others can use the upload_url
|
||||||
|
create_release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: create release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ github.ref }}
|
||||||
|
# only draft the release so changelog can be edited
|
||||||
|
draft: true
|
||||||
|
prerelease: false
|
||||||
|
outputs:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
|
||||||
|
build_ubuntu:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: create_release
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: build
|
||||||
|
run: bash release.sh
|
||||||
|
- name: upload release asset x86_64
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./agate.x86_64-unknown-linux-gnu.gz
|
||||||
|
asset_name: agate.x86_64-unknown-linux-gnu.gz
|
||||||
|
asset_content_type: application/gzip
|
||||||
|
- name: upload release asset arm
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./agate.arm-unknown-linux-gnueabihf.gz
|
||||||
|
asset_name: agate.arm-unknown-linux-gnueabihf.gz
|
||||||
|
asset_content_type: application/gzip
|
||||||
|
- name: upload release asset armv7
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./agate.armv7-unknown-linux-gnueabihf.gz
|
||||||
|
asset_name: agate.armv7-unknown-linux-gnueabihf.gz
|
||||||
|
asset_content_type: application/gzip
|
||||||
|
- name: upload release asset aarch64
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./agate.aarch64-unknown-linux-gnu.gz
|
||||||
|
asset_name: agate.aarch64-unknown-linux-gnu.gz
|
||||||
|
asset_content_type: application/gzip
|
||||||
|
|
||||||
|
build_windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
needs: create_release
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: rustc -Vv
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --verbose --release
|
||||||
|
- name: upload release asset win
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
|
asset_name: agate.x86_64-pc-windows-msvc.exe
|
||||||
|
# TODO: this one is not zipped and not stripped
|
||||||
|
asset_path: target/release/agate.exe
|
||||||
|
asset_content_type: application/vnd.microsoft.portable-executable
|
||||||
|
|
||||||
|
build_macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
needs: create_release
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --verbose --release
|
||||||
|
- name: strip names
|
||||||
|
run: strip target/release/agate
|
||||||
|
- name: compress
|
||||||
|
run: gzip -c target/release/agate > ./agate.gz
|
||||||
|
- name: upload release asset darwin
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./agate.gz
|
||||||
|
asset_name: agate.x86_64-apple-darwin.gz
|
||||||
|
asset_content_type: application/gzip
|
||||||
|
|
@ -9,7 +9,7 @@ repository = "https://github.com/mbrubeck/agate"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
exclude = ["/tools"]
|
exclude = ["/tools", ".github/", "release.sh"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio-rustls = "0.22.0"
|
tokio-rustls = "0.22.0"
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
[target.arm-unknown-linux-gnueabihf]
|
|
||||||
image = "zenria/cross:arm-rpi-4.9.3-linux-gnueabihf"
|
|
||||||
24
release.sh
Executable file
24
release.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This is used to build cross platform linux binaries for a release in CI.
|
||||||
|
# Since this is not supervised, abort if anything does not work.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Cross-compiling needs a linker for the respective platforms. If you are on a Debian-based x86_64 Linux,
|
||||||
|
# you can install them with:
|
||||||
|
sudo apt -y install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
|
||||||
|
|
||||||
|
for i in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu arm-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf
|
||||||
|
do
|
||||||
|
# Make sure the cross-compiled std crate is available.
|
||||||
|
rustup target add $i
|
||||||
|
cargo build --verbose --release --target $i
|
||||||
|
cp target/$i/release/agate agate.$i
|
||||||
|
done
|
||||||
|
|
||||||
|
# Strip all the binaries.
|
||||||
|
strip agate.x86_64-unknown-linux-gnu
|
||||||
|
aarch64-linux-gnu-strip agate.aarch64-unknown-linux-gnu
|
||||||
|
arm-linux-gnueabihf-strip agate.arm-unknown-linux-gnueabihf agate.armv7-unknown-linux-gnueabihf
|
||||||
|
|
||||||
|
# compress the binaries.
|
||||||
|
gzip agate.*
|
||||||
Loading…
Add table
Add a link
Reference in a new issue