diff --git a/.circleci/config.yml b/.circleci/config.yml index 641da3eded..8e2e2ea7ef 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,46 +1,91 @@ version: 2.1 + +# Notes +# - `sccache` was removed because it doesn't actually provide much benefit in CI. Lots of cache misses. +# - https://github.com/Swatinem/rust-cache?tab=readme-ov-file#cache-details provides guidance on which directories to cache. +# - Incremental builds should be disabled in CI, since they don't provide much benefit. +# - Enabling `--only_testnet` feature flag to reduce the amount of time spent building leo-lang, since it's not needed for the test suite. + +# Rust Version: 1.82.0 +# Ensure that this matches the `rust-version` in `Cargo.toml`. +# If this is changed, propogate the changes to all places in this file, including the `install-rust` command. + +# TODO: +# - The cache size can accumulate as the dependencies get upgraded. Ideally you want some pruning before the cache gets persisted. +# See swatinem/rust-cache for a sensible approach. Unfortunately, we'd have to build this for CircleCI. +# - Rust v1.83.0 is coming with some sensible cargo rebuild improvements. We should upgrade to that when it's released. + + +environment: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-D warnings" + +orbs: + windows: circleci/windows@5.0 + codecov: codecov/codecov@1.0.2 + +executors: + macos-executor: + macos: + xcode: "16.0.0" # Use appropriate Xcode version + resource_class: m2pro.large + + linux-executor: + docker: + - image: "cimg/rust:1.82.0" # Ensure that this matches the `rust-version` in `Cargo.toml`. + resource_class: xlarge + commands: - setup_environment: - description: "Setup environment" - parameters: - cache_key: - type: string - default: leo-stable-linux-cache + install-rust: + description: "Install Rust (Linux/macOS)" steps: - - run: set -e - - setup_remote_docker - run: - name: Prepare environment and install dependencies + name: Install Rust command: | - export SCCACHE_CACHE_SIZE=200M - export WORK_DIR="$CIRCLE_WORKING_DIRECTORY/.cache/sccache" - export SCCACHE_DIR="$CIRCLE_WORKING_DIRECTORY/.cache/sccache" - mkdir -p "$CIRCLE_WORKING_DIRECTORY/.bin" - wget https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz - tar -C "$CIRCLE_WORKING_DIRECTORY/.bin" -xvf sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz - mv $CIRCLE_WORKING_DIRECTORY/.bin/sccache-0.2.13-x86_64-unknown-linux-musl/sccache $CIRCLE_WORKING_DIRECTORY/.bin/sccache - export PATH="$PATH:$CIRCLE_WORKING_DIRECTORY/.bin" - export RUSTC_WRAPPER="sccache" - rm -rf "$CIRCLE_WORKING_DIRECTORY/.cargo/registry" - sudo apt-get update && sudo apt-get install -y clang llvm-dev llvm pkg-config xz-utils make libssl-dev libssl-dev - - restore_cache: - keys: - - << parameters.cache_key >> - - clear_environment: - description: "Clear environment" - parameters: - cache_key: - type: string - default: leo-stable-linux-cache + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source "$HOME/.cargo/env" + rustup install 1.82.0 + rustup override set 1.82.0 + cargo --version --verbose + rustc --version + if [ ! -f "Cargo.lock" ]; then + cargo generate-lockfile + fi + + + install-rust-windows: + description: "Install Rust (Windows)" steps: - - run: (sccache -s||true) - - run: set +e - - save_cache: - key: << parameters.cache_key >> - paths: - - .cache/sccache - - .cargo + - run: + name: Install Rust (Windows) + command: | + $ProgressPreference = "SilentlyContinue" + choco uninstall rust + Invoke-WebRequest -Uri "https://win.rustup.rs/" -OutFile "C:\\rustup-init.exe" + Start-Process "C:\\rustup-init.exe" -ArgumentList '-y' -Wait + $Env:Path += ";$Env:USERPROFILE\.cargo\bin" + rustup install 1.82.0 + rustup default 1.82.0 + cargo --version --verbose + rustc --version | Out-File -FilePath "rust-version" + if (!(Test-Path "Cargo.lock" -PathType Leaf)) { + cargo generate-lockfile + } + + build-and-test: + description: "Build and run tests" + steps: + - run: + name: Build + no_output_timeout: 30m + command: | + cargo test --no-run --all --locked --profile ci --features only_testnet + - run: + name: Run tests + no_output_timeout: 30m + # The `--verbose` flag is used to check which files are being recompiled. Ideally, this should be none. + command: | + cargo test --all --locked --profile ci --features only_testnet --verbose install_rust_nightly: description: "Install Rust nightly toolchain" @@ -48,53 +93,135 @@ commands: - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu jobs: - check-style: - docker: - - image: cimg/rust:1.76 - resource_class: xlarge + test-windows: + executor: + name: windows/default + size: xlarge steps: - checkout - - install_rust_nightly - - setup_environment: - cache_key: leo-fmt-cache + - restore_cache: + keys: + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} + - cargo-v1-{{ arch }} + - install-rust-windows + - run: + name: Update Submodules + command: git submodule update --init --recursive + - build-and-test + - save_cache: + key: cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + paths: + - C:\Users\circleci\.cargo + - target + + test-macos: + executor: macos-executor + steps: + - checkout + - restore_cache: + keys: + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} + - cargo-v1-{{ arch }} + - install-rust - run: name: Update Submodules command: git submodule update --init --recursive + - build-and-test + - save_cache: + key: cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + paths: + - ~/.cargo + - target + + test-linux: + executor: linux-executor + steps: + - checkout + - restore_cache: + keys: + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} + - cargo-v1-{{ arch }} - run: - name: Check style - no_output_timeout: 35m - command: cargo +nightly fmt --all -- --check - - clear_environment: - cache_key: leo-fmt-cache + name: Update Submodules + command: git submodule update --init --recursive + - build-and-test + - save_cache: + key: cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + paths: + - ~/.cargo + - target - clippy: - docker: - - image: cimg/rust:1.76 - resource_class: xlarge +# TODO: Move code-coverage to CircleCI +# code-coverage: +# executor: linux-executor +# steps: +# - checkout +# - restore_cache: +# keys: +# - codecov-cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} +# - codecov-cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} +# - codecov-cargo-v1-{{ arch }} +# - install-rust +# - build-and-test +# - codecov/upload: +# file: { { coverage_report_filepath } } +# - save_cache: +# key: codecov-cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} +# paths: +# - ~/.cargo +# - target + + check-style-clippy-docs: + executor: linux-executor + resource_class: large steps: - checkout - - setup_environment: - cache_key: leo-clippy-cache + - restore_cache: + keys: + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} + - cargo-v1-{{ arch }} + - install_rust_nightly - run: name: Update Submodules command: git submodule update --init --recursive + - run: + name: Check style + no_output_timeout: 35m + command: cargo +nightly fmt --all -- --check - run: name: Clippy no_output_timeout: 35m command: | cargo clippy --workspace --all-targets -- -D warnings cargo clippy --workspace --all-targets --all-features -- -D warnings - - clear_environment: - cache_key: leo-clippy-cache + - run: + name: Build Cargo Docs + command: | + cargo doc --no-deps --document-private-items --workspace + rm -rf ./tests + environment: + RUSTDOCFLAGS: "--enable-index-page -Zunstable-options" + RUSTC_BOOTSTRAP: "1" + - save_cache: + key: cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + paths: + - ~/.cargo + - target leo-executable: - docker: - - image: cimg/rust:1.76 + executor: linux-executor resource_class: xlarge steps: - checkout - - setup_environment: - cache_key: leo-executable-cache + - restore_cache: + keys: + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + - cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }} + - cargo-v1-{{ arch }} - run: name: Update Submodules command: git submodule update --init --recursive @@ -106,12 +233,15 @@ jobs: root: ~/ paths: - project/ - - clear_environment: - cache_key: leo-executable-cache + - save_cache: + key: cargo-v1-{{ arch }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + paths: + - ~/.cargo + - target leo-new: docker: - - image: cimg/rust:1.76 + - image: cimg/rust:1.82 resource_class: xlarge steps: - attach_workspace: @@ -124,7 +254,7 @@ jobs: leo-clean: docker: - - image: cimg/rust:1.76 + - image: cimg/rust:1.82 resource_class: xlarge steps: - attach_workspace: @@ -137,7 +267,7 @@ jobs: leo-example: docker: - - image: cimg/rust:1.76 + - image: cimg/rust:1.82 resource_class: xlarge steps: - attach_workspace: @@ -150,7 +280,7 @@ jobs: test-examples: docker: - - image: cimg/rust:1.76 + - image: cimg/rust:1.82 resource_class: xlarge steps: - attach_workspace: @@ -166,8 +296,10 @@ workflows: version: 2 main-workflow: jobs: - - check-style - - clippy + - test-windows + - test-macos + - test-linux + - check-style-clippy-docs - leo-executable - leo-new: requires: diff --git a/.github/workflows/acl2.yml b/.github/archive/acl2.yml similarity index 97% rename from .github/workflows/acl2.yml rename to .github/archive/acl2.yml index 974ebcd48b..ec55ba043d 100644 --- a/.github/workflows/acl2.yml +++ b/.github/archive/acl2.yml @@ -1,3 +1,4 @@ +# This workflow is no longer in use as we have paused the ACL2 work on the Leo repo. name: Leo-ACL2 on: workflow_dispatch env: diff --git a/.github/workflows/markdown.yml b/.github/archive/markdown.yml similarity index 93% rename from .github/workflows/markdown.yml rename to .github/archive/markdown.yml index cfe6861c34..eee1807182 100644 --- a/.github/workflows/markdown.yml +++ b/.github/archive/markdown.yml @@ -1,3 +1,4 @@ +# This workflow is no longer in use as we do not have any Mermaid diagrams in the Leo repo. name: Markdown Compiler on: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef4b67508b..885149296a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,275 +11,16 @@ env: RUST_BACKTRACE: 0 jobs: - test-package: - name: Test Package ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macOS-latest, ubuntu-latest] - include: - - os: ubuntu-latest - sccache-path: /home/runner/.cache/sccache - - os: macos-latest - sccache-path: /Users/runner/Library/Caches/Mozilla.sccache - - env: - RUSTC_WRAPPER: sccache - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: ${{ matrix.sccache-path }} - # SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install sccache Ubuntu - if: matrix.os == 'ubuntu-latest' - env: - LINK: https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION: v0.2.15 - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Install sccache Macos - if: matrix.os == 'macos-latest' - run: | - brew install sccache - - - name: Install Rust Stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Cache cargo registry - uses: actions/cache@v2 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Save sccache - uses: actions/cache@v2 - continue-on-error: false - with: - path: ${{ matrix.sccache-path }} - key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-sccache- - - - name: Start sccache server - run: | - sccache --start-server - - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --all - - - name: Print sccache stats - run: sccache --show-stats - - - name: Stop sccache server - run: sccache --stop-server || true - - test-package-macos_m1: - name: Test Package macOS M1 - runs-on: macos-latest - env: - RUSTC_WRAPPER: sccache - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /Users/runner/Library/Caches/Mozilla.sccache - # SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out - steps: - - name: Xcode Select - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install sccache - run: | - brew install sccache - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - target: aarch64-apple-darwin - toolchain: stable - override: true - components: rustfmt - - - name: Cache cargo registry - uses: actions/cache@v2 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: m1-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - m1-cargo- - - - name: Save sccache - uses: actions/cache@v2 - continue-on-error: false - with: - path: /Users/runner/Library/Caches/Mozilla.sccache - key: m1-sccache-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - m1-sccache- - - - name: Start sccache server - run: | - sccache --start-server - - - name: Test - run: | - SDKROOT=$(xcrun -sdk macosx --show-sdk-path) \ - MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) \ - cargo test --all - - - name: Print sccache stats - run: sccache --show-stats - - - name: Stop sccache server - run: sccache --stop-server || true - - test-package-windows: - name: Test Package Windows - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - - - name: Install Rust Stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Test - run: | - cargo test --all - - test-docs: - name: Test Docs - runs-on: ubuntu-latest - env: - RUSTC_WRAPPER: sccache - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /home/runner/.cache/sccache - SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - ref: mainnet - - - name: Install sccache - env: - LINK: https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION: v0.2.15 - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Cache cargo registry - uses: actions/cache@v2 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Install Rust Stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Save sccache - uses: actions/cache@v2 - continue-on-error: false - with: - path: /home/runner/.cache/sccache - key: ubuntu-sccache-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ubuntu-sccache- - - - name: Start sccache server - run: sccache --start-server - - - name: Build Cargo Docs - env: - RUSTDOCFLAGS: "--enable-index-page -Zunstable-options" - RUSTC_BOOTSTRAP: "1" - run: | - cargo doc --no-deps --document-private-items --workspace - rm -rf ./tests - - - name: Print sccache stats - run: sccache --show-stats - - - name: Stop sccache server - run: sccache --stop-server || true - codecov: name: Code Coverage runs-on: ubuntu-latest - env: - RUSTC_BOOTSTRAP: 1 - RUSTC_WRAPPER: sccache - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /home/runner/.cache/sccache steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 with: submodules: true - - name: Install sccache Ubuntu - env: - LINK: https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION: v0.2.15 - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Install Rust + - name: Install Rust Stable uses: actions-rs/toolchain@v1 with: profile: minimal @@ -287,35 +28,14 @@ jobs: override: true components: rustfmt - - name: Cache cargo registry - uses: actions/cache@v2 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: codecov-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - codecov-cargo- - - - name: Save sccache - uses: actions/cache@v2 - continue-on-error: false - with: - path: /Users/runner/Library/Caches/Mozilla.sccache - key: codecov-sccache-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - codecov-sccache- - - - name: Start sccache server - run: | - sccache --start-server + - name: Set up rust-cache + uses: Swatinem/rust-cache@v2 - name: Test uses: actions-rs/cargo@v1 with: command: test - args: --all + args: --all --locked --profile ci --features only_testnet env: CARGO_INCREMENTAL: "0" @@ -334,15 +54,9 @@ jobs: make install DESTDIR=../../kcov-build cd ../.. rm -rf kcov-master - for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done + for file in target/ci/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - - - name: Print sccache stats - run: sccache --show-stats - - - name: Stop sccache server - run: sccache --stop-server || true diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 3200dcb842..1e31031cbb 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -15,27 +15,12 @@ jobs: runs-on: ubuntu-latest env: RUSTC_BOOTSTRAP: 1 - RUSTC_WRAPPER: sccache - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /home/runner/.cache/sccache steps: - name: Checkout uses: actions/checkout@v2 with: submodules: true - - name: Install sccache Ubuntu - env: - LINK: https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION: v0.2.15 - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -44,35 +29,14 @@ jobs: override: true components: rustfmt - - name: Cache cargo registry - uses: actions/cache@v2 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: codecov-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - codecov-cargo- - - - name: Save sccache - uses: actions/cache@v2 - continue-on-error: false - with: - path: /Users/runner/Library/Caches/Mozilla.sccache - key: codecov-sccache-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - codecov-sccache- - - - name: Start sccache server - run: | - sccache --start-server + - name: Set up rust-cache + uses: Swatinem/rust-cache@v2 - name: Test uses: actions-rs/cargo@v1 with: command: test - args: --all + args: --all --locked --profile ci --features only_testnet env: CARGO_INCREMENTAL: "0" @@ -97,9 +61,3 @@ jobs: uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - - - name: Print sccache stats - run: sccache --show-stats - - - name: Stop sccache server - run: sccache --stop-server || true diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4cda07b036..b65cf03038 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,31 +8,13 @@ jobs: build-crates-docs: name: Build Crates Docs runs-on: ubuntu-latest - env: - RUSTC_WRAPPER: sccache - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /home/runner/.cache/sccache - # SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out steps: - name: Checkout uses: actions/checkout@v2 with: - with: - submodules: true + submodules: true ref: mainnet - - name: Install sccache - env: - LINK: https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION: v0.7.6 - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - - name: Install Rust Stable uses: actions-rs/toolchain@v1 with: @@ -40,17 +22,9 @@ jobs: toolchain: stable override: true - - name: Save sccache - uses: actions/cache@v2 - continue-on-error: false - with: - path: /home/runner/.cache/sccache - key: ubuntu-sccache-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ubuntu-sccache- - - - name: Start sccache server - run: sccache --start-server - + - name: Set up rust-cache + uses: Swatinem/rust-cache@v2 + - name: Build Cargo Docs env: RUSTDOCFLAGS: "--enable-index-page -Zunstable-options" @@ -64,9 +38,3 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./target/doc/ - - - name: Print sccache stats - run: sccache --show-stats - - - name: Stop sccache server - run: sccache --stop-server || true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61d83ca6b9..4bfcba93e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,7 +97,7 @@ jobs: macos: name: macOS - runs-on: macos-latest + runs-on: macos-13 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/Cargo.lock b/Cargo.lock index bdd40e29e1..bd88612d94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1120,9 +1120,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -1288,7 +1288,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -1301,9 +1301,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", @@ -1529,6 +1529,7 @@ dependencies = [ "leo-test-framework", "regex", "serde", + "serial_test", "sha2", "snarkvm", "tempfile", @@ -1568,7 +1569,6 @@ dependencies = [ "ansi_term", "backtrace", "clap", - "color-backtrace", "colored", "crossterm", "dialoguer", @@ -1578,7 +1578,6 @@ dependencies = [ "leo-compiler", "leo-errors", "leo-package", - "leo-parser", "leo-retriever", "leo-span", "num-format", @@ -1627,7 +1626,6 @@ dependencies = [ "serde_json", "snarkvm", "toml 0.8.19", - "tracing", ] [[package]] @@ -1638,7 +1636,6 @@ dependencies = [ "itertools 0.13.0", "leo-ast", "leo-errors", - "leo-parser", "leo-span", "num-traits", "serde", @@ -1687,7 +1684,6 @@ dependencies = [ "leo-compiler", "leo-errors", "leo-span", - "regex", "serde", "serde_json", "snarkvm", @@ -2327,7 +2323,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.0", "http-body-util", diff --git a/Cargo.toml b/Cargo.toml index f201adcc27..6ac213531d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ include = [ ] license = "GPL-3.0" edition = "2021" +rust-version = "1.82.0" # Be sure to update CI and the ./rust-toolchain file. [workspace] members = [ @@ -147,9 +148,6 @@ workspace = true [dependencies.leo-package] workspace = true -[dependencies.leo-parser] -workspace = true - [dependencies.leo-span] workspace = true @@ -166,9 +164,6 @@ version = "0.3.74" version = "4.5" features = [ "derive", "env", "color", "unstable-styles" ] -[dependencies.color-backtrace] -version = "0.6.1" - [dependencies.colored] version = "2.0" @@ -257,3 +252,8 @@ lto = "off" incremental = true debug = true debug-assertions = true + +[profile.ci] +inherits = "test" +incremental = false +debug = false diff --git a/compiler/compiler/Cargo.toml b/compiler/compiler/Cargo.toml index 2da24b8301..8f8b6e87ed 100644 --- a/compiler/compiler/Cargo.toml +++ b/compiler/compiler/Cargo.toml @@ -70,6 +70,9 @@ workspace = true [dev-dependencies.toml] workspace = true +[dev-dependencies.serial_test] +version = "3.1.1" + [dev-dependencies.tempfile] version = "3.13" diff --git a/compiler/compiler/tests/compile.rs b/compiler/compiler/tests/integration/compile.rs similarity index 94% rename from compiler/compiler/tests/compile.rs rename to compiler/compiler/tests/integration/compile.rs index 6550dc0b1b..33c53a8969 100644 --- a/compiler/compiler/tests/compile.rs +++ b/compiler/compiler/tests/integration/compile.rs @@ -14,18 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -mod utilities; -use utilities::{ - BufferEmitter, - CompileOutput, - CurrentNetwork, - compile_and_process, - get_build_options, - get_cwd_option, - hash_asts, - hash_symbol_tables, - parse_program, -}; +use super::*; use leo_compiler::{CompilerOptions, OutputOptions}; use leo_disassembler::disassemble_from_str; @@ -182,9 +171,9 @@ fn run_test(test: Test, handler: &Handler, buf: &BufferEmitter) -> Result Option> { Some(match name { "Compile" => Box::new(CompileNamespace), @@ -192,8 +181,3 @@ impl Runner for TestRunner { }) } } - -#[test] -pub fn compiler_tests() { - leo_test_framework::run_tests(&TestRunner, "compiler"); -} diff --git a/compiler/compiler/tests/execute.rs b/compiler/compiler/tests/integration/execute.rs similarity index 96% rename from compiler/compiler/tests/execute.rs rename to compiler/compiler/tests/integration/execute.rs index 7a0a6210d8..2d7c92a75e 100644 --- a/compiler/compiler/tests/execute.rs +++ b/compiler/compiler/tests/integration/execute.rs @@ -14,20 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -mod utilities; -use utilities::{ - BufferEmitter, - CompileOutput, - CurrentNetwork, - ExecuteOutput, - buffer_if_err, - compile_and_process, - get_build_options, - get_cwd_option, - hash_asts, - hash_symbol_tables, - parse_program, -}; +use super::*; use leo_compiler::{CompilerOptions, OutputOptions}; use leo_errors::emitter::Handler; @@ -322,9 +309,9 @@ fn run_test(test: Test, handler: &Handler, buf: &BufferEmitter) -> Result Option> { Some(match name { "Execute" => Box::new(ExecuteNamespace), @@ -332,8 +319,3 @@ impl Runner for TestRunner { }) } } - -#[test] -pub fn execution_tests() { - leo_test_framework::run_tests(&TestRunner, "execution"); -} diff --git a/compiler/compiler/tests/integration/main.rs b/compiler/compiler/tests/integration/main.rs new file mode 100644 index 0000000000..b4ee8d77cd --- /dev/null +++ b/compiler/compiler/tests/integration/main.rs @@ -0,0 +1,38 @@ +// Copyright (C) 2019-2024 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +mod compile; +use compile::*; + +mod execute; +use execute::*; + +mod utilities; +use utilities::*; + +use serial_test::serial; + +#[test] +#[serial] +pub fn compiler_tests() { + leo_test_framework::run_tests(&CompileTestRunner, "compiler"); +} + +#[test] +#[serial] +pub fn execution_tests() { + leo_test_framework::run_tests(&ExecuteTestRunner, "execution"); +} diff --git a/compiler/compiler/tests/utilities/check_unique_node_ids.rs b/compiler/compiler/tests/integration/utilities/check_unique_node_ids.rs similarity index 100% rename from compiler/compiler/tests/utilities/check_unique_node_ids.rs rename to compiler/compiler/tests/integration/utilities/check_unique_node_ids.rs diff --git a/compiler/compiler/tests/utilities/mod.rs b/compiler/compiler/tests/integration/utilities/mod.rs similarity index 100% rename from compiler/compiler/tests/utilities/mod.rs rename to compiler/compiler/tests/integration/utilities/mod.rs diff --git a/compiler/compiler/tests/utilities/output.rs b/compiler/compiler/tests/integration/utilities/output.rs similarity index 100% rename from compiler/compiler/tests/utilities/output.rs rename to compiler/compiler/tests/integration/utilities/output.rs diff --git a/compiler/parser/Cargo.toml b/compiler/parser/Cargo.toml index 236c5e4ac5..cf840eecbf 100644 --- a/compiler/parser/Cargo.toml +++ b/compiler/parser/Cargo.toml @@ -40,9 +40,6 @@ workspace = true [dependencies.serde] workspace = true -[dependencies.tracing] -workspace = true - [dev-dependencies.leo-test-framework] path = "../../tests/test-framework" diff --git a/compiler/passes/Cargo.toml b/compiler/passes/Cargo.toml index 9924de8e40..3c2a7824ed 100644 --- a/compiler/passes/Cargo.toml +++ b/compiler/passes/Cargo.toml @@ -30,9 +30,6 @@ workspace = true [dependencies.leo-errors] workspace = true -[dependencies.leo-parser] -workspace = true - [dependencies.leo-span] workspace = true diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000000..71fae54fb2 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +1.82.0 diff --git a/tests/test-framework/Cargo.toml b/tests/test-framework/Cargo.toml index b469629962..18e0e06f20 100644 --- a/tests/test-framework/Cargo.toml +++ b/tests/test-framework/Cargo.toml @@ -48,9 +48,6 @@ workspace = true [dependencies.walkdir] version = "2.5" -[dependencies.regex] -workspace = true - [dev-dependencies.leo-compiler] path = "../../compiler/compiler"