Skip to content

Commit

Permalink
Deploy 7640702 to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Deploy from CI committed Jan 22, 2024
0 parents commit 70b7b54
Show file tree
Hide file tree
Showing 78 changed files with 15,073 additions and 0 deletions.
192 changes: 192 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
version: 2.1

executors:
executor:
machine:
image: ubuntu-2004:current
resource_class: large

jobs:
build:
executor: executor
steps:
- checkout

- run:
name: Install dependencies
command: sudo apt update -qqy && sudo apt install libclang-dev git nodejs -qqy

- run:
name: Install Rustup
command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- run:
name: Install Rust
command: |
rustup toolchain install 1.72-x86_64-unknown-linux-gnu
rustup component add clippy --toolchain 1.72-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain 1.72-x86_64-unknown-linux-gnu
- run:
name: Install pilcom
command: git clone https://github.com/0xPolygonHermez/pilcom.git

- restore_cache:
name: Restore pilcom modules cache
keys:
- v5-pilcom-node-modules-{{ checksum "pilcom/package-lock.json" }}

- run:
name: Install pilcom node modules if cache miss
command: |
if [ ! -d "pilcom/node_modules" ]; then
(cd pilcom && npm install)
fi
- save_cache:
name: Save pilcom modules cache
key: v5-pilcom-node-modules-{{ checksum "pilcom/package-lock.json" }}
paths:
- pilcom/node_modules

- restore_cache:
name: Restore Rust cache
keys:
- v5-cargo-pr-tests-{{ .Branch }}

- run:
name: Check without Halo2
command: cargo check --all --no-default-features --profile pr-tests

- run:
name: Build
command: cargo build --bins --tests --benches --all --all-features --profile pr-tests

- save_cache:
name: Save Rust cache
key: v5-cargo-pr-tests-{{ .Branch }}
paths:
- ~/.cargo/registry
- ~/.cargo/git
- target

- persist_to_workspace:
root: .
paths:
- target/pr-tests
- pilcom


test:
executor: executor
parallelism: 4
steps:
- checkout

- attach_workspace:
at: .

- run:
name: Install dependencies
command: sudo apt update -qqy && sudo apt install libclang-dev git nodejs -qqy

- run:
name: Install Rustup
command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- run:
name: Install Rust
command: |
rustup toolchain install 1.72-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu
rustup target add riscv32imac-unknown-none-elf --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- run:
name: Determine which tests to run
command: |
cargo test --all --all-features --profile pr-tests -- --list 2> /dev/null | grep ': test' | sed -e 's/: test//' | \
circleci tests split --split-by=timings | tee tests_to_run.txt
- run:
name: Run default tests
command: |
PILCOM=$(pwd)/pilcom/ cargo test --no-fail-fast --all --all-features --profile pr-tests --verbose -- --exact $(cat tests_to_run.txt)
- run:
name: Check benches compile without running them
command: cargo bench --all --all-features --profile pr-tests --no-run

slow_test:
executor: executor
steps:
- checkout

- attach_workspace:
at: .

- run:
name: Install dependencies
command: sudo apt update -qqy && sudo apt install libclang-dev git nodejs -qqy

- run:
name: Install Rustup
command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- run:
name: Install Rust
command: |
rustup toolchain install 1.72-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu
rustup target add riscv32imac-unknown-none-elf --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- run:
name: Run slow tests
command: PILCOM=$(pwd)/pilcom/ cargo test --all --all-features --profile pr-tests --verbose -- --ignored --nocapture --test-threads=2 --exact test_keccak test_vec_median instruction_tests::addi test_many_chunks

lint:
executor: executor
steps:
- checkout
- attach_workspace:
at: .

- run:
name: Install dependencies
command: sudo apt update -qqy && sudo apt install libclang-dev git nodejs -qqy

- run:
name: Install Rustup
command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- run:
name: Install Rust
command: |
rustup toolchain install 1.72-x86_64-unknown-linux-gnu
rustup component add clippy --toolchain 1.72-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain 1.72-x86_64-unknown-linux-gnu
- run:
name: Lint
command: cargo clippy --all --all-features -- -D warnings

- run:
name: Format
command: cargo fmt --all --check --verbose


workflows:
version: 2
build-and-test:
jobs:
- build
- lint:
requires:
- build
- test:
requires:
- build
- slow_test:
requires:
- build
11 changes: 11 additions & 0 deletions .github/workflows/dead-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Check markdown links
on: [pull_request, merge_group]
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'no'
use-verbose-mode: 'yes'
43 changes: 43 additions & 0 deletions .github/workflows/deploy-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# adapted from https://github.com/rust-lang/mdBook/wiki/Automated-Deployment%3A-GitHub-Actions#GitHub-Pages-Deploy

name: Deploy book
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
# generate cli docs and inject them into the book
cargo run --package powdr_cli -- --markdown-help > book/src/cli/README.md
# build the book
cd book
mdbook build
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/* .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages
85 changes: 85 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Nightly tests
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC

env:
CARGO_TERM_COLOR: always

jobs:
check_if_needs_running:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.count.outputs.status }}

steps:
- uses: actions/checkout@v3
- name: Count recent commits
id: count
run: echo "status=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_OUTPUT

udeps:
runs-on: ubuntu-latest
needs: check_if_needs_running
if: needs.check_if_needs_running.outputs.status > 0

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- name: Run cargo-udeps
uses: aig787/cargo-udeps-action@v1
with:
version: 'latest'
args: '--all-targets'

test_release:
runs-on: ubuntu-latest
needs: check_if_needs_running
if: needs.check_if_needs_running.outputs.status > 0

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: ⚡ Cache rust
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.toml') }}
- name: ⚡ Cache nodejs
uses: actions/cache@v3
with:
path: |
~/pilcom/node_modules
key: ${{ runner.os }}-pilcom-node-modules
- name: Install Rust toolchain 1.72
run: rustup toolchain install 1.72-x86_64-unknown-linux-gnu
- name: Install nightly
run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install riscv target
run: rustup target add riscv32imac-unknown-none-elf --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install stdlib
run: rustup component add rust-src --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install pilcom
run: git clone https://github.com/0xPolygonHermez/pilcom.git && cd pilcom && npm install
- name: Check without Halo2
run: cargo check --all --no-default-features
- name: Build
run: cargo build --all --release --all-features
- name: Run tests
# Number threads is set to 1 because the runner does not have enough memeory for more.
run: PILCOM=$(pwd)/pilcom/ cargo test --all --release --verbose --all-features -- --include-ignored --nocapture --test-threads=1
- name: Run benchmarks
run: cargo bench
working-directory: compiler
56 changes: 56 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: PR tests

on:
pull_request:
merge_group:

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: ⚡ Cache rust
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.toml') }}
- name: ⚡ Cache nodejs
uses: actions/cache@v3
with:
path: |
~/pilcom/node_modules
key: ${{ runner.os }}-pilcom-node-modules
- name: Install Rust toolchain 1.72 (with clippy and rustfmt)
run: rustup toolchain install 1.72-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.72-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.72-x86_64-unknown-linux-gnu
- name: Install nightly
run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install riscv target
run: rustup target add riscv32imac-unknown-none-elf --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install stdlib
run: rustup component add rust-src --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Lint
run: cargo clippy --all --all-features -- -D warnings
- name: Format
run: cargo fmt --all --check --verbose
- name: Check benches compile without running them
run: cargo bench --all --all-features --profile pr-tests --no-run
- name: Check without Halo2
run: cargo check --all --no-default-features --profile pr-tests
- name: Install pilcom
run: git clone https://github.com/0xPolygonHermez/pilcom.git && cd pilcom && npm install
- name: Build
run: cargo build --all --all-features --profile pr-tests
- name: Run default tests
run: PILCOM=$(pwd)/pilcom/ cargo test --all --all-features --profile pr-tests --verbose
- name: Run slow tests
# Number threads is set to 1 because the runner does not have enough memory for more.
run: PILCOM=$(pwd)/pilcom/ cargo test --all --all-features --profile pr-tests --verbose -- --ignored --nocapture --test-threads=1 --exact test_keccak test_vec_median instruction_tests::addi test_many_chunks
Loading

0 comments on commit 70b7b54

Please sign in to comment.