diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 0000000000..18e4061a01 --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,3 @@ +[profile.ci] +# Don't fail fast in CI to run the full test suite. +fail-fast = false diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml deleted file mode 100644 index af3785231a..0000000000 --- a/.github/workflows/bors.yml +++ /dev/null @@ -1,162 +0,0 @@ -name: bors - -on: - push: - branches: - - staging - - trying - -jobs: - test_on_linux: - name: Tests on Linux - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} - - uses: actions-rs/cargo@v1 - with: - command: test - args: -v - - test_on_windows: - name: Tests on Windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} - - uses: actions-rs/cargo@v1 - with: - command: test - args: -v - - test_on_macos: - name: Tests on MacOS - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: test - args: -v - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - components: clippy - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- --verbose - - examples: - name: Examples - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-examples-${{ hashFiles('**/Cargo.lock') }} - - run: cd boa_examples - - name: Build examples - uses: actions-rs/cargo@v1 - with: - command: build - - name: Run example classes - uses: actions-rs/cargo@v1 - with: - command: run - args: --bin classes - - doc: - name: Documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-doc-${{ hashFiles('**/Cargo.lock') }} - - name: Generate documentation - uses: actions-rs/cargo@v1 - with: - command: doc - args: -v --document-private-items --all-features diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e7c170dff0..58c181022a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,5 @@ +name: Continuous integration + on: pull_request: branches: @@ -5,12 +7,12 @@ on: push: branches: - main - -name: Continuous integration + - staging # bors + - trying # bors jobs: - test_on_linux: - name: Tests on Linux + coverage: + name: Coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -19,14 +21,9 @@ jobs: toolchain: stable override: true profile: minimal - - name: Cache cargo - uses: actions/cache@v3 + - uses: Swatinem/rust-cache@v2 with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + key: tarpaulin - name: Run cargo-tarpaulin uses: actions-rs/tarpaulin@v0.1 with: @@ -34,63 +31,14 @@ jobs: - name: Upload to codecov.io uses: codecov/codecov-action@v3 - test_on_windows: - name: Tests on Windows - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} - - uses: actions-rs/cargo@v1 - with: - command: test - args: -v --features intl - - test_on_macos: - name: Tests on MacOS - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: test - args: -v --features intl - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest + tests: + name: Build and Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-latest + - windows-latest steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1.0.7 @@ -98,22 +46,19 @@ jobs: toolchain: stable override: true profile: minimal - components: clippy - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- --verbose + - uses: Swatinem/rust-cache@v2 + - name: Build tests + run: cargo test --no-run --profile ci + # this order is faster according to rust-analyzer + - name: Build + run: cargo build --all-targets --quiet --profile ci + - name: Install latest nextest + uses: taiki-e/install-action@nextest + - name: Test with nextest + run: cargo nextest run --profile ci --cargo-profile ci --features intl - examples: - name: Examples + misc: + name: Misc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -122,45 +67,20 @@ jobs: toolchain: stable override: true profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-examples-${{ hashFiles('**/Cargo.lock') }} + components: rustfmt, clippy + - uses: Swatinem/rust-cache@v2 + with: + key: misc + - name: Lint (rustfmt) + run: cargo fmt --all --check + - name: Lint (clippy) + run: cargo clippy --all-features --all-targets + - name: Generate documentation + run: cargo doc -v --document-private-items --all-features + - name: Build + run: cargo build --all-targets --quiet --profile ci - run: cd boa_examples - name: Build examples - uses: actions-rs/cargo@v1 - with: - command: build + run: cargo build --quiet --profile ci - name: Run example classes - uses: actions-rs/cargo@v1 - with: - command: run - args: --bin classes - - doc: - name: Documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - override: true - profile: minimal - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - target - ~/.cargo/git - ~/.cargo/registry - key: ${{ runner.os }}-cargo-doc-${{ hashFiles('**/Cargo.lock') }} - - name: Generate documentation - uses: actions-rs/cargo@v1 - with: - command: doc - args: -v --document-private-items --all-features + run: cargo run --bin classes --profile ci diff --git a/Cargo.toml b/Cargo.toml index bbb50e7f50..cffa4bbe1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,12 @@ boa_macros = { version = "0.16.0", path = "boa_macros" } [workspace.metadata.workspaces] allow_branch = "main" +# The ci profile, designed to reduce size of target directory +[profile.ci] +inherits = "dev" +debug = false +incremental = false + # The release profile, used for `cargo build --release`. [profile.release] # Enables "fat" LTO, for faster release builds diff --git a/bors.toml b/bors.toml index c16f2d13b6..ab5bf23a1d 100644 --- a/bors.toml +++ b/bors.toml @@ -1,21 +1,15 @@ # docs https://bors.tech/documentation/ status = [ - "Tests on Linux", - "Tests on Windows", - "Tests on MacOS", - "Rustfmt", - "Clippy", - "Examples", - "Documentation", + "Coverage", + "Build and Test (macos-latest)", + "Build and Test (windows-latest)", + "Misc", ] pr_status = [ - "Tests on Linux", - "Tests on Windows", - "Tests on MacOS", - "Rustfmt", - "Clippy", - "Examples", - "Documentation", + "Coverage", + "Build and Test (macos-latest)", + "Build and Test (windows-latest)", + "Misc", ] block_labels = [ "blocked" ] required_approvals = 2