CHANGELOG.md: Add entry for PR #59 #172
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build-app: | |
name: Build app | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Validate gradle wrapper checksum | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
cache: gradle | |
- name: Build and test | |
# Debug build only since release builds require a signing key | |
run: ./gradlew --no-daemon build zipDebug -x assembleRelease | |
build-tool: | |
name: Build custota-tool | |
runs-on: ${{ matrix.artifact.os }} | |
env: | |
CARGO_TERM_COLOR: always | |
# https://github.com/rust-lang/rust/issues/78210 | |
RUSTFLAGS: -C strip=symbols -C target-feature=+crt-static | |
TARGETS: ${{ join(matrix.artifact.targets, ' ') || matrix.artifact.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
artifact: | |
- os: ubuntu-latest | |
name: x86_64-unknown-linux-gnu | |
- os: windows-latest | |
name: x86_64-pc-windows-msvc | |
- os: macos-latest | |
name: universal-apple-darwin | |
targets: | |
- aarch64-apple-darwin | |
- x86_64-apple-darwin | |
combine: lipo | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
# For git describe | |
fetch-depth: 0 | |
- name: Get version | |
id: get_version | |
shell: bash | |
run: | | |
echo -n 'version=' >> "${GITHUB_OUTPUT}" | |
git describe --always \ | |
| sed -E "s/^v//g;s/([^-]*-g)/r\1/;s/-/./g" \ | |
>> "${GITHUB_OUTPUT}" | |
- name: Install toolchains | |
shell: bash | |
run: | | |
for target in ${TARGETS}; do | |
rustup target add "${target}" | |
done | |
- name: Cache Rust dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: custota-tool | |
- name: Clippy | |
shell: bash | |
working-directory: custota-tool | |
run: | | |
for target in ${TARGETS}; do | |
cargo clippy --release --features static \ | |
--target "${target}" | |
done | |
- name: Formatting | |
working-directory: custota-tool | |
run: cargo fmt -- --check | |
- name: Build | |
shell: bash | |
working-directory: custota-tool | |
run: | | |
for target in ${TARGETS}; do | |
cargo build --release --features static \ | |
--target "${target}" | |
done | |
- name: Create output directory | |
shell: bash | |
working-directory: custota-tool | |
run: | | |
rm -rf target/output | |
case "${{ matrix.artifact.combine }}" in | |
lipo) | |
mkdir target/output | |
cmd=(lipo -output target/output/custota-tool -create) | |
for target in ${TARGETS}; do | |
cmd+=("target/${target}/release/custota-tool") | |
done | |
"${cmd[@]}" | |
;; | |
'') | |
ln -s "${TARGETS}/release" target/output | |
;; | |
*) | |
echo >&2 "Unsupported combine argument" | |
exit 1 | |
;; | |
esac | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: custota-tool-${{ steps.get_version.outputs.version }}-${{ matrix.artifact.name }} | |
path: | | |
custota-tool/target/output/custota-tool | |
custota-tool/target/output/custota-tool.exe |