refactor(PR 14): cleanup ffi, finalize public apis, rewrite documentation and readme, bump deps and version #1947
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
| on: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - "**.md" | |
| - "!.github/workflows/*.yml" | |
| - "!rln-wasm/**" | |
| - "!rln/src/**" | |
| - "!rln/resources/**" | |
| - "!utils/src/**" | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review, labeled] | |
| paths-ignore: | |
| - "**.md" | |
| - "!.github/workflows/*.yml" | |
| - "!rln-wasm/**" | |
| - "!rln/src/**" | |
| - "!rln/resources/**" | |
| - "!utils/src/**" | |
| name: CI | |
| jobs: | |
| test: | |
| name: Test - ${{ matrix.crate }} - ${{ matrix.platform }} | |
| # skip tests on draft PRs | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) | |
| strategy: | |
| matrix: | |
| platform: [ubuntu-latest, macos-latest] | |
| crate: [utils, rln] | |
| runs-on: ${{ matrix.platform }} | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install dependencies | |
| run: make installdeps | |
| - name: Test ${{ matrix.crate }} | |
| run: cargo make test --release | |
| working-directory: ${{ matrix.crate }} | |
| rln-wasm-test: | |
| name: Test - rln-wasm - ${{ matrix.platform }} | |
| # skip tests on draft PRs | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) | |
| strategy: | |
| matrix: | |
| platform: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.platform }} | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install dependencies | |
| run: make installdeps | |
| - name: Build rln-wasm | |
| run: cargo make build | |
| working-directory: rln-wasm | |
| - name: Test rln-wasm on node | |
| run: cargo make test --release | |
| working-directory: rln-wasm | |
| - name: Test rln-wasm on browser | |
| run: cargo make test_browser --release | |
| working-directory: rln-wasm | |
| rln-wasm-parallel-test: | |
| name: Test - rln-wasm-parallel - ${{ matrix.platform }} | |
| # skip tests on draft PRs | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) | |
| strategy: | |
| matrix: | |
| platform: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.platform }} | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rust-src | |
| targets: wasm32-unknown-unknown | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install dependencies | |
| run: make installdeps | |
| - name: Build rln-wasm in parallel mode | |
| run: cargo make build_parallel | |
| working-directory: rln-wasm | |
| - name: Test rln-wasm in parallel mode on browser | |
| run: cargo make test_parallel --release | |
| working-directory: rln-wasm | |
| fmt: | |
| name: Format | |
| # skip on draft PRs | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) | |
| # run fmt tests only on ubuntu | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install nightly toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rustfmt | |
| - name: Install cargo-make | |
| run: cargo install cargo-make | |
| - name: Check formatting | |
| run: cargo make fmt_check | |
| clippy: | |
| name: Clippy - ${{ matrix.crate }} | |
| # skip on draft PRs | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) | |
| strategy: | |
| matrix: | |
| # run clippy only on ubuntu | |
| crate: [rln, rln-wasm, utils] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Install wasm32 target | |
| if: matrix.crate == 'rln-wasm' | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install dependencies | |
| run: make installdeps | |
| - name: Check clippy wasm target | |
| if: matrix.crate == 'rln-wasm' | |
| run: cargo clippy --target wasm32-unknown-unknown --tests --release -- -D warnings | |
| working-directory: ${{ matrix.crate }} | |
| - name: Check clippy | |
| if: matrix.crate != 'rln-wasm' | |
| run: cargo clippy --all-targets --release -- -D warnings | |
| working-directory: ${{ matrix.crate }} | |
| benchmark: | |
| name: Benchmark - ${{ matrix.crate }} | |
| # run only on ready PRs | |
| if: github.event_name == 'pull_request' && !github.event.pull_request.draft | |
| strategy: | |
| matrix: | |
| # run benchmarks only on ubuntu | |
| crate: [utils, rln] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Compare benchmarks | |
| uses: boa-dev/criterion-compare-action@v3 | |
| with: | |
| branchName: ${{ github.base_ref }} | |
| cwd: ${{ matrix.crate }} | |
| coverage: | |
| name: Coverage | |
| if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-coverage') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install dependencies | |
| run: make installdeps | |
| - name: Install cargo-tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Run coverage | |
| run: | | |
| cargo tarpaulin --engine llvm --timeout 300 --out Html --output-dir ./coverage -- --test-threads 1 | |
| - name: Upload coverage reports | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-reports | |
| path: ./coverage/ | |
| - name: Comment on PR with coverage link | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: context.runId, | |
| }); | |
| const coverageArtifact = artifacts.data.artifacts.find(art => art.name === 'coverage-reports'); | |
| if (coverageArtifact) { | |
| const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${coverageArtifact.id}`; | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `Coverage report uploaded. [Download HTML Report](${artifactUrl})` | |
| }); | |
| } |