-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c82036
commit fc23985
Showing
5 changed files
with
339 additions
and
191 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,65 @@ | ||
name: Build | ||
# ------------------------------------------------------------------- | ||
# ------------------------------- WARNING --------------------------- | ||
# ------------------------------------------------------------------- | ||
# | ||
# This file was automatically generated by gh-workflows using the | ||
# gh-workflow-gen bin. You should add and commit this file to your | ||
# git repository. **DO NOT EDIT THIS FILE BY HAND!** Any manual changes | ||
# will be lost if the file is regenerated. | ||
# | ||
# To make modifications, update your `build.rs` configuration to adjust | ||
# the workflow description as needed, then regenerate this file to apply | ||
# those changes. | ||
# | ||
# ------------------------------------------------------------------- | ||
# ----------------------------- END WARNING ------------------------- | ||
# ------------------------------------------------------------------- | ||
|
||
name: Build and Test | ||
env: | ||
RUSTFLAGS: -Dwarnings | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [main] | ||
types: [opened, reopened, synchronize] | ||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
# TODO: cancel in progress is not ok for a release since it can be cancelled in a middle of updates | ||
# and we can end up with partial release. | ||
# but for pull-requests cancelling previously running jobs could be beneficial | ||
# cancel-in-progress: true | ||
|
||
- main | ||
jobs: | ||
setup_build_matrix: | ||
name: Outputs matrix used for cross compilation | ||
uses: ./.github/workflows/build_matrix.yml | ||
|
||
test_wasm: | ||
name: Run Tests (WASM) | ||
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
target: wasm32-unknown-unknown | ||
|
||
- name: Install Wasm Pack | ||
run: cargo install wasm-bindgen-cli --vers "0.2.92" | ||
|
||
- name: Test WASM | ||
run: | | ||
# TODO: add test for wasm, so we could actually test that. | ||
cargo install -q worker-build && worker-build | ||
test: | ||
name: Run Tests on ${{ matrix.build }} | ||
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | ||
needs: setup_build_matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.setup_build_matrix.outputs.matrix) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.11.0" | ||
|
||
- name: Install Rust Toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
|
||
- name: Install Cross compilation toolchain | ||
uses: taiki-e/setup-cross-toolchain-action@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
- uses: taiki-e/install-action@cargo-llvm-cov | ||
|
||
- name: Run Cargo Test | ||
if: matrix.test != 'false' | ||
# TODO: run llvm-cov only for single build since other builds are not sent to codecov anyway | ||
run: cargo llvm-cov --workspace ${{ matrix.features }} --lcov --target ${{ matrix.target }} --output-path lcov.info | ||
publish: | ||
name: Publish on crates.io | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Setup Rust Toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: stable, nightly | ||
components: clippy, rustfmt | ||
- name: Cargo Test | ||
run: cargo test --all-features --workspace | ||
- name: Cargo Fmt | ||
run: cargo +nightly fmt --check | ||
- name: Cargo Clippy | ||
run: cargo +nightly clippy --all-features --workspace -- -D warnings | ||
release: | ||
needs: build | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust Toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
|
||
- name: Log in to Crates.io | ||
run: echo ${{ secrets.CARGO_REGISTRY_TOKEN }} | cargo login | ||
|
||
- name: Publish to Crates.io | ||
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Release Plz | ||
uses: MarcoIeni/[email protected] |
Oops, something went wrong.