Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Jan 24, 2023
0 parents commit 3b57cbb
Show file tree
Hide file tree
Showing 22 changed files with 5,717 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Benchmarking

on:
workflow_dispatch:

jobs:
benchmark:
name: Run benchmark
runs-on: ubuntu-latest
strategy:
matrix:
feature-sets:
- []
- [white-spaces]
- [literals]
- [literals, comments]
steps:
- name: Check out repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Set up cache
uses: actions/cache@87396fe6b4d327202df854ff5b3e0a4ea3d77ac6
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain update nightly
rustup default nightly
- name: Run benchmark
run: cargo bench --locked --no-default-features ${{ toJSON(matrix.feature-sets) != '[]' && format('--features {0}', join(matrix.feature-sets, ',')) || '' }}
90 changes: 90 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Continuous integration

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
checks:
name: Check code
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Set up cache
uses: actions/cache@87396fe6b4d327202df854ff5b3e0a4ea3d77ac6
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain update nightly
rustup default nightly
- name: Install Clippy
run: rustup component add clippy
- name: Lint code
run: cargo clippy --locked --all-features -- -D warnings
- name: Install rustfmt
run: rustup component add rustfmt --toolchain nightly
- name: Check format
run: cargo fmt --check
- name: Install other tools
run: |
cargo install --locked cargo-deny || true
cargo install --locked cargo-udeps || true
- name: Check everything else
run: |
cargo deny check
cargo udeps
tests:
name: Test on ${{ matrix.os.name }} (${{ matrix.channel }})
runs-on: ${{ matrix.os.value }}
strategy:
matrix:
os:
- name: Linux
value: ubuntu-latest
- name: Windows
value: windows-latest
- name: macOS
value: macos-latest
channel:
- stable
- beta
- nightly
steps:
- name: Check out repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Set up cache
uses: actions/cache@87396fe6b4d327202df854ff5b3e0a4ea3d77ac6
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain update ${{ matrix.channel }}
rustup default ${{ matrix.channel }}
- name: Run tests
run: python3 tools/cargo-test-runner.py --locked --feature-sets default:white-spaces:literals:literals,comments

success:
name: Success
needs: [checks, tests]
runs-on: ubuntu-latest
steps:
- name: Success
run: echo "Success!"
54 changes: 54 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Documentation

on:
push:
branches: [main]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
deploy:
name: Deploy docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain update nightly
rustup default nightly
- name: Install rustdoc
run: rustup component add rust-docs
- name: Build docs
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
cargo doc --no-deps --locked --all-features
package_name=$(eval echo $(jq .packages[0].name <<< $(cargo metadata --format-version 1)))
cat <<EOF > target/doc/index.html
<!DOCTYPE html><html><head><script>
const repoName = '${REPO_NAME}';
const packageName = '${package_name}'.replaceAll(/-/g, '_');
window.location.replace(window.location.href.replace(repoName, \`\${repoName}/\${packageName}\`));
</script></head></html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: target/doc
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
branches: [main]

jobs:
check-release:
name: Check release
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- name: Run release please
id: release
uses: google-github-actions/release-please-action@514bc6cdae71484c998108f2136a8f5e4c62b9b9
with:
token: ${{ secrets.CHECK_RELEASE_TOKEN }}
command: manifest
release:
needs: check-release
name: Release
runs-on: ubuntu-latest
if: ${{ needs.check-release.outputs.release_created }}
steps:
- name: Check out repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Publish
run: cargo publish --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.5.5"
}
Loading

0 comments on commit 3b57cbb

Please sign in to comment.