Skip to content

Commit

Permalink
try all
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilad Chase committed Dec 18, 2024
1 parent e947be6 commit ee7c943
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 91 deletions.
3 changes: 2 additions & 1 deletion .github/actions/install_rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ runs:
with:
cache-base: main(-v[0-9].*)?
inherit-toolchain: true
bins: taplo-cli@0.9.0
bins: taplo-cli@0.9.0, cargo-machete
channel: nightly-2024-04-29 # Just install for rustfmt, rust-toolchain.toml overrides it.
env:
RUSTFLAGS: "-C link-arg=-fuse-ld=lld"
111 changes: 22 additions & 89 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,106 +26,39 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
code_style:
runs-on: starkware-ubuntu-20-04-medium
main:
runs-on: starkware-ubuntu-latest-large
steps:
# Environment setup.
- uses: actions/checkout@v4
with:
# Fetch the entire history. Required to checkout the merge target commit, so the diff can
# be computed.
# Fetch the entire history.
fetch-depth: 0


# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: "pypy3.9"
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ steps.setup-pypy.outputs.pythonLocation }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV

# Install rust components.
- uses: ./.github/actions/bootstrap
# Setup pypy and link to the location expected by .cargo/config.toml.
- run: npm install -g ganache@7.4.3

- name: Setup Python venv
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
# Check Cargo.lock is up to date.
- name: "Check Cargo.lock"
run: |
cargo update -w --locked
git diff --exit-code Cargo.lock
- name: "tests"
run: cargo test -- --quiet
env:
SEED: 0

# Run code style on PR.
- name: "Run rustfmt pull request"
if: github.event_name == 'pull_request'
run: ci/bin/python scripts/run_tests.py --command rustfmt --changes_only --commit_id ${{ github.event.pull_request.base.sha }}
- name: "Run clippy"
- name: "clippy"
run: cargo clippy --all-targets
- name: "Run cargo doc pull request"
if: github.event_name == 'pull_request'
run: ci/bin/python scripts/run_tests.py --command doc --changes_only --commit_id ${{ github.event.pull_request.base.sha }}

# Run code style on push.
- name: "Run rustfmt on push"
if: github.event_name == 'push'
run: ci/bin/python scripts/run_tests.py --command rustfmt
- name: "Run cargo doc on push"
if: github.event_name == 'push'
run: ci/bin/python scripts/run_tests.py --command doc

- name: "Run taplo"
run: scripts/taplo.sh
- name: Run Machete (detect unused dependencies)
uses: bnjbvr/cargo-machete@main
- name: "rustfmt"
run: cargo +nightly-2024-04-29 fmt --all -- --check

run-workspace-tests:
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap
- run: cargo test -p workspace_tests
- name: "cargo doc"
run: cargo doc -r --document-private-items --no-deps

run-tests:
runs-on: starkware-ubuntu-latest-large
steps:
- uses: actions/checkout@v4
with:
# Fetch the entire history.
fetch-depth: 0
- uses: ./.github/actions/bootstrap
- name: "taplo"
run: taplo format --check --diff 1>&2

# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: "pypy3.9"
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ env.Python3_ROOT_DIR }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- run: npm install -g ganache@7.4.3
- name: "Run tests pull request"
if: github.event_name == 'pull_request'
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
ci/bin/python scripts/run_tests.py --command test --changes_only --include_dependencies --commit_id ${{ github.event.pull_request.base.sha }}
env:
SEED: 0
- name: Machete (detect unused dependencies)
run: cargo machete

- name: "Run tests on push"
if: github.event_name == 'push'
# TODO: Better support for running tests on push.
# Check Cargo.lock is up to date.
- name: "Check Cargo.lock"
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
ci/bin/python scripts/run_tests.py --command test
env:
SEED: 0

cargo update -w --locked
git diff --exit-code Cargo.lock
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.83"
components = ["clippy", "rustc-dev", "rustfmt"]
components = ["rustc-dev"]
profile = "default"
targets = ["x86_64-unknown-linux-gnu"]

0 comments on commit ee7c943

Please sign in to comment.