Add android build
This commit is contained in:
parent
7e6975e5be
commit
714022af1f
1 changed files with 66 additions and 72 deletions
138
.github/workflows/release.yaml
vendored
138
.github/workflows/release.yaml
vendored
|
@ -1,8 +1,8 @@
|
||||||
on:
|
on:
|
||||||
# Indicates I want to run this workflow on all branches, PR, and tags
|
# Indicates I want to run this workflow on all branches, PR, and tags
|
||||||
push:
|
push:
|
||||||
branches: ["main", "draft"]
|
branches: [ "main", "draft" ]
|
||||||
tags: ["*"]
|
tags: [ "*" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
@ -40,11 +40,13 @@ jobs:
|
||||||
target: i686-unknown-freebsd
|
target: i686-unknown-freebsd
|
||||||
build-args: "--release"
|
build-args: "--release"
|
||||||
|
|
||||||
# - name: Android aarch64
|
- name: Android aarch64
|
||||||
# target: aarch64-linux-android
|
target: aarch64-linux-android
|
||||||
|
build-args: "--release"
|
||||||
|
|
||||||
# - name: Android armv7
|
- name: Android armv7
|
||||||
# target: armv7-linux-androideabi
|
target: armv7-linux-androideabi
|
||||||
|
build-args: "--release"
|
||||||
|
|
||||||
#- name: Linux mips
|
#- name: Linux mips
|
||||||
# target: mips-unknown-linux-musl
|
# target: mips-unknown-linux-musl
|
||||||
|
@ -83,87 +85,79 @@ jobs:
|
||||||
build-args: "--profile release-with-symbols"
|
build-args: "--profile release-with-symbols"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install package for linux
|
- name: Install package for linux
|
||||||
if: contains(matrix.platform.target, 'linux')
|
if: contains(matrix.platform.target, 'linux')
|
||||||
run: sudo apt install musl-tools
|
run: sudo apt install musl-tools
|
||||||
|
|
||||||
- name: Install package for Android
|
- name: Install package for Android
|
||||||
if: contains(matrix.platform.target, 'android')
|
if: contains(matrix.platform.target, 'android')
|
||||||
run: sudo apt install android-libunwind libunwind8
|
run: sudo apt install android-libunwind libunwind8
|
||||||
|
|
||||||
- name: Checkout Git repo
|
- name: Setup Android SDK
|
||||||
uses: actions/checkout@v3
|
if: contains(matrix.platform.target, 'android')
|
||||||
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
# Linux & Windows
|
- name: Checkout Git repo
|
||||||
- name: Install rust toolchain for Linux
|
uses: actions/checkout@v3
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
# We setup Rust toolchain and the desired target
|
|
||||||
profile: minimal
|
|
||||||
toolchain: "${{ env.RUST_VERSION }}"
|
|
||||||
override: true
|
|
||||||
target: ${{ matrix.platform.target }}
|
|
||||||
components: rustfmt, clippy
|
|
||||||
|
|
||||||
- name: Install rust toolchain for Android
|
# Linux & Windows
|
||||||
if: ${{ contains(matrix.platform.target, 'android') }}
|
- name: Install rust toolchain for Linux
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
# Need new release of cross to target rust > 1.68.0
|
# We setup Rust toolchain and the desired target
|
||||||
# https://github.com/cross-rs/cross/issues/1222
|
profile: minimal
|
||||||
profile: minimal
|
toolchain: "${{ env.RUST_VERSION }}"
|
||||||
toolchain: 1.67.0
|
override: true
|
||||||
override: true
|
target: ${{ matrix.platform.target }}
|
||||||
target: ${{ matrix.platform.target }}
|
components: rustfmt, clippy
|
||||||
components: rustfmt, clippy
|
|
||||||
|
|
||||||
- name: Show command used for Cargo
|
- name: Show command used for Cargo
|
||||||
run: |
|
run: |
|
||||||
echo "cargo command is: ${{ env.CARGO }}"
|
echo "cargo command is: ${{ env.CARGO }}"
|
||||||
echo "target flag is: ${{ env.BUILD_ARGS }}"
|
echo "target flag is: ${{ env.BUILD_ARGS }}"
|
||||||
|
|
||||||
- name: Build ${{ matrix.platform.name }} binary
|
- name: Build ${{ matrix.platform.name }} binary
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
# We use cross-rs if not running on x86_64 architecture on Linux
|
# We use cross-rs if not running on x86_64 architecture on Linux
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
use-cross: ${{ !contains(matrix.platform.target, 'x86_64') || contains(matrix.platform.target, 'freebsd') }}
|
use-cross: ${{ !contains(matrix.platform.target, 'x86_64') || contains(matrix.platform.target, 'freebsd') }}
|
||||||
args: ${{ matrix.platform.build-args }} --target ${{ matrix.platform.target }}
|
args: ${{ matrix.platform.build-args }} --target ${{ matrix.platform.target }}
|
||||||
|
|
||||||
- name: Store artifact
|
- name: Store artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
# Finally, we store the binary as GitHub artifact for later usage
|
# Finally, we store the binary as GitHub artifact for later usage
|
||||||
name: ${{ env.BIN_NAME }}-${{ matrix.platform.target }}
|
name: ${{ env.BIN_NAME }}-${{ matrix.platform.target }}
|
||||||
path: target/${{ matrix.platform.target }}/release${{ contains(matrix.platform.target, 'windows') && '-with-symbols' || '' }}/${{ env.BIN_NAME }}${{ contains(matrix.platform.target, 'windows') && '.exe' || '' }}
|
path: target/${{ matrix.platform.target }}/release${{ contains(matrix.platform.target, 'windows') && '-with-symbols' || '' }}/${{ env.BIN_NAME }}${{ contains(matrix.platform.target, 'windows') && '.exe' || '' }}
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
needs: [build]
|
needs: [ build ]
|
||||||
# We run the release job only if a tag starts with 'v' letter
|
# We run the release job only if a tag starts with 'v' letter
|
||||||
if: startsWith( github.ref, 'refs/tags/v' )
|
if: startsWith( github.ref, 'refs/tags/v' )
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Git repo
|
- name: Checkout Git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Download all artifacts
|
# Download all artifacts
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
|
|
||||||
- name: list artifacts
|
- name: list artifacts
|
||||||
run: find artifacts/
|
run: find artifacts/
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: latest
|
||||||
args: release --clean --skip=validate
|
args: release --clean --skip=validate
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
Loading…
Reference in a new issue