Skip to content

Cherry-pick #105

Cherry-pick #105 #251

Workflow file for this run

name: Cargo Build & Test
on:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
get-branch-name:
runs-on: ubuntu-latest
steps:
- name: Get branch name
shell: bash
# The workflow is triggered by pull_request so we use `GITHUB_BASE_REF`
run: echo "branch_name=${GITHUB_BASE_REF}" >> $GITHUB_OUTPUT
id: get_branch_name
outputs:
branch_name: ${{ steps.get_branch_name.outputs.branch_name }}
build_and_test_java_hello_world:
name: java-hello-world
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Checkout Cedar Examples
uses: actions/checkout@v3
- name: Checkout cedar-java
uses: actions/checkout@v3
with:
repository: cedar-policy/cedar-java
ref: release/2.3.x # Java example currently only builds for 2.3.3
path: ./cedar-java-hello-world/cedar-java
- name: rustup
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: cargo build CedarJavaFFI
working-directory: ./cedar-java-hello-world/cedar-java/CedarJavaFFI
run: cargo build
- name: Build cedar-java-hello-world
working-directory: ./cedar-java-hello-world
run: bash config.sh && ./gradlew build
- name: Run cedar-java-hello-world
working-directory: ./cedar-java-hello-world
run: ./gradlew test
run_example_use_cases:
name: run_example_use_cases
needs: get-branch-name
uses: ./.github/workflows/run_example_use_cases_reusable.yml
with:
cedar_policy_ref: "refs/heads/main" # use the latest commit on main
cedar_examples_ref: "${{ github.head_ref }}" # use the current PR's commit
build_rust_hello_world:
name: rust_hello_world
needs: get-branch-name
uses: ./.github/workflows/build_rust_hello_world_reusable.yml
with:
cedar_policy_ref: "refs/heads/main" # use the latest commit on main
cedar_examples_ref: "${{ github.head_ref }}" # use the current PR's commit
build_tiny_todo:
name: tinytodo
needs: get-branch-name
uses: ./.github/workflows/build_tiny_todo_reusable.yml
with:
cedar_policy_ref: "refs/heads/main" # use the latest commit on main
cedar_examples_ref: "${{ github.head_ref }}" # use the current PR's commit