Simplify API with packed pointer return from apply_json_logic #4
This file contains hidden or 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: "Continuous Integration" | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| test: | |
| name: "Test" | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: "${{ matrix.os }}" | |
| steps: | |
| - uses: "actions/checkout@v4" | |
| # Set the current month and year (used for cache key) | |
| - name: "Get Date" | |
| id: get-date | |
| run: | | |
| echo "date=$(/bin/date -u '+%Y%m')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| # Generate the lockfile | |
| - name: "Generate Cargo Lockfile" | |
| run: "cargo generate-lockfile" | |
| # Cache build dependencies | |
| - name: "Cache Build Fragments" | |
| id: "cache-build-fragments" | |
| uses: "actions/cache@v4" | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| # Cache `cargo install` built binaries | |
| - name: "Cache Built Binaries" | |
| id: "cache-binaries" | |
| uses: "actions/cache@v4" | |
| with: | |
| path: "~/.cargo/bin" | |
| key: "${{ runner.os }}-cargo-binaries-${{steps.get-date.outputs.date}}" | |
| - name: "Run Tests" | |
| shell: bash | |
| run: "cargo test" | |
| build: | |
| name: "Build Libs and WASM" | |
| needs: "test" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: "actions/checkout@v4" | |
| # Set the current month and year (used for cache key) | |
| - name: "Get Date" | |
| id: get-date | |
| run: | | |
| echo "date=$(/bin/date -u '+%Y%m')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| # Generate the lockfile | |
| - name: "Generate Cargo Lockfile" | |
| run: "cargo generate-lockfile" | |
| # Cache build dependencies | |
| - name: "Cache Build Fragments" | |
| id: "cache-build-fragments" | |
| uses: "actions/cache@v4" | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| # Cache `cargo install` built binaries | |
| - name: "Cache Built Binaries" | |
| id: "cache-binaries" | |
| uses: "actions/cache@v4" | |
| with: | |
| path: "~/.cargo/bin" | |
| key: "${{ runner.os }}-cargo-binaries-${{steps.get-date.outputs.date}}" | |
| - name: "Build Rust/C Libraries" | |
| run: cargo build --release | |
| - name: "Check Rust target content" | |
| run: ls target/release | |
| - uses: actions/upload-artifact@v4 | |
| name: "Upload Rust/C Libraries" | |
| with: | |
| path: target/release/libjsonlogic_rs.* | |
| name: libs | |
| # Build C FFI WASM modules (for Java/Chicory, Go, .NET, Python) | |
| - name: "Install WASM targets" | |
| run: | | |
| rustup target add wasm32-unknown-unknown | |
| rustup target add wasm32-wasip1 | |
| - name: "Build WASM (wasm32-unknown-unknown)" | |
| run: cargo build --target wasm32-unknown-unknown --release | |
| - name: "Build WASM (wasm32-wasip1)" | |
| run: cargo build --target wasm32-wasip1 --release | |
| - name: "Check WASM artifacts" | |
| run: | | |
| ls -la target/wasm32-unknown-unknown/release/*.wasm | |
| ls -la target/wasm32-wasip1/release/*.wasm | |
| - uses: actions/upload-artifact@v4 | |
| name: "Upload WASM (wasm32-unknown-unknown)" | |
| with: | |
| path: target/wasm32-unknown-unknown/release/jsonlogic_rs.wasm | |
| name: wasm-unknown-unknown | |
| - uses: actions/upload-artifact@v4 | |
| name: "Upload WASM (wasm32-wasip1)" | |
| with: | |
| path: target/wasm32-wasip1/release/jsonlogic_rs.wasm | |
| name: wasm-wasip1 | |
| distribute: | |
| name: "Distribute Cargo Package" | |
| needs: ["build"] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: "actions/checkout@v4" | |
| # Generate the lockfile | |
| - name: "Generate Cargo Lockfile" | |
| run: "cargo generate-lockfile" | |
| - name: "Get Current Version" | |
| id: get-version | |
| shell: bash | |
| run: | | |
| echo "version=$(cargo pkgid | tr '#' '\n' | tail -n 1 | tr ':' ' ' | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| - name: "(DEBUG) log current version" | |
| shell: bash | |
| run: | | |
| echo "${{ steps.get-version.outputs.version }}" | |
| - name: "Check if new Cargo version" | |
| id: cargo-version | |
| shell: bash | |
| run: | | |
| echo "new=$(./scripts/newCargoVersion.sh)" >> $GITHUB_OUTPUT | |
| - name: "(DEBUG) new versions" | |
| shell: bash | |
| run: | | |
| echo "Cargo: ${{ steps.cargo-version.outputs.new }}" | |
| - name: "Cargo Publish" | |
| if: "${{ steps.cargo-version.outputs.new == 'true' }}" | |
| run: | | |
| cargo publish --token "$CARGO_TOKEN" | |
| env: | |
| CARGO_TOKEN: "${{ secrets.CARGO_TOKEN }}" |