feat: project dependencies and workspaces #1267
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: Validate Examples | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| # When getting Rust dependencies, retry on network error: | |
| CARGO_NET_RETRY: 10 | |
| # Use the local .curlrc | |
| CURL_HOME: . | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| src: ${{ steps.filter.outputs.src }} | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| # With 'every', a changed file is matched only when it satisfies | |
| # ALL rules: the positive pattern AND every negated pattern. | |
| predicate-quantifier: 'every' | |
| filters: | | |
| src: | |
| - '**' | |
| - '!**.md' | |
| - '!docs-site/**' | |
| - '!npm/**' | |
| validate-examples: | |
| name: Validate Examples on ${{ matrix.os }} | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup image (Linux) | |
| if: ${{ contains(matrix.os, 'ubuntu') }} | |
| run: ./.github/scripts/provision-linux-build.sh | |
| # rust-cache hashes all installed toolchains; the runner image's `stable` | |
| # drifts as the image updates, which moves the cache key and causes misses. | |
| # Remove it so only the rust-toolchain.toml-pinned version remains. | |
| - name: Remove the runner's bundled Rust toolchain | |
| run: rustup toolchain remove stable 2>/dev/null || true | |
| - uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4 | |
| with: | |
| cache-shared-key: ${{ runner.os }}-validate | |
| cache-bin: false | |
| - name: Build icp CLI | |
| run: cargo build | |
| - name: Validate examples | |
| run: ./scripts/validate-examples.sh | |
| aggregate: | |
| name: validate-examples:required | |
| if: always() && needs.changes.outputs.src == 'true' | |
| runs-on: ubuntu-latest | |
| needs: [changes, validate-examples] | |
| steps: | |
| - name: check validate-examples result | |
| if: ${{ needs.validate-examples.result != 'success' }} | |
| run: exit 1 |