Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,59 +68,6 @@ jobs:
with:
jobs: ${{ toJSON(needs) }}

generate-check-examples-matrix:
runs-on: ubuntu-latest
name: Generate Check Matrix (examples)
steps:
- uses: actions/checkout@v3
- name: Generate the matrix
id: generate-matrix
# Run the `crate-range.py` script to calculate a matrix for the `check-examples` job.
# This script outputs JSON that GitHub Actions can consume as a matrix definition.
# Rust versions to check against are arguments to this script.
run: echo "matrix=$(./tools/ci/crate-range.py generate-matrix -b ${EXAMPLES_BATCH_COUNT} --folder examples ${RUST_VERSIONS})" >> "${GITHUB_OUTPUT}"
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}

check-examples:
needs: generate-check-examples-matrix
runs-on: ubuntu-latest
name: Check Examples
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: ""
RUSTDOCFLAGS: ""
strategy:
# Use the matrix generated by the previous job
matrix: ${{ fromJson(needs.generate-check-examples-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
targets: wasm32-unknown-unknown
# Pinned to the commit hash of v2.1.0
- uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
with:
shared-key: check
- name: Cargo Check
run: ./tools/ci/crate-range.py run ${{ matrix.crate_range }} --folder examples -- cargo check --all-features

# Psuedo-job that depends on the check job so that we don't have to enter
# the myriad of crate range combinations into GitHub's protected branch rules
require-check-examples:
needs: check-examples
# Run this job even if its dependency jobs fail
if: always()
runs-on: ubuntu-latest
name: Check Matrix Success (examples)
steps:
- name: Verify jobs succeeded
# Pinned to commit hash of v1.2.2
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
jobs: ${{ toJSON(needs) }}

check-manifests:
runs-on: ubuntu-latest
steps:
Expand Down
10 changes: 5 additions & 5 deletions tools/ci/crate-range.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#
# generate-matrix
#
# This sub-command counts the total number of crates in the SDK (including examples),
# This sub-command counts the total number of crates in the SDK,
# and creates a set of batches based on that size in a format that GitHub Actions
# can consume as a matrix strategy.
#
# run
#
# This sub-command will run the given command on the given crate range.
# It deterministically distributes the SDK crates (including examples) fairly across
# It deterministically distributes the SDK crates fairly across
# the batch range by counting lines of code in attempt to keep batches with roughly
# the same workloads.
#
Expand Down Expand Up @@ -109,7 +109,7 @@ def organize_crate_list(batch_count, crates):
return result


# Lists all SDK crates including examples
# Lists all SDK crates
def list_crates(repository_root, path):
to_examine = []
to_examine.extend(list(map(lambda p: f"{repository_root}/{path}/{p}", os.listdir(f"{repository_root}/{path}"))))
Expand Down Expand Up @@ -179,15 +179,15 @@ def main():
subparser_generate_matrix = subparsers.add_parser("generate-matrix", help="Generate a test matrix")
subparser_generate_matrix.add_argument("rust_versions", type=str, nargs=argparse.ONE_OR_MORE)
subparser_generate_matrix.add_argument("-b", type=int, dest="batches", required=True, help="Number of batches")
subparser_generate_matrix.add_argument("--folder", required=True, type=str, choices=["sdk", "examples"],
subparser_generate_matrix.add_argument("--folder", required=True, type=str, choices=["sdk"],
help="Name of the folder containing the crates you want to generate a "
"matrix for")

subparser_run = subparsers.add_parser("run", help="Run command on crate range")
subparser_run.add_argument("-b", required=True, type=int, dest="batches", help="Number of batches")
subparser_run.add_argument("-s", required=True, type=int, dest="start_inclusive", help="Range start inclusive")
subparser_run.add_argument("-e", required=True, type=int, dest="end_exclusive", help="Range end exclusive")
subparser_run.add_argument("--folder", required=True, type=str, choices=["sdk", "examples"],
subparser_run.add_argument("--folder", required=True, type=str, choices=["sdk"],
help="Name of the folder containing the crates you want to run a command on")
subparser_run.add_argument("cmd", type=str, nargs=argparse.ONE_OR_MORE)

Expand Down
Loading