Fix CI #1712
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
name: ci | |
on: [push, pull_request] | |
jobs: | |
ktlint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.0.1/ktlint && chmod a+x ktlint | |
- run: ./ktlint | |
gradle-wrapper-validation: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/wrapper-validation-action@v1 | |
gradle: | |
runs-on: ${{ matrix.os }} | |
needs: tox4j | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-11 | |
- windows-2022 | |
steps: | |
- name: Download tox4j | |
uses: actions/download-artifact@v3 | |
with: | |
name: tox4j | |
path: ~/.m2 | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: ${{ github.ref != 'refs/heads/master' }} | |
- name: Build and test | |
run: ./gradlew build | |
- name: Run Android tests | |
if: startsWith(matrix.os, 'macos') | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 31 | |
arch: x86_64 | |
script: ./gradlew connectedCheck || { adb logcat -d; exit 1; } | |
- name: Upload apk | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: atox-debug.apk | |
path: ./atox/build/outputs/apk/debug/atox-debug.apk | |
tox4j: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Set up cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository/org/toktok | |
key: from-src-${{ hashFiles('scripts/**') }} | |
# TODO(robinlinden): Update NDK. | |
- name: Set up NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
# https://github.com/actions/virtual-environments/issues/5595 | |
SDKMANAGER="${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" | |
echo "y" | $SDKMANAGER "ndk;21.4.7075529" | |
- name: Install tox4j dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: sudo apt-get update && sudo apt install yasm | |
- name: Work around jvm-toxcore-c not building w/ libstdc++-13 | |
run: | | |
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list | |
sudo apt-get update | |
sudo apt-get install --allow-downgrades libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04 | |
- name: Build tox4j | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
export ANDROID_NDK_HOME="${ANDROID_SDK_ROOT}/ndk/21.4.7075529" | |
./scripts/build-host -j$(nproc) | |
./scripts/build-aarch64-linux-android -j$(nproc) release | |
./scripts/build-arm-linux-androideabi -j$(nproc) release | |
./scripts/build-i686-linux-android -j$(nproc) release | |
./scripts/build-x86_64-linux-android -j$(nproc) release | |
- name: Upload tox4j | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tox4j | |
path: ~/.m2 | |
bazel: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Set up Android | |
run: | | |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "ndk;$NDK_VERSION" | grep -v = || true | |
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION" >> $GITHUB_ENV | |
env: | |
NDK_VERSION: "25.2.9519653" | |
- name: Set up Bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: bazel-${{ hashFiles('WORKSPACE', 'bazel/**') }} | |
restore-keys: bazel- | |
- name: Build | |
run: bazel build //... | |
- name: Test | |
run: bazel test //... | |
buildifier: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
wget --output-document=buildifier https://github.com/bazelbuild/buildtools/releases/download/v6.1.2/buildifier-linux-amd64 | |
sudo chmod +x buildifier | |
- name: Check | |
run: ./buildifier --lint=warn --warnings=all -mode diff WORKSPACE $(find . -type f -name "BUILD.*") | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true |