Cis2 #1006
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow triggered by pushes to the master branch and PRs targeting it | |
# (as long as the commits contain code changes). | |
# | |
# Jobs: | |
# - build-test: Build and test both the Java and Rust sources. | |
# The job is skipped if the workflow was triggered by a PR | |
# marked as a draft. | |
# | |
# The steps in 'build-test' are ordered to fail as fast as possible | |
# and restore caches as late as possible. | |
# The dependencies between the steps are described in inline comments below | |
# along with a few suggestions for improving parallelization. | |
name: Build and test | |
on: | |
push: | |
branches: main | |
paths: | |
- '.github/workflows/build-test.yaml' | |
- '**/Cargo.toml' | |
- '**.rs' | |
- '**.yaml' | |
- '**/pom.xml' | |
- '**.java' | |
- 'concordium-sdk' | |
- 'crypto-jni' | |
pull_request: | |
branches: main | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths: | |
- '.github/workflows/build-test.yaml' | |
- '**/Cargo.toml' | |
- '**.rs' | |
- '**.yaml' | |
- '**/pom.xml' | |
- '**.java' | |
- 'concordium-sdk' | |
- 'crypto-jni' | |
workflow_dispatch: # allow manual trigger | |
env: | |
dummy: 2 # change to force cache invalidation | |
CARGO_TERM_COLOR: always # implicitly adds '--color=always' to all cargo commands | |
jobs: | |
build: | |
# Use fixed OS version because we install packages on the system. | |
runs-on: ubuntu-20.04 | |
if: ${{ !github.event.pull_request.draft }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
#token: ${{ secrets.CONCORDIUM_CI }} | |
submodules: recursive | |
- name: Setup JDK 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 8 | |
distribution: 'adopt' | |
cache: maven | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.69 | |
- name: Create native dependencies | |
run: make | |
- name: Cache cargo dependencies and targets | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
crypto-jni/target | |
~/.m2 | |
key: ${{ runner.os }}-${{ env.dummy }}-rust-java-deps-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock', '**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.dummy }}-rust-java-deps | |
- name: Initialize Parent Pom | |
run: mvn install -N | |
- name: Build and test sdk | |
run: cd concordium-sdk && mvn --batch-mode --update-snapshots install | |
- name: Build and test examples | |
run: cd concordium-sdk-examples && mvn --batch-mode --update-snapshots install | |
build-android: | |
# Use fixed OS version because we install packages on the system. | |
runs-on: ubuntu-22.04 | |
if: ${{ !github.event.pull_request.draft }} | |
steps: | |
- name: Set Up Android tools | |
run: | | |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager \ | |
--sdk_root=$ANDROID_SDK_ROOT \ | |
"platform-tools" "platforms;android-27" "build-tools;27.0.3" | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Setup JDK 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 8 | |
distribution: 'adopt' | |
cache: maven | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.69 | |
- name: Create native dependencies | |
run: make add-android-targets && make android | |
- name: Initialize root project | |
run: mvn install -N | |
- name: Build android sdk | |
run: cd concordium-android-sdk && mvn --batch-mode --update-snapshots install |