Browse Source

Add bors to CI (#1684)

This Pull Request updates some of our CI config and adds config for bors.


It changes the following:

- remove `cargo check` from CI (`cargo test` should be enough)
- change back to `cargo tarpaulin` on Linux to get coverage information 
- simplify some of the CI steps' names
- add workflow for bors

##### Working with bors

It's setup so that we need 2 approvals before we can merge like we discussed in Discord.

After the second approval we can write a comment with `bors r+` so that the merge is tested.

bors will only run if `test`, `rustfmt`, `clippy`, `examples` and `doc` are all running error free in the PR's branch. It will then run them again in a `staging` branch that is the equivalent of merging the PR on `main`.

Another option we can consider is `up_to_date_approvals`, so that new commits make previous approvals not count.

The bors reference can be found here: https://bors.tech/documentation/
pull/1686/head
João Borges 3 years ago
parent
commit
6262bd9824
  1. 181
      .github/workflows/bors.yml
  2. 83
      .github/workflows/rust.yml
  3. 26
      bors.toml

181
.github/workflows/bors.yml

@ -0,0 +1,181 @@
name: bors
on:
push:
branches:
- staging
- trying
jobs:
test_on_linux:
name: Tests on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v2.1.6
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_vm_on_linux:
name: Tests on Linux with vm enabled
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v2.1.6
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: test
args: ---package Boa --lib --features=vm -- vm --nocapture
test_on_windows:
name: Tests on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v2.1.6
with:
path: target
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@v2.3.5
- 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@v2.3.5
- 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@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
components: clippy
- name: Cache cargo
uses: actions/cache@v2.1.6
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@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v2.1.6
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-examples-${{ hashFiles('**/Cargo.lock') }}
- name: Build examples
uses: actions-rs/cargo@v1
with:
command: build
args: --examples -v
- name: Run example classes
uses: actions-rs/cargo@v1
with:
command: run
args: --example classes
doc:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v2.1.6
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

83
.github/workflows/rust.yml

@ -9,66 +9,8 @@ on:
name: Continuous integration
jobs:
check_on_linux:
name: Check on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v2.1.6
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: check
args: -v
check_on_windows:
name: Check on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo build
uses: actions/cache@v2.1.6
with:
path: target
key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: check
args: -v
check_on_macos:
name: Check on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- uses: actions-rs/cargo@v1
with:
command: check
args: -v
test_on_linux:
name: Test Suite on Linux
name: Tests on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
@ -85,19 +27,14 @@ jobs:
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
command: test
args: -v
# Waiting for https://github.com/rust-lang/cargo/pull/9229 to land
# - name: Run cargo-tarpaulin
# uses: actions-rs/tarpaulin@v0.1
# with:
# args: --ignore-tests
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v1
args: --ignore-tests
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
test_vm_on_linux:
name: Test VM on Linux
name: Tests on Linux with vm enabled
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
@ -120,7 +57,7 @@ jobs:
args: ---package Boa --lib --features=vm -- vm --nocapture
test_on_windows:
name: Test Suite on Windows
name: Tests on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2.3.5
@ -140,7 +77,7 @@ jobs:
args: -v
test_on_macos:
name: Test Suite on MacOS
name: Tests on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.3.5
@ -224,7 +161,7 @@ jobs:
args: --example classes
doc:
name: Documentation check
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5

26
bors.toml

@ -0,0 +1,26 @@
# docs https://bors.tech/documentation/
status = [
"Tests on Linux",
"Tests on Linux with vm enabled",
"Tests on Windows",
"Tests on MacOS",
"Rustfmt",
"Clippy",
"Examples",
"Documentation",
]
pr_status = [
"Tests on Linux",
"Tests on Linux with vm enabled",
"Tests on Windows",
"Tests on MacOS",
"Rustfmt",
"Clippy",
"Examples",
"Documentation",
]
block_labels = [ "blocked" ]
required_approvals = 2
delete_merged_branches = true
use_squash_merge = true
update_base_for_deletes = true
Loading…
Cancel
Save