Skip to content

Commit

Permalink
merge with current main
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami committed Sep 9, 2024
2 parents df1ade2 + da3fcfe commit bd3c625
Show file tree
Hide file tree
Showing 119 changed files with 44,356 additions and 2,285 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @pest-parser/maintainers
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: pest-parser
open_collective: pest
60 changes: 60 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Setup
description: Initial setup for workflows

inputs:
kind:
description: Job kind (for cache key)
required: false
toolchain:
description: Toolchain version
required: false
default: "1.61.0"
components:
description: Toolchain components
required: false
targets:
description: Toolchain targets
required: false
tools:
description: Additional tools to install
required: false

outputs:
cache-key:
description: Cache key
value: ${{inputs.kind}}-${{runner.os}}-${{steps.toolchain.outputs.cachekey}}

runs:
using: composite
steps:
- name: Install Rust nightly # for minimal-versions
uses: dtolnay/rust-toolchain@nightly
- name: Install Rust ${{inputs.toolchain}}
uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: ${{inputs.toolchain}}
components: ${{inputs.components}}
targets: ${{inputs.targets}}
- name: Install cargo-hack,cargo-minimal-versions
uses: taiki-e/install-action@v1
with:
tool: cargo-hack,cargo-minimal-versions
- name: Install ${{inputs.tools}}
uses: taiki-e/install-action@v1
if: ${{inputs.tools}}
with:
tool: ${{inputs.tools}}
- name: Generate lockfile
run: cargo minimal-versions generate-lockfile
shell: sh
- name: Set up cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{inputs.kind}}-${{runner.os}}-${{steps.toolchain.outputs.cachekey}}
- name: Bootstraping Grammars - Building
run: cargo build --package pest_bootstrap
shell: sh
- name: Bootstraping Grammars - Executing
run: cargo run --package pest_bootstrap
shell: sh
240 changes: 117 additions & 123 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,115 +13,95 @@ on:
- master

jobs:
check:
name: cargo check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
kind: check
toolchain: 1.74.0 # needed for `clap` in pest_debugger
- name: cargo check
run: cargo check --all --features pretty-print,const_prec_climber,memchr,grammar-extras --all-targets

testing:
name: Unit, Style, and Lint Testing
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.1 # Pinned warnings
components: rustfmt, clippy
default: true
- name: Install gcc
run: sudo apt-get update && sudo apt-get install -y gcc
- name: Bootstraping Grammars - Building
uses: actions-rs/cargo@v1
with:
command: build
args: --package pest_bootstrap
- name: Bootstraping Grammars - Executing
uses: actions-rs/cargo@v1
with:
command: run
args: --package pest_bootstrap
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --verbose
- name: Cargo Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all --verbose
- name: Cargo Doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --all --verbose
- name: Cargo Clippy
uses: actions-rs/cargo@v1
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
command: clippy
args: --all -- -D warnings
- name: Cargo Fmt
uses: actions-rs/cargo@v1
kind: check
components: clippy, rustfmt
toolchain: 1.74.0 # needed for `clap` in pest_debugger
- name: cargo fmt
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --all --features pretty-print,const_prec_climber,memchr,grammar-extras --all-targets -- -Dwarnings
- name: cargo test
run: cargo test --all --features pretty-print,const_prec_climber,memchr,grammar-extras --release
- name: cargo test (ignored)
run: cargo test -p pest_grammars --lib --verbose --release -- --ignored tests::toml_handles_deep_nesting_unstable

doc:
name: Documentation check
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
command: fmt
args: --all -- --check
kind: check
toolchain: 1.74.0 # needed for `clap` in pest_debugger
- name: cargo doc
run: cargo doc --all --features pretty-print,const_prec_climber,memchr,grammar-extras

dependency:
name: Minimal Versions Testing
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install gcc
run: sudo apt-get update && sudo apt-get install -y gcc
- name: Install Rust Nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-01-01
default: true
profile: minimal
- name: Bootstraping Grammars - Building
uses: actions-rs/cargo@v1
with:
command: build
args: --package pest_bootstrap
- name: Bootstraping Grammars - Executing
uses: actions-rs/cargo@v1
with:
command: run
args: --package pest_bootstrap
- name: Cargo minimal-versions
run: cargo -Z minimal-versions generate-lockfile
- name: Cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --all --verbose
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
kind: msrv
tools: cargo-msrv
toolchain: 1.73.0 # needed for cargo-msrv due to cargo-platform v0.1.8
- name: Check msrv
shell: sh
run: for crate in "derive" "generator" "grammars" "meta" "pest" "vm"; do cd "$crate" && cargo msrv verify && cd ..; done

coverage:
name: Test Coverage
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout source code
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
toolchain: stable
profile: minimal
kind: check
components: llvm-tools-preview
default: true
- name: Bootstraping Grammars - Building
uses: actions-rs/cargo@v1
with:
command: build
args: --package pest_bootstrap
- name: Bootstraping Grammars - Executing
uses: actions-rs/cargo@v1
with:
command: run
args: --package pest_bootstrap
toolchain: stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
run: cargo llvm-cov --features pretty-print,const_prec_climber,memchr,grammar-extras --workspace --lcov --output-path lcov.info
- name: Upload Results to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -131,39 +111,53 @@ jobs:
fail_ci_if_error: false
verbose: true

# fuzzing: # fuzzit is now offline
# name: Fuzz Testing
# runs-on: ubuntu-latest
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# steps:
# - name: Checkout source code
# uses: actions/checkout@v2
# - name: Install Rust Nightly
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# default: true
# - name: Install Cargo Fuzz
# uses: actions-rs/[email protected]
# with:
# crate: cargo-fuzz
# version: latest
# use-tool-cache: true
# - name: Bootstraping Grammars - Building
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: --package pest_bootstrap
# - name: Bootstraping Grammars - Executing
# uses: actions-rs/cargo@v1
# with:
# command: run
# args: --package pest_bootstrap
# - name: Fuzz Testing - Regressions
# env:
# FUZZIT_API_KEY: ${{ secrets.FuzzitApiKey }}
# run: ./fuzzit.sh local-regression
# - name: Fuzz Testing - Fuzzing
# env:
# FUZZIT_API_KEY: ${{ secrets.FuzzitApiKey }}
# run: ./fuzzit.sh fuzzing
hack:
name: cargo hack check --feature-powerset
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
kind: check
toolchain: 1.74.0 # needed for `clap` in pest_debugger
- name: Check feature powerset
run: cargo hack check --feature-powerset --optional-deps --exclude-all-features --skip not-bootstrap-in-src,cargo --keep-going --lib --tests --ignore-private

no_std:
name: check for no_std compatibility
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
kind: check
components: rust-src
toolchain: nightly-2023-12-31 # upgrade this regularly
- name: check no_std compatibility
run: cd pest && cargo build -j1 -Z build-std=core,alloc --no-default-features --target x86_64-unknown-linux-gnu

semver:
name: check for semver compatibility
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
id: setup
with:
kind: check
toolchain: nightly-2023-12-31
tools: cargo-semver-checks
- name: check semver compatibility
shell: bash
run: ./semvercheck.sh
26 changes: 26 additions & 0 deletions .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'pest'
dry-run: false
language: rust
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'pest'
fuzz-seconds: 300
dry-run: false
language: rust
- name: Upload Crash
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pest Release

on:
release:
types: [published]

jobs:
publish:
name: Publish crates on release
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Install toolchain
uses: dtolnay/[email protected] # needed for pest_debugger (clap_builder v4.4.1 requires it)
- name: Bootstraping Grammars - Building
run: cargo build --package pest_bootstrap
- name: Bootstraping Grammars - Executing
run: cargo run --package pest_bootstrap
- name: Publish pest crates
run: ./release.sh
env:
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}
Loading

0 comments on commit bd3c625

Please sign in to comment.