From 9e3d8fd97739bcb9c6f625f6076e3977209de9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 10 Aug 2022 23:29:37 +0200 Subject: [PATCH 1/3] Add CI --- .github/workflows/ci.yml | 81 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8aad5cd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +name: ci + +on: + push: + branches: [main] + pull_request: + +env: + CARGO_INCREMENTAL: 0 + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt + + - name: Install Rust targets + run: > + rustup target add + aarch64-linux-android + armv7-linux-androideabi + x86_64-linux-android + i686-linux-android + + - name: Install cargo-ndk + run: cargo install cargo-ndk + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - name: Build game-activity + working-directory: android-activity + run: > + cargo ndk + -t arm64-v8a + -t armeabi-v7a + -t x86_64 + -t x86 + build --features game-activity + + - name: Build native-activity + working-directory: android-activity + run: > + cargo ndk + -t arm64-v8a + -t armeabi-v7a + -t x86_64 + -t x86 + build --features native-activity + + - name: Build agdk-egui example + working-directory: examples/agdk-egui + run: > + cargo ndk + -t arm64-v8a + -t armeabi-v7a + -t x86_64 + -t x86 + -o app/src/main/jniLibs/ -- build + + - name: Format + run: cargo fmt --all -- --check + working-directory: android-activity + + - name: Format agdk-egui example + run: cargo fmt --all -- --check + working-directory: examples/agdk-egui From 49c877085b38400cdef8cd48fbd62459ab3a353b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 11 Aug 2022 00:49:22 +0200 Subject: [PATCH 2/3] Fix indentation --- .github/workflows/ci.yml | 112 +++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8aad5cd..6c29b78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,72 +10,70 @@ env: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rustfmt + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt - - name: Install Rust targets - run: > - rustup target add - aarch64-linux-android - armv7-linux-androideabi - x86_64-linux-android - i686-linux-android + - name: Install Rust targets + run: > + rustup target add + aarch64-linux-android + armv7-linux-androideabi + x86_64-linux-android + i686-linux-android - - name: Install cargo-ndk - run: cargo install cargo-ndk + - name: Install cargo-ndk + run: cargo install cargo-ndk - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' - - name: Setup Android SDK - uses: android-actions/setup-android@v2 + - name: Setup Android SDK + uses: android-actions/setup-android@v2 - - name: Build game-activity - working-directory: android-activity - run: > - cargo ndk - -t arm64-v8a - -t armeabi-v7a - -t x86_64 - -t x86 - build --features game-activity + - name: Build game-activity + working-directory: android-activity + run: > + cargo ndk + -t arm64-v8a + -t armeabi-v7a + -t x86_64 + -t x86 + build --features game-activity - - name: Build native-activity - working-directory: android-activity - run: > - cargo ndk - -t arm64-v8a - -t armeabi-v7a - -t x86_64 - -t x86 - build --features native-activity + - name: Build native-activity + working-directory: android-activity + run: > + cargo ndk + -t arm64-v8a + -t armeabi-v7a + -t x86_64 + -t x86 + build --features native-activity - - name: Build agdk-egui example - working-directory: examples/agdk-egui - run: > - cargo ndk - -t arm64-v8a - -t armeabi-v7a - -t x86_64 - -t x86 - -o app/src/main/jniLibs/ -- build + - name: Build agdk-egui example + working-directory: examples/agdk-egui + run: > + cargo ndk + -t arm64-v8a + -t armeabi-v7a + -t x86_64 + -t x86 + -o app/src/main/jniLibs/ -- build - - name: Format - run: cargo fmt --all -- --check - working-directory: android-activity + - name: Format + run: cargo fmt --all -- --check + working-directory: android-activity - - name: Format agdk-egui example - run: cargo fmt --all -- --check - working-directory: examples/agdk-egui + - name: Format agdk-egui example + run: cargo fmt --all -- --check + working-directory: examples/agdk-egui From 8601f28eba7b1be04a039dee7b0aa3765616634b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 11 Aug 2022 01:04:09 +0200 Subject: [PATCH 3/3] Split formatting to a separate job --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c29b78..c5cd042 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: - uses: actions-rs/toolchain@v1 with: + profile: minimal toolchain: stable override: true - components: rustfmt - name: Install Rust targets run: > @@ -70,6 +70,18 @@ jobs: -t x86 -o app/src/main/jniLibs/ -- build + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt + - name: Format run: cargo fmt --all -- --check working-directory: android-activity