From 3b6f1f0267b6e7c3030f01c28a151aaeab6affc3 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Tue, 9 Mar 2021 10:33:00 +0100 Subject: [PATCH 01/28] build ios/android libs --- .github/workflows/audit.yml | 3 +- .github/workflows/ci.yml | 195 ++++++++++++++++++++++++++++++++---- 2 files changed, 176 insertions(+), 22 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 786356e53..8d5282321 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -16,8 +16,7 @@ jobs: - name: Run rust-audit id: rust-audit - run: | - cargo audit --deny warnings + run: cargo audit --deny warnings - name: Notify on Slack uses: 8398a7/action-slack@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f028be70..a81f7f176 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,22 @@ name: Rust-CI -on: +on: push: env: RUST_STABLE: 1.49.0 RUST_NIGHTLY: nightly-2021-01-31 + CARGO_NDK: 2.2.0 + ANDROID_PLATFORM_VERSION: 21 + CARGO_LIPO: 3.1.1 jobs: registry-cache: + # we use the latest stable rustc + cargo version that is already installed on the image + # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools name: cargo-fetch timeout-minutes: 5 - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 outputs: cache-key: ${{ steps.cache-key.outputs.key }} cache-date: ${{ steps.get-date.outputs.date }} @@ -19,28 +24,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install stable toolchain - id: rust-toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_STABLE }} - default: true - # We want to create a new cache after a week. Otherwise, the cache will # take up too much space by caching old dependencies - - name: Year + ISO week number + - name: Generate Year + ISO week number key id: get-date run: echo "::set-output name=date::$(/bin/date -u "+%Y-%V")" shell: bash - - name: Cache key + - name: Generate cargo registry cache key id: cache-key run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-registry-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/Cargo.lock') }})" shell: bash - - name: Cache cargo registry - uses: actions/cache@v2 + - name: Restore cargo registry ${{ steps.cache-key.outputs.key }} cache + uses: actions/cache@v2.1.4 with: path: | ~/.cargo/registry @@ -48,14 +45,14 @@ jobs: key: ${{ steps.cache-key.outputs.key }} restore-keys: ${{ runner.os }}-cargo-registry-${{ steps.get-date.outputs.date }}- - - name: cargo fetch + - name: Fetch dependencies run: cargo fetch format: name: cargo-fmt needs: registry-cache timeout-minutes: 10 - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -85,7 +82,7 @@ jobs: name: cargo-check needs: registry-cache timeout-minutes: 20 - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -124,7 +121,7 @@ jobs: name: cargo-clippy needs: [registry-cache, check] timeout-minutes: 20 - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -162,7 +159,7 @@ jobs: name: cargo-test needs: [registry-cache, check] timeout-minutes: 20 - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -206,7 +203,7 @@ jobs: name: cargo-tarpaulin needs: [registry-cache, test] timeout-minutes: 20 - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -242,3 +239,161 @@ jobs: with: version: '0.16.0' args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' + + cargo-ndk: + # we use the latest stable rustc + cargo version that is already installed on the image + # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools + name: cargo-ndk + timeout-minutes: 15 + runs-on: ubuntu-20.04 + outputs: + cache-key: ${{ steps.cache-key.outputs.key }} + steps: + - name: Generate cargo-ndk cache key + id: cache-key + shell: bash + run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" + + - name: Restore ${{ steps.cache-key.outputs.key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-ndk + key: ${{ steps.cache-key.outputs.key }} + + - name: Test for cargo-ndk ${{ env.CARGO_NDK }} + id: test-bin + shell: bash + run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" + + - name: Install cargo-ndk ${{ env.CARGO_NDK }} + if: steps.test-bin.outputs.exist != '0' + run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} + + cargo-lipo: + # we use the latest stable rustc + cargo version that is already installed on the image + # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools + name: cargo-lipo + timeout-minutes: 15 + runs-on: macos-10.15 + outputs: + cache-key: ${{ steps.cache-key.outputs.key }} + steps: + - name: Generate cargo-lipo cache key + id: cache-key + shell: bash + run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-lipo-bin-${{ env.CARGO_LIPO }})" + + - name: Restore ${{ steps.cache-key.outputs.key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-lipo + key: ${{ steps.cache-key.outputs.key }} + + - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} + id: test-bin + shell: bash + run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" + + - name: Install cargo-lipo ${{ env.CARGO_LIPO }} + if: steps.test-bin.outputs.exist != '0' + run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} + + build-android-libs: + name: build-android-libs + runs-on: ubuntu-20.04 + timeout-minutes: 20 + needs: [registry-cache, cargo-ndk, test] + strategy: + matrix: + target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] + include: + - target: aarch64-linux-android + ndk-target: arm64-v8a + - target: armv7-linux-androideabi + ndk-target: armeabi-v7a + - target: i686-linux-android + ndk-target: x86 + - target: x86_64-linux-android + ndk-target: x86_64 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + target: ${{ matrix.target }} + default: true + + - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache + uses: actions/cache@v2.1.4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + - name: Restore ${{ needs.cargo-ndk.outputs.cache-key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-ndk + key: ${{ needs.cargo-ndk.outputs.cache-key }} + + - name: Restore build artifacts + uses: actions/cache@v2.1.4 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + + - name: Build Android libraries + working-directory: ./xayn-ai-ffi + run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build + + + build-ios-libs: + name: build-ios-libs + runs-on: macos-10.15 + timeout-minutes: 20 + needs: [registry-cache, cargo-lipo, test] + strategy: + matrix: + target: [aarch64-apple-ios, x86_64-apple-ios] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + target: ${{ matrix.target }} + default: true + + - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache + uses: actions/cache@v2.1.4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + - name: Restore ${{ needs.cargo-lipo.outputs.cache-key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-lipo + key: ${{ needs.cargo-lipo.outputs.cache-key }} + + - name: Restore build artifacts + uses: actions/cache@v2.1.4 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + + - name: Build iOS libraries + working-directory: ./xayn-ai-ffi + run: cargo lipo --targets ${{ matrix.target }} From d6b214a7bb041bf3b6e8a61d4af75e4edc3424f6 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 12 Mar 2021 15:56:33 +0100 Subject: [PATCH 02/28] fmt [skip ci] --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a81f7f176..634a51f34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -352,7 +352,6 @@ jobs: working-directory: ./xayn-ai-ffi run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build - build-ios-libs: name: build-ios-libs runs-on: macos-10.15 From 20bf51ad5d1c89d9ef43d665e4a6b5c19abe12a4 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Mon, 15 Mar 2021 09:45:07 +0100 Subject: [PATCH 03/28] [skip ci] --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 634a51f34..2715754bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: # we use the latest stable rustc + cargo version that is already installed on the image # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools name: cargo-fetch - timeout-minutes: 5 runs-on: ubuntu-20.04 + timeout-minutes: 5 outputs: cache-key: ${{ steps.cache-key.outputs.key }} cache-date: ${{ steps.get-date.outputs.date }} @@ -28,13 +28,13 @@ jobs: # take up too much space by caching old dependencies - name: Generate Year + ISO week number key id: get-date - run: echo "::set-output name=date::$(/bin/date -u "+%Y-%V")" shell: bash + run: echo "::set-output name=date::$(/bin/date -u "+%Y-%V")" - name: Generate cargo registry cache key id: cache-key - run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-registry-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/Cargo.lock') }})" shell: bash + run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-registry-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/Cargo.lock') }})" - name: Restore cargo registry ${{ steps.cache-key.outputs.key }} cache uses: actions/cache@v2.1.4 @@ -51,8 +51,8 @@ jobs: format: name: cargo-fmt needs: registry-cache - timeout-minutes: 10 runs-on: ubuntu-20.04 + timeout-minutes: 10 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -81,8 +81,8 @@ jobs: check: name: cargo-check needs: registry-cache - timeout-minutes: 20 runs-on: ubuntu-20.04 + timeout-minutes: 20 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -120,8 +120,8 @@ jobs: clippy: name: cargo-clippy needs: [registry-cache, check] - timeout-minutes: 20 runs-on: ubuntu-20.04 + timeout-minutes: 20 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -158,8 +158,8 @@ jobs: test: name: cargo-test needs: [registry-cache, check] - timeout-minutes: 20 runs-on: ubuntu-20.04 + timeout-minutes: 20 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -202,8 +202,8 @@ jobs: coverage: name: cargo-tarpaulin needs: [registry-cache, test] - timeout-minutes: 20 runs-on: ubuntu-20.04 + timeout-minutes: 20 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -244,10 +244,10 @@ jobs: # we use the latest stable rustc + cargo version that is already installed on the image # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools name: cargo-ndk - timeout-minutes: 15 runs-on: ubuntu-20.04 outputs: cache-key: ${{ steps.cache-key.outputs.key }} + timeout-minutes: 15 steps: - name: Generate cargo-ndk cache key id: cache-key @@ -273,10 +273,10 @@ jobs: # we use the latest stable rustc + cargo version that is already installed on the image # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools name: cargo-lipo - timeout-minutes: 15 runs-on: macos-10.15 outputs: cache-key: ${{ steps.cache-key.outputs.key }} + timeout-minutes: 15 steps: - name: Generate cargo-lipo cache key id: cache-key @@ -300,9 +300,9 @@ jobs: build-android-libs: name: build-android-libs + needs: [registry-cache, cargo-ndk, test] runs-on: ubuntu-20.04 timeout-minutes: 20 - needs: [registry-cache, cargo-ndk, test] strategy: matrix: target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] @@ -354,9 +354,9 @@ jobs: build-ios-libs: name: build-ios-libs + needs: [registry-cache, cargo-lipo, test] runs-on: macos-10.15 timeout-minutes: 20 - needs: [registry-cache, cargo-lipo, test] strategy: matrix: target: [aarch64-apple-ios, x86_64-apple-ios] From 08e59658b972ac9f53f3fb2487898a4c918246df Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 12:39:20 +0100 Subject: [PATCH 04/28] test --- .github/workflows/ci.yml | 692 ++++++++++++++++++++------------------- 1 file changed, 362 insertions(+), 330 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2715754bf..b31ccf5b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ env: jobs: registry-cache: # we use the latest stable rustc + cargo version that is already installed on the image - # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools + # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools name: cargo-fetch runs-on: ubuntu-20.04 timeout-minutes: 5 @@ -48,330 +48,18 @@ jobs: - name: Fetch dependencies run: cargo fetch - format: - name: cargo-fmt - needs: registry-cache - runs-on: ubuntu-20.04 - timeout-minutes: 10 - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install nightly toolchain - id: rust-toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_NIGHTLY }} - components: rustfmt - default: true - - - name: Use cached cargo registry - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ needs.registry-cache.outputs.cache-key }} - - # cargo fmt does not create any artifacts, therefore we don't need to cache the target folder - - name: cargo fmt - run: cargo fmt --all -- --check - - check: - name: cargo-check - needs: registry-cache - runs-on: ubuntu-20.04 - timeout-minutes: 20 - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install stable toolchain - id: rust-toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_STABLE }} - default: true - - - name: Use cached cargo registry - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ needs.registry-cache.outputs.cache-key }} - - - name: Cache build artifacts - uses: actions/cache@v2 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}- - - - name: cargo check - env: - RUSTFLAGS: "-D warnings" - run: | - cargo check --all-targets - cargo check --all-targets --all-features - - clippy: - name: cargo-clippy - needs: [registry-cache, check] - runs-on: ubuntu-20.04 - timeout-minutes: 20 - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install stable toolchain - id: rust-toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_STABLE }} - components: clippy - default: true - - - name: Use cached cargo registry - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ needs.registry-cache.outputs.cache-key }} - - - name: Cache build artifacts - uses: actions/cache@v2 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}- - - - name: cargo clippy - run: | - cargo clippy --all-targets -- --deny warnings - cargo clippy --all-targets --all-features -- --deny warnings - - test: - name: cargo-test - needs: [registry-cache, check] - runs-on: ubuntu-20.04 - timeout-minutes: 20 - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install stable toolchain - id: rust-toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_STABLE }} - default: true - - - name: Use cached cargo registry - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ needs.registry-cache.outputs.cache-key }} - - - name: Cache build artifacts - uses: actions/cache@v2 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}- - - # TODO: cache this as well to avoid frequent downloading - - name: Download data - run: sh download_data.sh - - - name: Run tests - env: - RUSTFLAGS: "-D warnings" - run: | - cargo test --all-targets - cargo test --all-targets --all-features - cargo test --all-features --doc - - coverage: - name: cargo-tarpaulin - needs: [registry-cache, test] - runs-on: ubuntu-20.04 - timeout-minutes: 20 - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install stable toolchain - id: rust-toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.RUST_STABLE }} - profile: minimal - - - name: Use cached cargo registry - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ needs.registry-cache.outputs.cache-key }} - - - name: Cache build artifacts - uses: actions/cache@v2 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}- - - # TODO: cache this as well to avoid frequent downloading - - name: Download data - run: sh download_data.sh - - - name: Run cargo-tarpaulin - uses: actions-rs/tarpaulin@v0.1 - with: - version: '0.16.0' - args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' - - cargo-ndk: - # we use the latest stable rustc + cargo version that is already installed on the image - # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools - name: cargo-ndk - runs-on: ubuntu-20.04 - outputs: - cache-key: ${{ steps.cache-key.outputs.key }} - timeout-minutes: 15 - steps: - - name: Generate cargo-ndk cache key - id: cache-key - shell: bash - run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" - - - name: Restore ${{ steps.cache-key.outputs.key }} cache - uses: actions/cache@v2.1.4 - with: - path: ~/.cargo/bin/cargo-ndk - key: ${{ steps.cache-key.outputs.key }} - - - name: Test for cargo-ndk ${{ env.CARGO_NDK }} - id: test-bin - shell: bash - run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" - - - name: Install cargo-ndk ${{ env.CARGO_NDK }} - if: steps.test-bin.outputs.exist != '0' - run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} - - cargo-lipo: - # we use the latest stable rustc + cargo version that is already installed on the image - # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools - name: cargo-lipo - runs-on: macos-10.15 - outputs: - cache-key: ${{ steps.cache-key.outputs.key }} - timeout-minutes: 15 - steps: - - name: Generate cargo-lipo cache key - id: cache-key - shell: bash - run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-lipo-bin-${{ env.CARGO_LIPO }})" - - - name: Restore ${{ steps.cache-key.outputs.key }} cache - uses: actions/cache@v2.1.4 - with: - path: ~/.cargo/bin/cargo-lipo - key: ${{ steps.cache-key.outputs.key }} - - - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} - id: test-bin - shell: bash - run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" - - - name: Install cargo-lipo ${{ env.CARGO_LIPO }} - if: steps.test-bin.outputs.exist != '0' - run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} - - build-android-libs: - name: build-android-libs - needs: [registry-cache, cargo-ndk, test] + test-android-libs: + name: test-android-libs + needs: [registry-cache] runs-on: ubuntu-20.04 timeout-minutes: 20 strategy: matrix: target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] - include: - - target: aarch64-linux-android - ndk-target: arm64-v8a - - target: armv7-linux-androideabi - ndk-target: armeabi-v7a - - target: i686-linux-android - ndk-target: x86 - - target: x86_64-linux-android - ndk-target: x86_64 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_STABLE }} - target: ${{ matrix.target }} - default: true - - - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache - uses: actions/cache@v2.1.4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ needs.registry-cache.outputs.cache-key }} - - - name: Restore ${{ needs.cargo-ndk.outputs.cache-key }} cache - uses: actions/cache@v2.1.4 - with: - path: ~/.cargo/bin/cargo-ndk - key: ${{ needs.cargo-ndk.outputs.cache-key }} - - - name: Restore build artifacts - uses: actions/cache@v2.1.4 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - - - name: Build Android libraries - working-directory: ./xayn-ai-ffi - run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build - - build-ios-libs: - name: build-ios-libs - needs: [registry-cache, cargo-lipo, test] - runs-on: macos-10.15 - timeout-minutes: 20 - strategy: - matrix: - target: [aarch64-apple-ios, x86_64-apple-ios] steps: - name: Checkout uses: actions/checkout@v2 - - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_STABLE }} - target: ${{ matrix.target }} - default: true - - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache uses: actions/cache@v2.1.4 with: @@ -380,19 +68,363 @@ jobs: ~/.cargo/git key: ${{ needs.registry-cache.outputs.cache-key }} - - name: Restore ${{ needs.cargo-lipo.outputs.cache-key }} cache - uses: actions/cache@v2.1.4 - with: - path: ~/.cargo/bin/cargo-lipo - key: ${{ needs.cargo-lipo.outputs.cache-key }} - - - name: Restore build artifacts - uses: actions/cache@v2.1.4 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + - name: install Cross + shell: bash + run: | + wget -q -O - https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - + mv cross ~/.cargo/bin/ - - name: Build iOS libraries + - name: Test Android libraries working-directory: ./xayn-ai-ffi - run: cargo lipo --targets ${{ matrix.target }} + run: cross test --target ${{ matrix.target }} + + + +# format: +# name: cargo-fmt +# needs: registry-cache +# runs-on: ubuntu-20.04 +# timeout-minutes: 10 +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 + +# - name: Install nightly toolchain +# id: rust-toolchain +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: ${{ env.RUST_NIGHTLY }} +# components: rustfmt +# default: true + +# - name: Use cached cargo registry +# uses: actions/cache@v2 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# # cargo fmt does not create any artifacts, therefore we don't need to cache the target folder +# - name: cargo fmt +# run: cargo fmt --all -- --check + +# check: +# name: cargo-check +# needs: registry-cache +# runs-on: ubuntu-20.04 +# timeout-minutes: 20 +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 + +# - name: Install stable toolchain +# id: rust-toolchain +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: ${{ env.RUST_STABLE }} +# default: true + +# - name: Use cached cargo registry +# uses: actions/cache@v2 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# - name: Cache build artifacts +# uses: actions/cache@v2 +# with: +# path: ${{ github.workspace }}/target +# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}- + +# - name: cargo check +# env: +# RUSTFLAGS: "-D warnings" +# run: | +# cargo check --all-targets +# cargo check --all-targets --all-features + +# clippy: +# name: cargo-clippy +# needs: [registry-cache, check] +# runs-on: ubuntu-20.04 +# timeout-minutes: 20 +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 + +# - name: Install stable toolchain +# id: rust-toolchain +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: ${{ env.RUST_STABLE }} +# components: clippy +# default: true + +# - name: Use cached cargo registry +# uses: actions/cache@v2 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# - name: Cache build artifacts +# uses: actions/cache@v2 +# with: +# path: ${{ github.workspace }}/target +# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}- + +# - name: cargo clippy +# run: | +# cargo clippy --all-targets -- --deny warnings +# cargo clippy --all-targets --all-features -- --deny warnings + +# test: +# name: cargo-test +# needs: [registry-cache, check] +# runs-on: ubuntu-20.04 +# timeout-minutes: 20 +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 + +# - name: Install stable toolchain +# id: rust-toolchain +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: ${{ env.RUST_STABLE }} +# default: true + +# - name: Use cached cargo registry +# uses: actions/cache@v2 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# - name: Cache build artifacts +# uses: actions/cache@v2 +# with: +# path: ${{ github.workspace }}/target +# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}- + +# # TODO: cache this as well to avoid frequent downloading +# - name: Download data +# run: sh download_data.sh + +# - name: Run tests +# env: +# RUSTFLAGS: "-D warnings" +# run: | +# cargo test --all-targets +# cargo test --all-targets --all-features +# cargo test --all-features --doc + +# coverage: +# name: cargo-tarpaulin +# needs: [registry-cache, test] +# runs-on: ubuntu-20.04 +# timeout-minutes: 20 +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 + +# - name: Install stable toolchain +# id: rust-toolchain +# uses: actions-rs/toolchain@v1 +# with: +# toolchain: ${{ env.RUST_STABLE }} +# profile: minimal + +# - name: Use cached cargo registry +# uses: actions/cache@v2 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# - name: Cache build artifacts +# uses: actions/cache@v2 +# with: +# path: ${{ github.workspace }}/target +# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}- + +# # TODO: cache this as well to avoid frequent downloading +# - name: Download data +# run: sh download_data.sh + +# - name: Run cargo-tarpaulin +# uses: actions-rs/tarpaulin@v0.1 +# with: +# version: '0.16.0' +# args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' + +# cargo-ndk: +# # we use the latest stable rustc + cargo version that is already installed on the image +# # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools +# name: cargo-ndk +# runs-on: ubuntu-20.04 +# outputs: +# cache-key: ${{ steps.cache-key.outputs.key }} +# timeout-minutes: 15 +# steps: +# - name: Generate cargo-ndk cache key +# id: cache-key +# shell: bash +# run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" + +# - name: Restore ${{ steps.cache-key.outputs.key }} cache +# uses: actions/cache@v2.1.4 +# with: +# path: ~/.cargo/bin/cargo-ndk +# key: ${{ steps.cache-key.outputs.key }} + +# - name: Test for cargo-ndk ${{ env.CARGO_NDK }} +# id: test-bin +# shell: bash +# run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" + +# - name: Install cargo-ndk ${{ env.CARGO_NDK }} +# if: steps.test-bin.outputs.exist != '0' +# run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} + +# cargo-lipo: +# # we use the latest stable rustc + cargo version that is already installed on the image +# # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools +# name: cargo-lipo +# runs-on: macos-10.15 +# outputs: +# cache-key: ${{ steps.cache-key.outputs.key }} +# timeout-minutes: 15 +# steps: +# - name: Generate cargo-lipo cache key +# id: cache-key +# shell: bash +# run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-lipo-bin-${{ env.CARGO_LIPO }})" + +# - name: Restore ${{ steps.cache-key.outputs.key }} cache +# uses: actions/cache@v2.1.4 +# with: +# path: ~/.cargo/bin/cargo-lipo +# key: ${{ steps.cache-key.outputs.key }} + +# - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} +# id: test-bin +# shell: bash +# run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" + +# - name: Install cargo-lipo ${{ env.CARGO_LIPO }} +# if: steps.test-bin.outputs.exist != '0' +# run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} + +# build-android-libs: +# name: build-android-libs +# needs: [registry-cache, cargo-ndk, test] +# runs-on: ubuntu-20.04 +# timeout-minutes: 20 +# strategy: +# matrix: +# target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] +# include: +# - target: aarch64-linux-android +# ndk-target: arm64-v8a +# - target: armv7-linux-androideabi +# ndk-target: armeabi-v7a +# - target: i686-linux-android +# ndk-target: x86 +# - target: x86_64-linux-android +# ndk-target: x86_64 +# steps: +# - name: Checkout +# uses: actions/checkout@v2 + +# - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: ${{ env.RUST_STABLE }} +# target: ${{ matrix.target }} +# default: true + +# - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache +# uses: actions/cache@v2.1.4 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# - name: Restore ${{ needs.cargo-ndk.outputs.cache-key }} cache +# uses: actions/cache@v2.1.4 +# with: +# path: ~/.cargo/bin/cargo-ndk +# key: ${{ needs.cargo-ndk.outputs.cache-key }} + +# - name: Restore build artifacts +# uses: actions/cache@v2.1.4 +# with: +# path: ${{ github.workspace }}/target +# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + +# - name: Build Android libraries +# working-directory: ./xayn-ai-ffi +# run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build + +# build-ios-libs: +# name: build-ios-libs +# needs: [registry-cache, cargo-lipo, test] +# runs-on: macos-10.15 +# timeout-minutes: 20 +# strategy: +# matrix: +# target: [aarch64-apple-ios, x86_64-apple-ios] +# steps: +# - name: Checkout +# uses: actions/checkout@v2 + +# - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: ${{ env.RUST_STABLE }} +# target: ${{ matrix.target }} +# default: true + +# - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache +# uses: actions/cache@v2.1.4 +# with: +# path: | +# ~/.cargo/registry +# ~/.cargo/git +# key: ${{ needs.registry-cache.outputs.cache-key }} + +# - name: Restore ${{ needs.cargo-lipo.outputs.cache-key }} cache +# uses: actions/cache@v2.1.4 +# with: +# path: ~/.cargo/bin/cargo-lipo +# key: ${{ needs.cargo-lipo.outputs.cache-key }} + +# - name: Restore build artifacts +# uses: actions/cache@v2.1.4 +# with: +# path: ${{ github.workspace }}/target +# key: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + +# - name: Build iOS libraries +# working-directory: ./xayn-ai-ffi +# run: cargo lipo --targets ${{ matrix.target }} From e6ff656dab63961b3b62957d303f1dd7d737406a Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 12:41:57 +0100 Subject: [PATCH 05/28] fix --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b31ccf5b2..535776832 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,6 @@ jobs: mv cross ~/.cargo/bin/ - name: Test Android libraries - working-directory: ./xayn-ai-ffi run: cross test --target ${{ matrix.target }} From c6a94ae2c3551b8c6a29fa70ae91fdacd38e3a04 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 12:48:46 +0100 Subject: [PATCH 06/28] download model --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 535776832..2164387f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,9 @@ jobs: wget -q -O - https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - mv cross ~/.cargo/bin/ + - name: Download data + run: sh download_data.sh + - name: Test Android libraries run: cross test --target ${{ matrix.target }} From 414f3943b41d445d75288b5bff76991ecdb102b1 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 13:18:13 +0100 Subject: [PATCH 07/28] release --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2164387f1..f057f1cab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,8 +77,15 @@ jobs: - name: Download data run: sh download_data.sh + - name: Restore build artifacts + uses: actions/cache@v2.1.4 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + - name: Test Android libraries - run: cross test --target ${{ matrix.target }} + run: cross test --target ${{ matrix.target }} --release From e6a62f5ade444971b9cf7085b0806dab167642c2 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 13:31:40 +0100 Subject: [PATCH 08/28] test cache --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f057f1cab..f072b70e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,6 +85,7 @@ jobs: restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - name: Test Android libraries + # to make the tests run faster we compile them in release mode run: cross test --target ${{ matrix.target }} --release From fac950467815ad71df83ef3a4e74c9049e335fdc Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 14:02:58 +0100 Subject: [PATCH 09/28] test podman --- .github/workflows/ci.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f072b70e3..0b784416c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,15 +77,17 @@ jobs: - name: Download data run: sh download_data.sh - - name: Restore build artifacts - uses: actions/cache@v2.1.4 - with: - path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + # - name: Restore build artifacts + # uses: actions/cache@v2.1.4 + # with: + # path: ${{ github.workspace }}/target + # key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + # restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - name: Test Android libraries - # to make the tests run faster we compile them in release mode + # to make the tests run faster, we compile them in release mode + env: + CROSS_CONTAINER_ENGINE: "podman" run: cross test --target ${{ matrix.target }} --release From 715c91fecbb82ee25d7f12f39fb26a952f87603f Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 14:14:00 +0100 Subject: [PATCH 10/28] test whole ci --- .github/workflows/ci.yml | 714 +++++++++++++++++++-------------------- 1 file changed, 355 insertions(+), 359 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b784416c..e70872167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,259 @@ jobs: - name: Fetch dependencies run: cargo fetch + format: + name: cargo-fmt + needs: registry-cache + runs-on: ubuntu-20.04 + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install nightly toolchain + id: rust-toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_NIGHTLY }} + components: rustfmt + default: true + + - name: Use cached cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + # cargo fmt does not create any artifacts, therefore we don't need to cache the target folder + - name: cargo fmt + run: cargo fmt --all -- --check + + check: + name: cargo-check + needs: registry-cache + runs-on: ubuntu-20.04 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install stable toolchain + id: rust-toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + default: true + + - name: Use cached cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + - name: Cache build artifacts + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}- + + - name: cargo check + env: + RUSTFLAGS: "-D warnings" + run: | + cargo check --all-targets + cargo check --all-targets --all-features + + clippy: + name: cargo-clippy + needs: [registry-cache, check] + runs-on: ubuntu-20.04 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install stable toolchain + id: rust-toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + components: clippy + default: true + + - name: Use cached cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + - name: Cache build artifacts + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}- + + - name: cargo clippy + run: | + cargo clippy --all-targets -- --deny warnings + cargo clippy --all-targets --all-features -- --deny warnings + + test: + name: cargo-test + needs: [registry-cache, check] + runs-on: ubuntu-20.04 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install stable toolchain + id: rust-toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + default: true + + - name: Use cached cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + - name: Cache build artifacts + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}- + + # TODO: cache this as well to avoid frequent downloading + - name: Download data + run: sh download_data.sh + + - name: Run tests + env: + RUSTFLAGS: "-D warnings" + run: | + cargo test --all-targets + cargo test --all-targets --all-features + cargo test --all-features --doc + + coverage: + name: cargo-tarpaulin + needs: [registry-cache, test] + runs-on: ubuntu-20.04 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install stable toolchain + id: rust-toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_STABLE }} + profile: minimal + + - name: Use cached cargo registry + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + + - name: Cache build artifacts + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}- + + # TODO: cache this as well to avoid frequent downloading + - name: Download data + run: sh download_data.sh + + - name: Run cargo-tarpaulin + uses: actions-rs/tarpaulin@v0.1 + with: + version: '0.16.0' + args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' + + cargo-ndk: + # we use the latest stable rustc + cargo version that is already installed on the image + # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools + name: cargo-ndk + runs-on: ubuntu-20.04 + outputs: + cache-key: ${{ steps.cache-key.outputs.key }} + timeout-minutes: 15 + steps: + - name: Generate cargo-ndk cache key + id: cache-key + shell: bash + run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" + + - name: Restore ${{ steps.cache-key.outputs.key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-ndk + key: ${{ steps.cache-key.outputs.key }} + + - name: Test for cargo-ndk ${{ env.CARGO_NDK }} + id: test-bin + shell: bash + run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" + + - name: Install cargo-ndk ${{ env.CARGO_NDK }} + if: steps.test-bin.outputs.exist != '0' + run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} + + cargo-lipo: + # we use the latest stable rustc + cargo version that is already installed on the image + # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools + name: cargo-lipo + runs-on: macos-10.15 + outputs: + cache-key: ${{ steps.cache-key.outputs.key }} + timeout-minutes: 15 + steps: + - name: Generate cargo-lipo cache key + id: cache-key + shell: bash + run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-lipo-bin-${{ env.CARGO_LIPO }})" + + - name: Restore ${{ steps.cache-key.outputs.key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-lipo + key: ${{ steps.cache-key.outputs.key }} + + - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} + id: test-bin + shell: bash + run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" + + - name: Install cargo-lipo ${{ env.CARGO_LIPO }} + if: steps.test-bin.outputs.exist != '0' + run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} + test-android-libs: name: test-android-libs - needs: [registry-cache] + needs: [registry-cache, test] runs-on: ubuntu-20.04 timeout-minutes: 20 strategy: @@ -68,7 +318,7 @@ jobs: ~/.cargo/git key: ${{ needs.registry-cache.outputs.cache-key }} - - name: install Cross + - name: Install Cross shell: bash run: | wget -q -O - https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - @@ -77,366 +327,112 @@ jobs: - name: Download data run: sh download_data.sh - # - name: Restore build artifacts - # uses: actions/cache@v2.1.4 - # with: - # path: ${{ github.workspace }}/target - # key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - # restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + - name: Restore build artifacts + uses: actions/cache@v2.1.4 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - - name: Test Android libraries + - name: Test Android library ${{ matrix.target }} # to make the tests run faster, we compile them in release mode - env: - CROSS_CONTAINER_ENGINE: "podman" run: cross test --target ${{ matrix.target }} --release + build-ios-libs: + name: build-ios-libs + needs: [registry-cache, cargo-lipo, test] + runs-on: macos-10.15 + timeout-minutes: 20 + strategy: + matrix: + target: [aarch64-apple-ios, x86_64-apple-ios] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + target: ${{ matrix.target }} + default: true + + - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache + uses: actions/cache@v2.1.4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ needs.registry-cache.outputs.cache-key }} + - name: Restore ${{ needs.cargo-lipo.outputs.cache-key }} cache + uses: actions/cache@v2.1.4 + with: + path: ~/.cargo/bin/cargo-lipo + key: ${{ needs.cargo-lipo.outputs.cache-key }} -# format: -# name: cargo-fmt -# needs: registry-cache -# runs-on: ubuntu-20.04 -# timeout-minutes: 10 -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 - -# - name: Install nightly toolchain -# id: rust-toolchain -# uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: ${{ env.RUST_NIGHTLY }} -# components: rustfmt -# default: true - -# - name: Use cached cargo registry -# uses: actions/cache@v2 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# # cargo fmt does not create any artifacts, therefore we don't need to cache the target folder -# - name: cargo fmt -# run: cargo fmt --all -- --check - -# check: -# name: cargo-check -# needs: registry-cache -# runs-on: ubuntu-20.04 -# timeout-minutes: 20 -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 - -# - name: Install stable toolchain -# id: rust-toolchain -# uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: ${{ env.RUST_STABLE }} -# default: true - -# - name: Use cached cargo registry -# uses: actions/cache@v2 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# - name: Cache build artifacts -# uses: actions/cache@v2 -# with: -# path: ${{ github.workspace }}/target -# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} -# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-check-${{ needs.registry-cache.outputs.cache-date }}- - -# - name: cargo check -# env: -# RUSTFLAGS: "-D warnings" -# run: | -# cargo check --all-targets -# cargo check --all-targets --all-features - -# clippy: -# name: cargo-clippy -# needs: [registry-cache, check] -# runs-on: ubuntu-20.04 -# timeout-minutes: 20 -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 - -# - name: Install stable toolchain -# id: rust-toolchain -# uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: ${{ env.RUST_STABLE }} -# components: clippy -# default: true - -# - name: Use cached cargo registry -# uses: actions/cache@v2 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# - name: Cache build artifacts -# uses: actions/cache@v2 -# with: -# path: ${{ github.workspace }}/target -# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} -# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-clippy-${{ needs.registry-cache.outputs.cache-date }}- - -# - name: cargo clippy -# run: | -# cargo clippy --all-targets -- --deny warnings -# cargo clippy --all-targets --all-features -- --deny warnings - -# test: -# name: cargo-test -# needs: [registry-cache, check] -# runs-on: ubuntu-20.04 -# timeout-minutes: 20 -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 - -# - name: Install stable toolchain -# id: rust-toolchain -# uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: ${{ env.RUST_STABLE }} -# default: true - -# - name: Use cached cargo registry -# uses: actions/cache@v2 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# - name: Cache build artifacts -# uses: actions/cache@v2 -# with: -# path: ${{ github.workspace }}/target -# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} -# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}- - -# # TODO: cache this as well to avoid frequent downloading -# - name: Download data -# run: sh download_data.sh - -# - name: Run tests -# env: -# RUSTFLAGS: "-D warnings" -# run: | -# cargo test --all-targets -# cargo test --all-targets --all-features -# cargo test --all-features --doc - -# coverage: -# name: cargo-tarpaulin -# needs: [registry-cache, test] -# runs-on: ubuntu-20.04 -# timeout-minutes: 20 -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 - -# - name: Install stable toolchain -# id: rust-toolchain -# uses: actions-rs/toolchain@v1 -# with: -# toolchain: ${{ env.RUST_STABLE }} -# profile: minimal - -# - name: Use cached cargo registry -# uses: actions/cache@v2 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# - name: Cache build artifacts -# uses: actions/cache@v2 -# with: -# path: ${{ github.workspace }}/target -# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} -# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}- - -# # TODO: cache this as well to avoid frequent downloading -# - name: Download data -# run: sh download_data.sh - -# - name: Run cargo-tarpaulin -# uses: actions-rs/tarpaulin@v0.1 -# with: -# version: '0.16.0' -# args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' - -# cargo-ndk: -# # we use the latest stable rustc + cargo version that is already installed on the image -# # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools -# name: cargo-ndk -# runs-on: ubuntu-20.04 -# outputs: -# cache-key: ${{ steps.cache-key.outputs.key }} -# timeout-minutes: 15 -# steps: -# - name: Generate cargo-ndk cache key -# id: cache-key -# shell: bash -# run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" - -# - name: Restore ${{ steps.cache-key.outputs.key }} cache -# uses: actions/cache@v2.1.4 -# with: -# path: ~/.cargo/bin/cargo-ndk -# key: ${{ steps.cache-key.outputs.key }} - -# - name: Test for cargo-ndk ${{ env.CARGO_NDK }} -# id: test-bin -# shell: bash -# run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" - -# - name: Install cargo-ndk ${{ env.CARGO_NDK }} -# if: steps.test-bin.outputs.exist != '0' -# run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} - -# cargo-lipo: -# # we use the latest stable rustc + cargo version that is already installed on the image -# # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools -# name: cargo-lipo -# runs-on: macos-10.15 -# outputs: -# cache-key: ${{ steps.cache-key.outputs.key }} -# timeout-minutes: 15 -# steps: -# - name: Generate cargo-lipo cache key -# id: cache-key -# shell: bash -# run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-lipo-bin-${{ env.CARGO_LIPO }})" - -# - name: Restore ${{ steps.cache-key.outputs.key }} cache -# uses: actions/cache@v2.1.4 -# with: -# path: ~/.cargo/bin/cargo-lipo -# key: ${{ steps.cache-key.outputs.key }} - -# - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} -# id: test-bin -# shell: bash -# run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" - -# - name: Install cargo-lipo ${{ env.CARGO_LIPO }} -# if: steps.test-bin.outputs.exist != '0' -# run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} - -# build-android-libs: -# name: build-android-libs -# needs: [registry-cache, cargo-ndk, test] -# runs-on: ubuntu-20.04 -# timeout-minutes: 20 -# strategy: -# matrix: -# target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] -# include: -# - target: aarch64-linux-android -# ndk-target: arm64-v8a -# - target: armv7-linux-androideabi -# ndk-target: armeabi-v7a -# - target: i686-linux-android -# ndk-target: x86 -# - target: x86_64-linux-android -# ndk-target: x86_64 -# steps: -# - name: Checkout -# uses: actions/checkout@v2 - -# - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} -# uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: ${{ env.RUST_STABLE }} -# target: ${{ matrix.target }} -# default: true - -# - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache -# uses: actions/cache@v2.1.4 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# - name: Restore ${{ needs.cargo-ndk.outputs.cache-key }} cache -# uses: actions/cache@v2.1.4 -# with: -# path: ~/.cargo/bin/cargo-ndk -# key: ${{ needs.cargo-ndk.outputs.cache-key }} - -# - name: Restore build artifacts -# uses: actions/cache@v2.1.4 -# with: -# path: ${{ github.workspace }}/target -# key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} -# restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - -# - name: Build Android libraries -# working-directory: ./xayn-ai-ffi -# run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build - -# build-ios-libs: -# name: build-ios-libs -# needs: [registry-cache, cargo-lipo, test] -# runs-on: macos-10.15 -# timeout-minutes: 20 -# strategy: -# matrix: -# target: [aarch64-apple-ios, x86_64-apple-ios] -# steps: -# - name: Checkout -# uses: actions/checkout@v2 - -# - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} -# uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: ${{ env.RUST_STABLE }} -# target: ${{ matrix.target }} -# default: true - -# - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache -# uses: actions/cache@v2.1.4 -# with: -# path: | -# ~/.cargo/registry -# ~/.cargo/git -# key: ${{ needs.registry-cache.outputs.cache-key }} - -# - name: Restore ${{ needs.cargo-lipo.outputs.cache-key }} cache -# uses: actions/cache@v2.1.4 -# with: -# path: ~/.cargo/bin/cargo-lipo -# key: ${{ needs.cargo-lipo.outputs.cache-key }} - -# - name: Restore build artifacts -# uses: actions/cache@v2.1.4 -# with: -# path: ${{ github.workspace }}/target -# key: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} -# restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - -# - name: Build iOS libraries -# working-directory: ./xayn-ai-ffi -# run: cargo lipo --targets ${{ matrix.target }} + - name: Restore build artifacts + uses: actions/cache@v2.1.4 + with: + path: ${{ github.workspace }}/target + key: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + + - name: Build iOS library ${{ matrix.target }} + working-directory: ./xayn-ai-ffi + run: cargo lipo --targets ${{ matrix.target }} + + # build-android-libs: + # name: build-android-libs + # needs: [registry-cache, cargo-ndk, test-android-libs] + # runs-on: ubuntu-20.04 + # timeout-minutes: 20 + # strategy: + # matrix: + # target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] + # include: + # - target: aarch64-linux-android + # ndk-target: arm64-v8a + # - target: armv7-linux-androideabi + # ndk-target: armeabi-v7a + # - target: i686-linux-android + # ndk-target: x86 + # - target: x86_64-linux-android + # ndk-target: x86_64 + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + + # - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} + # uses: actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: ${{ env.RUST_STABLE }} + # target: ${{ matrix.target }} + # default: true + + # - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache + # uses: actions/cache@v2.1.4 + # with: + # path: | + # ~/.cargo/registry + # ~/.cargo/git + # key: ${{ needs.registry-cache.outputs.cache-key }} + + # - name: Restore ${{ needs.cargo-ndk.outputs.cache-key }} cache + # uses: actions/cache@v2.1.4 + # with: + # path: ~/.cargo/bin/cargo-ndk + # key: ${{ needs.cargo-ndk.outputs.cache-key }} + + # - name: Restore build artifacts + # uses: actions/cache@v2.1.4 + # with: + # path: ${{ github.workspace }}/target + # key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + # restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + + # - name: Build Android library ${{ matrix.target }} + # working-directory: ./xayn-ai-ffi + # run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build --release From 807dd2598a8f30a0f53da2d7f7fb6db3458a760c Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 15:00:05 +0100 Subject: [PATCH 11/28] set fail-fast to false --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e70872167..5ec714aaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -304,6 +304,7 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 20 strategy: + fail-fast: false matrix: target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] steps: @@ -344,6 +345,7 @@ jobs: runs-on: macos-10.15 timeout-minutes: 20 strategy: + fail-fast: false matrix: target: [aarch64-apple-ios, x86_64-apple-ios] steps: From 974e8d9da650f6426a9fc52ebf6efeeb6e70d849 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 16:29:58 +0100 Subject: [PATCH 12/28] install right toolchain --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ec714aaa..a0ab43dce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install nightly toolchain + - name: Install ${{ env.RUST_NIGHTLY }} toolchain id: rust-toolchain uses: actions-rs/toolchain@v1 with: @@ -87,7 +87,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install ${{ env.RUST_STABLE }} toolchain id: rust-toolchain uses: actions-rs/toolchain@v1 with: @@ -126,7 +126,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install ${{ env.RUST_STABLE }} toolchain id: rust-toolchain uses: actions-rs/toolchain@v1 with: @@ -164,7 +164,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install ${{ env.RUST_STABLE }} toolchain id: rust-toolchain uses: actions-rs/toolchain@v1 with: @@ -208,7 +208,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install stable toolchain + - name: Install ${{ env.RUST_STABLE }} toolchain id: rust-toolchain uses: actions-rs/toolchain@v1 with: @@ -240,35 +240,6 @@ jobs: version: '0.16.0' args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' - cargo-ndk: - # we use the latest stable rustc + cargo version that is already installed on the image - # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools - name: cargo-ndk - runs-on: ubuntu-20.04 - outputs: - cache-key: ${{ steps.cache-key.outputs.key }} - timeout-minutes: 15 - steps: - - name: Generate cargo-ndk cache key - id: cache-key - shell: bash - run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" - - - name: Restore ${{ steps.cache-key.outputs.key }} cache - uses: actions/cache@v2.1.4 - with: - path: ~/.cargo/bin/cargo-ndk - key: ${{ steps.cache-key.outputs.key }} - - - name: Test for cargo-ndk ${{ env.CARGO_NDK }} - id: test-bin - shell: bash - run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" - - - name: Install cargo-ndk ${{ env.CARGO_NDK }} - if: steps.test-bin.outputs.exist != '0' - run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} - cargo-lipo: # we use the latest stable rustc + cargo version that is already installed on the image # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools @@ -311,6 +282,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install ${{ env.RUST_STABLE }} toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.RUST_STABLE }} + default: true + - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache uses: actions/cache@v2.1.4 with: @@ -385,6 +363,35 @@ jobs: working-directory: ./xayn-ai-ffi run: cargo lipo --targets ${{ matrix.target }} + # cargo-ndk: + # # we use the latest stable rustc + cargo version that is already installed on the image + # # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools + # name: cargo-ndk + # runs-on: ubuntu-20.04 + # outputs: + # cache-key: ${{ steps.cache-key.outputs.key }} + # timeout-minutes: 15 + # steps: + # - name: Generate cargo-ndk cache key + # id: cache-key + # shell: bash + # run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" + + # - name: Restore ${{ steps.cache-key.outputs.key }} cache + # uses: actions/cache@v2.1.4 + # with: + # path: ~/.cargo/bin/cargo-ndk + # key: ${{ steps.cache-key.outputs.key }} + + # - name: Test for cargo-ndk ${{ env.CARGO_NDK }} + # id: test-bin + # shell: bash + # run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" + + # - name: Install cargo-ndk ${{ env.CARGO_NDK }} + # if: steps.test-bin.outputs.exist != '0' + # run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} + # build-android-libs: # name: build-android-libs # needs: [registry-cache, cargo-ndk, test-android-libs] From cea5fa755aab00dafd1934c81d12151acf9d3bb7 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 17 Mar 2021 17:06:18 +0100 Subject: [PATCH 13/28] fix cache key [skip ci] --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0ab43dce..d8a587b5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -283,6 +283,7 @@ jobs: uses: actions/checkout@v2 - name: Install ${{ env.RUST_STABLE }} toolchain + id: rust-toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -331,6 +332,7 @@ jobs: uses: actions/checkout@v2 - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} + id: rust-toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -356,8 +358,8 @@ jobs: uses: actions/cache@v2.1.4 with: path: ${{ github.workspace }}/target - key: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_STABLE }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - name: Build iOS library ${{ matrix.target }} working-directory: ./xayn-ai-ffi @@ -414,6 +416,7 @@ jobs: # uses: actions/checkout@v2 # - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} + # id: rust-toolchain # uses: actions-rs/toolchain@v1 # with: # profile: minimal From 173157febf6b7c15f37080978ecff391c8409987 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Thu, 18 Mar 2021 12:09:59 +0100 Subject: [PATCH 14/28] rename cargo lipo job [skip ci] --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8a587b5b..3eab67101 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,10 +240,10 @@ jobs: version: '0.16.0' args: '-v --all-features --force-clean --lib --ignore-tests --fail-under 70' - cargo-lipo: + install-cargo-lipo: # we use the latest stable rustc + cargo version that is already installed on the image # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#rust-tools - name: cargo-lipo + name: install-cargo-lipo runs-on: macos-10.15 outputs: cache-key: ${{ steps.cache-key.outputs.key }} @@ -320,7 +320,7 @@ jobs: build-ios-libs: name: build-ios-libs - needs: [registry-cache, cargo-lipo, test] + needs: [registry-cache, install-cargo-lipo, test] runs-on: macos-10.15 timeout-minutes: 20 strategy: From 239afbe98672bebf28d4f5ddfb6168ee2d9f6a5f Mon Sep 17 00:00:00 2001 From: Jan Petsche <58227040+janpetschexain@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:29:18 +0100 Subject: [PATCH 15/28] update ci working dir of xayn ai ffi [skip ci] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3eab67101..bd2b9394f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -362,7 +362,7 @@ jobs: restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - name: Build iOS library ${{ matrix.target }} - working-directory: ./xayn-ai-ffi + working-directory: ./xayn-ai-ffi-c run: cargo lipo --targets ${{ matrix.target }} # cargo-ndk: @@ -446,5 +446,5 @@ jobs: # restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- # - name: Build Android library ${{ matrix.target }} - # working-directory: ./xayn-ai-ffi + # working-directory: ./xayn-ai-ffi-c # run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build --release From 84e55679112fb4fe0e6e72787bf5fbec4fd5bcb9 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 19 Mar 2021 16:26:00 +0100 Subject: [PATCH 16/28] add rust flags --- .github/workflows/ci.yml | 7 +++++-- Cross.toml | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Cross.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd2b9394f..b938d3927 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -261,6 +261,8 @@ jobs: key: ${{ steps.cache-key.outputs.key }} - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} + # we could also run `cargo install lipo || true` but in that case + # cargo fetches the index first which takes ~30sec longer id: test-bin shell: bash run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" @@ -315,8 +317,9 @@ jobs: restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-test-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - name: Test Android library ${{ matrix.target }} - # to make the tests run faster, we compile them in release mode - run: cross test --target ${{ matrix.target }} --release + env: + RUSTFLAGS: "-C opt-level=3 -C debug-assertions=yes" + run: cross test --target ${{ matrix.target }} build-ios-libs: name: build-ios-libs diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 000000000..c0de25c91 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,2 @@ +[build.env] +passthrough = ["RUSTFLAGS"] \ No newline at end of file From 9a1ee1ecc1ee339f49db4475989200f22e8e7062 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 19 Mar 2021 17:14:09 +0100 Subject: [PATCH 17/28] install target --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b938d3927..85dda0a2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -290,6 +290,7 @@ jobs: with: profile: minimal toolchain: ${{ env.RUST_STABLE }} + target: ${{ matrix.target }} default: true - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache @@ -351,11 +352,11 @@ jobs: ~/.cargo/git key: ${{ needs.registry-cache.outputs.cache-key }} - - name: Restore ${{ needs.cargo-lipo.outputs.cache-key }} cache + - name: Restore ${{ needs.install-cargo-lipo.outputs.cache-key }} cache uses: actions/cache@v2.1.4 with: path: ~/.cargo/bin/cargo-lipo - key: ${{ needs.cargo-lipo.outputs.cache-key }} + key: ${{ needs.install-cargo-lipo.outputs.cache-key }} - name: Restore build artifacts uses: actions/cache@v2.1.4 From a5ad5a02e1cb91588d62345dfdfd2d2b4baedd75 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 19 Mar 2021 17:34:28 +0100 Subject: [PATCH 18/28] use env.RUST_STABLE version [skip ci] --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85dda0a2d..5a931e357 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -214,6 +214,7 @@ jobs: with: toolchain: ${{ env.RUST_STABLE }} profile: minimal + default: true - name: Use cached cargo registry uses: actions/cache@v2 From f3f298b0eabe7ba874dbdb7dee295c07bde92fdc Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 19 Mar 2021 17:42:00 +0100 Subject: [PATCH 19/28] enable deny on warnings [skip ci] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a931e357..9e6fbadd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -320,8 +320,8 @@ jobs: - name: Test Android library ${{ matrix.target }} env: - RUSTFLAGS: "-C opt-level=3 -C debug-assertions=yes" - run: cross test --target ${{ matrix.target }} + RUSTFLAGS: "-C opt-level=3 -C debug-assertions=yes -D warnings" + run: cross test --target ${{ matrix.target }} --all-targets build-ios-libs: name: build-ios-libs From 930a5bddedaba12e0f1c95cfc17863349e72f4fd Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 19 Mar 2021 17:46:26 +0100 Subject: [PATCH 20/28] remove ndk related code [skip ci] --- .github/workflows/ci.yml | 84 ---------------------------------------- 1 file changed, 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e6fbadd8..5d1719db1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -369,87 +369,3 @@ jobs: - name: Build iOS library ${{ matrix.target }} working-directory: ./xayn-ai-ffi-c run: cargo lipo --targets ${{ matrix.target }} - - # cargo-ndk: - # # we use the latest stable rustc + cargo version that is already installed on the image - # # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#rust-tools - # name: cargo-ndk - # runs-on: ubuntu-20.04 - # outputs: - # cache-key: ${{ steps.cache-key.outputs.key }} - # timeout-minutes: 15 - # steps: - # - name: Generate cargo-ndk cache key - # id: cache-key - # shell: bash - # run: echo "::set-output name=key::$(echo ${{ runner.os }}-cargo-ndk-bin-${{ env.CARGO_NDK }})" - - # - name: Restore ${{ steps.cache-key.outputs.key }} cache - # uses: actions/cache@v2.1.4 - # with: - # path: ~/.cargo/bin/cargo-ndk - # key: ${{ steps.cache-key.outputs.key }} - - # - name: Test for cargo-ndk ${{ env.CARGO_NDK }} - # id: test-bin - # shell: bash - # run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-ndk && echo $?)" - - # - name: Install cargo-ndk ${{ env.CARGO_NDK }} - # if: steps.test-bin.outputs.exist != '0' - # run: cargo install cargo-ndk --version ${{ env.CARGO_NDK }} - - # build-android-libs: - # name: build-android-libs - # needs: [registry-cache, cargo-ndk, test-android-libs] - # runs-on: ubuntu-20.04 - # timeout-minutes: 20 - # strategy: - # matrix: - # target: [aarch64-linux-android, armv7-linux-androideabi, i686-linux-android, x86_64-linux-android] - # include: - # - target: aarch64-linux-android - # ndk-target: arm64-v8a - # - target: armv7-linux-androideabi - # ndk-target: armeabi-v7a - # - target: i686-linux-android - # ndk-target: x86 - # - target: x86_64-linux-android - # ndk-target: x86_64 - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - - # - name: Install ${{ env.RUST_STABLE }} toolchain with target ${{ matrix.target }} - # id: rust-toolchain - # uses: actions-rs/toolchain@v1 - # with: - # profile: minimal - # toolchain: ${{ env.RUST_STABLE }} - # target: ${{ matrix.target }} - # default: true - - # - name: Restore ${{ needs.registry-cache.outputs.cache-key }} cache - # uses: actions/cache@v2.1.4 - # with: - # path: | - # ~/.cargo/registry - # ~/.cargo/git - # key: ${{ needs.registry-cache.outputs.cache-key }} - - # - name: Restore ${{ needs.cargo-ndk.outputs.cache-key }} cache - # uses: actions/cache@v2.1.4 - # with: - # path: ~/.cargo/bin/cargo-ndk - # key: ${{ needs.cargo-ndk.outputs.cache-key }} - - # - name: Restore build artifacts - # uses: actions/cache@v2.1.4 - # with: - # path: ${{ github.workspace }}/target - # key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} - # restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-${{ matrix.target }}-${{ needs.registry-cache.outputs.cache-date }}- - - # - name: Build Android library ${{ matrix.target }} - # working-directory: ./xayn-ai-ffi-c - # run: cargo ndk -t ${{ matrix.ndk-target }} --platform ${{ env.ANDROID_PLATFORM_VERSION }} build --release From 31eb2b0ed221ccd27a5184f98126dcb74691a4ff Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 19 Mar 2021 18:11:36 +0100 Subject: [PATCH 21/28] print test execution time [skip ci] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d1719db1..a5ce4fa2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -321,7 +321,7 @@ jobs: - name: Test Android library ${{ matrix.target }} env: RUSTFLAGS: "-C opt-level=3 -C debug-assertions=yes -D warnings" - run: cross test --target ${{ matrix.target }} --all-targets + run: cross test --target ${{ matrix.target }} --all-targets -- -Z unstable-options --report-time build-ios-libs: name: build-ios-libs From cc911bd0ba31884779bfa1445d30493cd56316ba Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Fri, 26 Mar 2021 13:29:14 +0100 Subject: [PATCH 22/28] simplify cargo lipo install --- .github/workflows/ci.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5ce4fa2c..cc4313fe4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -257,19 +257,13 @@ jobs: - name: Restore ${{ steps.cache-key.outputs.key }} cache uses: actions/cache@v2.1.4 + id: cargo-lipo-cache with: path: ~/.cargo/bin/cargo-lipo key: ${{ steps.cache-key.outputs.key }} - - name: Test for cargo-lipo ${{ env.CARGO_LIPO }} - # we could also run `cargo install lipo || true` but in that case - # cargo fetches the index first which takes ~30sec longer - id: test-bin - shell: bash - run: echo "::set-output name=exist::$(test -e ~/.cargo/bin/cargo-lipo && echo $?)" - - name: Install cargo-lipo ${{ env.CARGO_LIPO }} - if: steps.test-bin.outputs.exist != '0' + if: steps.cargo-lipo-cache.outputs.cache-hit != 'true' run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} test-android-libs: From 262dd27faedc839644e1919ff1e36f1cb67b2d54 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 31 Mar 2021 16:44:06 +0200 Subject: [PATCH 23/28] link pr link to ci file [skip ci] --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc4313fe4..f550a522a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,6 @@ +# You can find more information about the design decisions here: +# https://github.com/xaynetwork/xayn_ai/pull/21 + name: Rust-CI on: From c4f5ac07b20520ed6e2d5045599ccf2873e6f486 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 7 Apr 2021 17:07:21 +0200 Subject: [PATCH 24/28] add nl --- Cross.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cross.toml b/Cross.toml index c0de25c91..1a4557b51 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,2 +1,2 @@ [build.env] -passthrough = ["RUSTFLAGS"] \ No newline at end of file +passthrough = ["RUSTFLAGS"] From 307cba35072cc4930dad61ba528bae4a38423195 Mon Sep 17 00:00:00 2001 From: Robert Steiner Date: Wed, 7 Apr 2021 18:39:01 +0200 Subject: [PATCH 25/28] Update .github/workflows/ci.yml [skip ci] Co-authored-by: janpetschexain <58227040+janpetschexain@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f550a522a..6b6e31460 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -266,7 +266,7 @@ jobs: key: ${{ steps.cache-key.outputs.key }} - name: Install cargo-lipo ${{ env.CARGO_LIPO }} - if: steps.cargo-lipo-cache.outputs.cache-hit != 'true' + if: ${{ !steps.cargo-lipo-cache.outputs.cache-hit }} run: cargo install cargo-lipo --version ${{ env.CARGO_LIPO }} test-android-libs: From 7d114539b647122678941a135dceac9e84810d10 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Wed, 7 Apr 2021 18:41:22 +0200 Subject: [PATCH 26/28] remove todos --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b6e31460..8880fa815 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,7 +190,6 @@ jobs: key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}- - # TODO: cache this as well to avoid frequent downloading - name: Download data run: sh download_data.sh @@ -234,7 +233,6 @@ jobs: key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tarpaulin-${{ needs.registry-cache.outputs.cache-date }}- - # TODO: cache this as well to avoid frequent downloading - name: Download data run: sh download_data.sh From a98fc0048e00fa33cfd3fd77e67d3bff35b93dbf Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Thu, 8 Apr 2021 13:57:17 +0200 Subject: [PATCH 27/28] checksum binary --- .github/workflows/audit.yml | 2 +- .github/workflows/ci.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 8d5282321..889f8d3dd 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -7,7 +7,7 @@ on: jobs: audit: name: Rust Audit - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8880fa815..219c7a054 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,8 @@ env: CARGO_NDK: 2.2.0 ANDROID_PLATFORM_VERSION: 21 CARGO_LIPO: 3.1.1 + # cmd: shasum -a 256 cross + CROSS_CHECKSUM: 18a3599273773a7d1e333b413751f0adc1a83ec8045d060fee4f0639bd6baaf0 jobs: registry-cache: @@ -301,6 +303,7 @@ jobs: shell: bash run: | wget -q -O - https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - + echo "$ {{ env.CROSS_CHECKSUM }} *cross" | shasum -c - mv cross ~/.cargo/bin/ - name: Download data From edd2e49a23a97674b28d154a61e5eb2b0f144ce3 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Thu, 8 Apr 2021 14:05:25 +0200 Subject: [PATCH 28/28] fmt --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 219c7a054..8080b611a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -303,7 +303,7 @@ jobs: shell: bash run: | wget -q -O - https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - - echo "$ {{ env.CROSS_CHECKSUM }} *cross" | shasum -c - + echo "${{ env.CROSS_CHECKSUM }} *cross" | shasum -c - mv cross ~/.cargo/bin/ - name: Download data