chore(ci): Speed up CI
MODIFY
.github/workflows/main.yml
.github/workflows/main.yml
@@ -20,11 +20,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
- components: rustfmt
+ run: rustup show
+ - name: Cache
+ uses: Swatinem/rust-cache@v1
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
@@ -38,11 +36,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
- components: clippy
+ run: rustup show
+ - name: Cache
+ uses: Swatinem/rust-cache@v1
- name: Run clippy
uses: actions-rs/cargo@v1
with:
@@ -56,10 +52,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: 1.57.0
+ run: rustup show
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Compile for tests
@@ -74,26 +67,31 @@ jobs:
with:
command: test
args: --workspace --verbose
+ - name: Clean cache
+ run: cargo install cargo-cache --no-default-features --features ci-autoclean && cargo-cache
+
coverage:
name: Test262 coverage
runs-on: ${{ matrix.os }}
+
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
+
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
+ run: rustup show
- name: Cache
uses: Swatinem/rust-cache@v1
+ - name: Compile
+ run: cargo build --release --locked -p xtask
- name: Run Test262 suite
continue-on-error: true
run: cargo xtask coverage
-
+ - name: Clean cache
+ run: cargo install cargo-cache --no-default-features --features ci-autoclean && cargo-cache

RENAME
.github/workflows/pul_request.yml
.github/workflows/pull_request.yml
@@ -18,11 +18,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
- components: rustfmt
+ run: rustup show
+ - name: Cache
+ uses: Swatinem/rust-cache@v1
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
@@ -36,11 +34,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
- components: clippy
+ run: rustup show
+ - name: Cache
+ uses: Swatinem/rust-cache@v1
- name: Run clippy
uses: actions-rs/cargo@v1
with:
@@ -54,10 +50,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: 1.57.0
+ run: rustup show
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Compile for tests

MODIFY
.github/workflows/test262.yml
.github/workflows/test262.yml
@@ -13,66 +13,47 @@ jobs:
coverage:
name: Test262 coverage
runs-on: ${{ matrix.os }}
+
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
+
steps:
- - name: Checkout repository
+ - name: Checkout PR Branch
uses: actions/checkout@v2
with:
submodules: recursive
+
- name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
+ run: rustup show
+
- name: Cache
uses: Swatinem/rust-cache@v1
+
+ - name: Compile
+ run: cargo build --release --locked -p xtask
+
- name: Run Test262 suite
continue-on-error: true
- run: cargo xtask coverage --json > new_results.json
- - name: Save test results
- uses: actions/upload-artifact@v2
- with:
- name: new_results
- path: new_results.json
+ run: cargo run -p xtask --release -- coverage --json > new_results.json
+
+ - name: Checkout Main Branch
+ run: git fetch origin main && git checkout main
-# This job compares the coverage results from this PR and the coverage results from master
- coverage-comparison:
- needs: coverage
- name: Compare coverage
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [windows-latest, ubuntu-latest]
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
- with:
- submodules: recursive
- ref: main
- - name: Install toolchain
- uses: actions-rs/toolchain@v1
- with:
- toolchain: 1.57.0
- profile: minimal
- - name: Cache
- uses: Swatinem/rust-cache@v1
- name: Run Test262 suite on main branch
continue-on-error: true
- run: cargo xtask coverage --json > base_results.json
- - name: Download PRs test results
- uses: actions/download-artifact@v2
- with:
- name: new_results
+ run: cargo run -p xtask --release -- coverage --json > base_results.json
+
- name: Compare results on ${{ matrix.os }}
if: github.event_name == 'pull_request'
id: comparison
shell: bash
run: |
- comment="$(cargo xtask compare ./base_results.json ./new_results.json --markdown)"
+ echo "### Test262 comparison coverage results on ${{ matrix.os }}" > output
+ cargo run -p xtask --release -- compare ./base_results.json ./new_results.json --markdown >> output
+ cat output
+ comment="$(cat output)"
comment="${comment//'%'/'%25'}"
comment="${comment//$'\n'/'%0A'}"
comment="${comment//$'\r'/'%0D'}"
@@ -98,8 +79,6 @@ jobs:
with:
comment-id: ${{ steps.previous-comment.outputs.comment-id }}
body: |
- ### Test262 comparison coverage results on ${{ matrix.os }}
-
${{ steps.comparison.outputs.comment }}
edit-mode: replace
@@ -110,7 +89,7 @@ jobs:
with:
issue-number: ${{ steps.pr-number.outputs.pr }}
body: |
- ### Test262 comparison coverage results on ${{ matrix.os }}
-
${{ steps.comparison.outputs.comment }}
+ - name: Clean cache
+ run: cargo install cargo-cache --no-default-features --features ci-autoclean && cargo-cache

MODIFY
rust-toolchain.toml
rust-toolchain.toml
[toolchain]
+# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
+# https://rust-lang.github.io/rustup/concepts/profiles.html
profile = "default"
channel = "1.57.0"
-components = ["clippy", "rustfmt"]
-targets = [
- "x86_64-apple-darwin",
- "x86_64-pc-windows-msvc",
- "x86_64-unknown-linux-musl",
- "wasm32-unknown-unknown",
-]

chore(ci): Speed up CI (#1911)