From ab96619cd6d2cdfde531db3432854166a8dbed5d Mon Sep 17 00:00:00 2001 From: Kang Huaishuai Date: Sat, 26 Sep 2020 22:13:59 +0800 Subject: [PATCH] simply github actions yaml (#7688) use strategy->matrix->include --- .github/workflows/ci.yml | 56 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 492daf7c3a..fe30454aae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,15 +4,15 @@ on: [push, pull_request] jobs: build: - name: ${{ matrix.config.kind }} ${{ matrix.config.os }} + name: ${{ matrix.kind }} ${{ matrix.os }} if: | github.event_name == 'push' || !startsWith(github.event.pull_request.head.label, 'denoland:') - runs-on: ${{ matrix.config.os }} + runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: matrix: - config: + include: - os: macos-10.15 kind: test_release - os: windows-2019 @@ -54,8 +54,8 @@ jobs: - name: Create source tarballs (release, linux) if: | - startsWith(matrix.config.os, 'ubuntu') && - matrix.config.kind == 'test_release' && + startsWith(matrix.os, 'ubuntu') && + matrix.kind == 'test_release' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/std/') @@ -69,7 +69,7 @@ jobs: rust-version: 1.46.0 - name: Install clippy and rustfmt - if: matrix.config.kind == 'lint' + if: matrix.kind == 'lint' run: | rustup component add clippy rustup component add rustfmt @@ -81,7 +81,7 @@ jobs: architecture: x64 - name: Remove unused versions of Python - if: startsWith(matrix.config.os, 'windows') + if: startsWith(matrix.os, 'windows') run: |- $env:PATH -split ";" | Where-Object { Test-Path "$_\python.exe" } | @@ -116,43 +116,43 @@ jobs: target/*/build target/*/deps key: - ${{ matrix.config.os }}-${{ matrix.config.kind }}-${{ hashFiles('Cargo.lock') }} + ${{ matrix.os }}-${{ matrix.kind }}-${{ hashFiles('Cargo.lock') }} restore-keys: | - ${{ matrix.config.os }}-${{ matrix.config.kind }}- + ${{ matrix.os }}-${{ matrix.kind }}- - name: lint.py - if: matrix.config.kind == 'lint' + if: matrix.kind == 'lint' run: python ./tools/lint.py - name: test_format.py - if: matrix.config.kind == 'lint' + if: matrix.kind == 'lint' run: python ./tools/test_format.py - name: Build release if: | - matrix.config.kind == 'test_release' || - matrix.config.kind == 'bench' + matrix.kind == 'test_release' || + matrix.kind == 'bench' run: cargo build --release --locked --all-targets - name: Build debug - if: matrix.config.kind == 'test_debug' + if: matrix.kind == 'test_debug' run: cargo build --locked --all-targets - name: Test release - if: matrix.config.kind == 'test_release' + if: matrix.kind == 'test_release' run: cargo test --release --locked --all-targets - name: Test debug - if: matrix.config.kind == 'test_debug' + if: matrix.kind == 'test_debug' run: cargo test --locked --all-targets - name: Run Benchmarks - if: matrix.config.kind == 'bench' + if: matrix.kind == 'bench' run: cargo bench - name: Post Benchmarks if: | - matrix.config.kind == 'bench' && + matrix.kind == 'bench' && github.repository == 'denoland/deno' && github.ref == 'refs/heads/master' env: @@ -168,15 +168,15 @@ jobs: git push origin gh-pages - name: Worker info - if: matrix.config.kind == 'bench' + if: matrix.kind == 'bench' run: | cat /proc/cpuinfo cat /proc/meminfo - name: Pre-release (linux) if: | - startsWith(matrix.config.os, 'ubuntu') && - matrix.config.kind == 'test_release' + startsWith(matrix.os, 'ubuntu') && + matrix.kind == 'test_release' run: | cd target/release zip -r deno-x86_64-unknown-linux-gnu.zip deno @@ -184,23 +184,23 @@ jobs: - name: Pre-release (mac) if: | - startsWith(matrix.config.os, 'macOS') && - matrix.config.kind == 'test_release' + startsWith(matrix.os, 'macOS') && + matrix.kind == 'test_release' run: | cd target/release zip -r deno-x86_64-apple-darwin.zip deno - name: Pre-release (windows) if: | - startsWith(matrix.config.os, 'windows') && - matrix.config.kind == 'test_release' + startsWith(matrix.os, 'windows') && + matrix.kind == 'test_release' run: | Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip - name: Release uses: softprops/action-gh-release@v1 if: | - matrix.config.kind == 'test_release' && + matrix.kind == 'test_release' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/std/') @@ -217,8 +217,8 @@ jobs: - name: Publish if: | - startsWith(matrix.config.os, 'ubuntu') && - matrix.config.kind == 'test_release' && + startsWith(matrix.os, 'ubuntu') && + matrix.kind == 'test_release' && github.repository == 'denoland/deno' && startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/std/')