From 91bece6f6297b4ac90de39681b0715b8d2f5d32d Mon Sep 17 00:00:00 2001 From: Iban Eguia Date: Wed, 22 Apr 2020 09:47:11 +0200 Subject: [PATCH] Improved CI workflows (#330) --- .github/workflows/benchmark.yml | 33 ----------- .github/workflows/master.yml | 82 +++++++++++++++++++++++++++ .github/workflows/pull_request.yml | 6 ++ .github/workflows/rust.yml | 90 +++++++++++++++++++++++++++++- 4 files changed, 176 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/benchmark.yml create mode 100644 .github/workflows/master.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 0e1960ec3a..0000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Boa Benchmarks on master -on: - push: - branches: - - master - -jobs: - benchmark: - name: Run Criterion benchmark - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: rustup toolchain update stable && rustup default stable - - name: Run benchmark - run: cargo bench -p Boa | tee output.txt - - name: Cache cargo registry - uses: actions/cache@v1 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - - name: Store benchmark result - uses: jasonwilliams/github-action-benchmark@v1 - with: - name: Boa Benchmarks - tool: "criterion" - output-file-path: output.txt - auto-push: true - github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000000..7a4eb36621 --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,82 @@ +name: Master workflows +on: + push: + branches: + - master + +jobs: + benchmark: + name: Run Criterion benchmark + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - name: Run benchmark + run: cargo bench -p Boa | tee output.txt + - name: Store benchmark result + uses: jasonwilliams/github-action-benchmark@v1 + with: + name: Boa Benchmarks + tool: "criterion" + output-file-path: output.txt + auto-push: true + github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + + doc-upload: + name: Upload documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - name: Generate documentation + uses: actions-rs/cargo@v1 + with: + command: doc + args: -v --document-private-items + - run: echo "" > target/doc/index.html + - name: Upload documentation + uses: appleboy/gh-pages-action@0.0.2 + with: + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + remote_url: https://github.com/${{ env.GITHUB_REPOSITORY }}.git + target_directory: target/doc + target_branch: gh-pages-test diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e90b07203d..d4e6d02ff0 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -10,11 +10,17 @@ jobs: with: toolchain: stable override: true + profile: minimal - name: Cache cargo registry uses: actions/cache@v1 with: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo build uses: actions/cache@v1 with: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bcf9309ba3..0e1205b7ea 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,9 +18,26 @@ jobs: with: toolchain: stable override: true + profile: minimal + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - uses: actions-rs/cargo@v1 with: command: check + args: -v check_on_windows: name: Check on Windows @@ -31,9 +48,11 @@ jobs: 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 @@ -44,9 +63,26 @@ jobs: with: toolchain: stable override: true + profile: minimal + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - uses: actions-rs/cargo@v1 with: command: test + args: -v test_on_windows: name: Test Suite on Windows @@ -57,9 +93,11 @@ jobs: with: toolchain: stable override: true + profile: minimal - uses: actions-rs/cargo@v1 with: command: test + args: -v fmt: name: Rustfmt @@ -70,7 +108,8 @@ jobs: with: toolchain: stable override: true - - run: rustup component add rustfmt + profile: minimal + components: rustfmt - uses: actions-rs/cargo@v1 with: command: fmt @@ -85,8 +124,55 @@ jobs: with: toolchain: stable override: true - - run: rustup component add clippy + profile: minimal + components: clippy + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - uses: actions-rs/cargo@v1 with: command: clippy args: -- --verbose + + doc: + name: Documentation check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - name: Generate documentation + uses: actions-rs/cargo@v1 + with: + command: doc + args: -v --document-private-items