Type level is_authorized guarding #143
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 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 }} | |
run_example_use_cases: | |
name: example-use-cases | |
runs-on: ubuntu-latest | |
needs: get-branch-name | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
steps: | |
- name: Checkout Cedar Examples | |
uses: actions/checkout@v3 | |
- name: Checkout cedar | |
uses: actions/checkout@v3 | |
with: | |
repository: cedar-policy/cedar | |
ref: ${{ needs.get-branch-name.outputs.branch_name }} | |
path: ./cedar | |
- name: rustup | |
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- name: build cli | |
working-directory: ./cedar | |
run: cargo build --bin cedar | |
- name: run validation and authorization | |
working-directory: ./cedar-example-use-cases | |
run: | | |
export PATH="$PWD/../cedar/target/debug/":$PATH | |
echo $PATH | |
./run.sh | |
- name: run validation and authorization for cedar-policy-language-in-action | |
working-directory: ./cedar-policy-language-in-action | |
run: | | |
export PATH="$PWD/../cedar/target/debug/":$PATH | |
echo $PATH | |
./run.sh | |
build_and_test_rust_hello_world: | |
name: rust-hello-world | |
runs-on: ubuntu-latest | |
needs: get-branch-name | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
steps: | |
- name: Checkout Cedar Examples | |
uses: actions/checkout@v3 | |
- name: Checkout cedar | |
uses: actions/checkout@v3 | |
with: | |
repository: cedar-policy/cedar | |
ref: ${{ needs.get-branch-name.outputs.branch_name }} | |
path: ./cedar | |
- name: rustup | |
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- name: cargo fmt | |
working-directory: ./cedar-rust-hello-world | |
run: cargo fmt --all --check | |
- name: cargo rustc | |
working-directory: ./cedar-rust-hello-world | |
run: | | |
printf "\npath = \"../cedar/cedar-policy\"" >> Cargo.toml | |
RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose | |
- name: cargo test | |
working-directory: ./cedar-rust-hello-world | |
run: cargo test --verbose | |
- name: cargo run | |
working-directory: ./cedar-rust-hello-world | |
run: cargo run --verbose | |
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 | |
build_and_test_tiny_todo: | |
name: tinytodo | |
runs-on: ubuntu-latest | |
needs: get-branch-name | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
steps: | |
- name: Checkout Cedar Examples | |
uses: actions/checkout@v3 | |
- name: Checkout cedar | |
uses: actions/checkout@v3 | |
with: | |
repository: cedar-policy/cedar | |
ref: ${{ needs.get-branch-name.outputs.branch_name }} | |
path: ./cedar | |
- name: rustup | |
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- name: cargo fmt | |
working-directory: ./tinytodo | |
run: cargo fmt --all --check | |
- name: cargo rustc | |
working-directory: ./tinytodo | |
run: | | |
printf "\npath = \"../cedar/cedar-policy\"" >> Cargo.toml | |
RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose | |
- name: cargo test | |
working-directory: ./tinytodo | |
run: cargo test --verbose |