Skip to content

Commit

Permalink
Add Prettier formatting (#437)
Browse files Browse the repository at this point in the history
* Add Prettier

* Add .prettierrc

* Apply Prettier
  • Loading branch information
Rigidity authored Jul 11, 2024
1 parent f36a296 commit 30d3f49
Show file tree
Hide file tree
Showing 22 changed files with 663 additions and 603 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/audit-check.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
jobs:
security_audit:
runs-on: ubuntu-latest
Expand Down
97 changes: 48 additions & 49 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Run benchmarks

on:
Expand All @@ -7,10 +6,10 @@ on:
- main
- dev
tags:
- '**'
- "**"
pull_request:
branches:
- '**'
- "**"

jobs:
benchmark:
Expand All @@ -22,64 +21,64 @@ jobs:
os: [macos-12, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: chia-network/actions/setup-python@main
name: Install Python 3.9
with:
python-version: 3.9
- uses: chia-network/actions/setup-python@main
name: Install Python 3.9
with:
python-version: 3.9

- name: Update pip
run: |
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Set up rust
uses: dtolnay/rust-toolchain@stable
- name: Set up rust
uses: dtolnay/rust-toolchain@stable

- name: Run benchmarks
run: cargo bench
- name: Run benchmarks
run: cargo bench

max-cost-checks:
name: Cost checks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: chia-network/actions/setup-python@main
name: Install Python 3.9
with:
python-version: 3.9
- uses: chia-network/actions/setup-python@main
name: Install Python 3.9
with:
python-version: 3.9

- name: Update pip
run: |
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Set up rust
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: |
python -m pip install maturin
rustup target add x86_64-unknown-linux-musl
- name: Build
env:
CC: gcc
run: |
python -m venv venv
ln -s venv/bin/activate
. ./activate
python -m pip install colorama
maturin develop -m wheel/Cargo.toml --release --features=openssl
- name: Run cost checks
run: |
. ./activate
cd tests
./generate-programs.py
./run-programs.py
- name: Set up rust
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: |
python -m pip install maturin
rustup target add x86_64-unknown-linux-musl
- name: Build
env:
CC: gcc
run: |
python -m venv venv
ln -s venv/bin/activate
. ./activate
python -m pip install colorama
maturin develop -m wheel/Cargo.toml --release --features=openssl
- name: Run cost checks
run: |
. ./activate
cd tests
./generate-programs.py
./run-programs.py
106 changes: 53 additions & 53 deletions .github/workflows/build-arm64-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
- main
- dev
tags:
- '**'
- "**"
pull_request:
branches:
- '**'
- "**"

permissions:
contents: read
Expand All @@ -24,60 +24,60 @@ jobs:
os: [[ARM64, Linux]]

steps:
- uses: Chia-Network/actions/clean-workspace@main
- uses: Chia-Network/actions/clean-workspace@main

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Build Python wheels
run: |
docker run --rm \
-v ${{ github.workspace }}:/ws --workdir=/ws \
quay.io/pypa/manylinux_2_28_aarch64 \
bash -exc '\
echo $PATH && \
curl -L https://sh.rustup.rs > rustup-init.sh && \
sh rustup-init.sh -y && \
yum -y install openssl-devel && \
source $HOME/.cargo/env && \
rustup target add aarch64-unknown-linux-musl && \
rm -rf venv && \
export PATH=/opt/python/cp310-cp310/bin/:$PATH && \
export PATH=/opt/python/cp39-cp39/bin/:$PATH && \
export PATH=/opt/python/cp38-cp38/bin/:$PATH && \
/opt/python/cp38-cp38/bin/python -m venv venv && \
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi && \
. ./activate && \
pip install maturin && \
CC=gcc maturin build -m wheel/Cargo.toml --release --strip --manylinux 2_28 --features=openssl \
'
- name: Build Python wheels
run: |
docker run --rm \
-v ${{ github.workspace }}:/ws --workdir=/ws \
quay.io/pypa/manylinux_2_28_aarch64 \
bash -exc '\
echo $PATH && \
curl -L https://sh.rustup.rs > rustup-init.sh && \
sh rustup-init.sh -y && \
yum -y install openssl-devel && \
source $HOME/.cargo/env && \
rustup target add aarch64-unknown-linux-musl && \
rm -rf venv && \
export PATH=/opt/python/cp310-cp310/bin/:$PATH && \
export PATH=/opt/python/cp39-cp39/bin/:$PATH && \
export PATH=/opt/python/cp38-cp38/bin/:$PATH && \
/opt/python/cp38-cp38/bin/python -m venv venv && \
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi && \
. ./activate && \
pip install maturin && \
CC=gcc maturin build -m wheel/Cargo.toml --release --strip --manylinux 2_28 --features=openssl \
'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels
path: target/wheels/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels
path: target/wheels/

- name: Install Twine
run: |
if [ ! -f "venv" ]; then sudo rm -rf venv; fi
sudo apt-get install python3-venv python3-pip -y
python3 -m venv venv
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi
. ./activate
pip install setuptools_rust
- name: Install Twine
run: |
if [ ! -f "venv" ]; then sudo rm -rf venv; fi
sudo apt-get install python3-venv python3-pip -y
python3 -m venv venv
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi
. ./activate
pip install setuptools_rust
- name: publish (PyPi)
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: target/wheels/
skip-existing: true
- name: publish (PyPi)
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: target/wheels/
skip-existing: true

- name: Clean up AMR64
if: startsWith(matrix.os, 'ARM64')
run: |
rm -rf venv
rm -rf dist
- name: Clean up AMR64
if: startsWith(matrix.os, 'ARM64')
run: |
rm -rf venv
rm -rf dist
44 changes: 22 additions & 22 deletions .github/workflows/build-crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
- main
- dev
tags:
- '**'
- "**"
pull_request:
branches:
- '**'
- "**"

jobs:
build_crate:
Expand All @@ -19,26 +19,26 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up rusts
uses: dtolnay/rust-toolchain@stable
- name: Set up rusts
uses: dtolnay/rust-toolchain@stable

- name: fmt (stable)
run: cargo +stable fmt -- --files-with-diff --check
- name: clippy (stable)
run: cargo +stable clippy
- name: tests
run: cargo test && cargo test --release
- name: build
run: cargo build --release
- name: dry-run of `cargo publish`
run: cargo publish --dry-run
- name: fmt (stable)
run: cargo +stable fmt -- --files-with-diff --check
- name: clippy (stable)
run: cargo +stable clippy
- name: tests
run: cargo test && cargo test --release
- name: build
run: cargo build --release
- name: dry-run of `cargo publish`
run: cargo publish --dry-run

- name: publish to crates.io if tagged
if: startsWith(github.event.ref, 'refs/tags')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.cargo_registry_token }}
run: cargo publish
- name: publish to crates.io if tagged
if: startsWith(github.event.ref, 'refs/tags')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.cargo_registry_token }}
run: cargo publish
Loading

0 comments on commit 30d3f49

Please sign in to comment.