229 lines
6.2 KiB
YAML
229 lines
6.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
android:
|
|
name: Android Unit Tests & Lint & Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Set up Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- name: Run Unit Tests
|
|
run: ./gradlew --no-daemon testDebugUnitTest
|
|
|
|
- name: Run Android Lint
|
|
run: ./gradlew --no-daemon lint
|
|
|
|
- name: Assemble Debug APK
|
|
run: ./gradlew --no-daemon assembleDebug
|
|
|
|
- name: Upload Test Reports
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: unit-test-reports
|
|
path: app/build/reports/tests/
|
|
|
|
- name: Upload Lint Reports
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: lint-reports
|
|
path: app/build/reports/lint-results*
|
|
|
|
rust:
|
|
name: Rust hermes-pair Tests & Clippy
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: hermes-pair
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
|
|
- name: Cache Cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: hermes-pair -> hermes-pair/target
|
|
|
|
- name: Run Cargo Tests
|
|
run: cargo test --all-targets
|
|
|
|
- name: Run Cargo Clippy
|
|
run: cargo clippy -- -D warnings
|
|
|
|
instrumented:
|
|
name: Android Instrumented Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- name: Enable KVM group perms
|
|
run: |
|
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm-rules.rules
|
|
sudo udevadm control --reload-rules
|
|
sudo udevadm trigger --name-match=kvm
|
|
|
|
- name: Run Instrumented Tests via Android Emulator Runner
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
with:
|
|
api-level: 29
|
|
arch: x86_64
|
|
target: default
|
|
disable-animations: true
|
|
script: ./gradlew --no-daemon connectedDebugAndroidTest
|
|
|
|
- name: Upload Instrumented Test Reports
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: android-test-reports
|
|
path: app/build/reports/androidTests/
|
|
|
|
build-pair-linux:
|
|
name: Build Hermes Pair (Linux)
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
defaults:
|
|
run:
|
|
working-directory: hermes-pair
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache Cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: hermes-pair -> hermes-pair/target
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release
|
|
|
|
- name: Upload Linux Binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hermes-pair-linux-x86_64
|
|
path: hermes-pair/target/release/hermes-pair
|
|
|
|
build-pair-windows:
|
|
name: Build Hermes Pair (Windows)
|
|
runs-on: windows-latest
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
defaults:
|
|
run:
|
|
working-directory: hermes-pair
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache Cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: hermes-pair -> hermes-pair/target
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release
|
|
|
|
- name: Upload Windows Binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hermes-pair-windows-x86_64.exe
|
|
path: hermes-pair/target/release/hermes-pair.exe
|
|
|
|
publish-release:
|
|
name: Publish GitHub Release
|
|
runs-on: ubuntu-latest
|
|
needs: [android, rust, build-pair-linux, build-pair-windows]
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create artifacts directory
|
|
run: mkdir -p release-assets
|
|
|
|
- name: Download Linux binary
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: hermes-pair-linux-x86_64
|
|
path: release-assets
|
|
|
|
- name: Move Linux binary to final name
|
|
run: |
|
|
chmod +x release-assets/hermes-pair || true
|
|
mv release-assets/hermes-pair release-assets/hermes-pair-linux-x86_64 || true
|
|
|
|
- name: Download Windows binary
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: hermes-pair-windows-x86_64.exe
|
|
path: release-assets
|
|
|
|
- name: Move Windows binary to final name
|
|
run: |
|
|
mv release-assets/hermes-pair.exe release-assets/hermes-pair-windows-x86_64.exe || true
|
|
|
|
- name: Compute SHA256 Checksums
|
|
working-directory: release-assets
|
|
run: |
|
|
sha256sum hermes-pair-linux-x86_64 hermes-pair-windows-x86_64.exe > SHA256SUMS.txt
|
|
cat SHA256SUMS.txt
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
release-assets/hermes-pair-linux-x86_64
|
|
release-assets/hermes-pair-windows-x86_64.exe
|
|
release-assets/SHA256SUMS.txt
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|