1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

simply github actions yaml (#7688)

use strategy->matrix->include
This commit is contained in:
Kang Huaishuai 2020-09-26 22:13:59 +08:00 committed by GitHub
parent 18b7109f76
commit ab96619cd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,15 +4,15 @@ on: [push, pull_request]
jobs: jobs:
build: build:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }} name: ${{ matrix.kind }} ${{ matrix.os }}
if: | if: |
github.event_name == 'push' || github.event_name == 'push' ||
!startsWith(github.event.pull_request.head.label, 'denoland:') !startsWith(github.event.pull_request.head.label, 'denoland:')
runs-on: ${{ matrix.config.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 60 timeout-minutes: 60
strategy: strategy:
matrix: matrix:
config: include:
- os: macos-10.15 - os: macos-10.15
kind: test_release kind: test_release
- os: windows-2019 - os: windows-2019
@ -54,8 +54,8 @@ jobs:
- name: Create source tarballs (release, linux) - name: Create source tarballs (release, linux)
if: | if: |
startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.os, 'ubuntu') &&
matrix.config.kind == 'test_release' && matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' && github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') && startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/') !startsWith(github.ref, 'refs/tags/std/')
@ -69,7 +69,7 @@ jobs:
rust-version: 1.46.0 rust-version: 1.46.0
- name: Install clippy and rustfmt - name: Install clippy and rustfmt
if: matrix.config.kind == 'lint' if: matrix.kind == 'lint'
run: | run: |
rustup component add clippy rustup component add clippy
rustup component add rustfmt rustup component add rustfmt
@ -81,7 +81,7 @@ jobs:
architecture: x64 architecture: x64
- name: Remove unused versions of Python - name: Remove unused versions of Python
if: startsWith(matrix.config.os, 'windows') if: startsWith(matrix.os, 'windows')
run: |- run: |-
$env:PATH -split ";" | $env:PATH -split ";" |
Where-Object { Test-Path "$_\python.exe" } | Where-Object { Test-Path "$_\python.exe" } |
@ -116,43 +116,43 @@ jobs:
target/*/build target/*/build
target/*/deps target/*/deps
key: key:
${{ matrix.config.os }}-${{ matrix.config.kind }}-${{ hashFiles('Cargo.lock') }} ${{ matrix.os }}-${{ matrix.kind }}-${{ hashFiles('Cargo.lock') }}
restore-keys: | restore-keys: |
${{ matrix.config.os }}-${{ matrix.config.kind }}- ${{ matrix.os }}-${{ matrix.kind }}-
- name: lint.py - name: lint.py
if: matrix.config.kind == 'lint' if: matrix.kind == 'lint'
run: python ./tools/lint.py run: python ./tools/lint.py
- name: test_format.py - name: test_format.py
if: matrix.config.kind == 'lint' if: matrix.kind == 'lint'
run: python ./tools/test_format.py run: python ./tools/test_format.py
- name: Build release - name: Build release
if: | if: |
matrix.config.kind == 'test_release' || matrix.kind == 'test_release' ||
matrix.config.kind == 'bench' matrix.kind == 'bench'
run: cargo build --release --locked --all-targets run: cargo build --release --locked --all-targets
- name: Build debug - name: Build debug
if: matrix.config.kind == 'test_debug' if: matrix.kind == 'test_debug'
run: cargo build --locked --all-targets run: cargo build --locked --all-targets
- name: Test release - name: Test release
if: matrix.config.kind == 'test_release' if: matrix.kind == 'test_release'
run: cargo test --release --locked --all-targets run: cargo test --release --locked --all-targets
- name: Test debug - name: Test debug
if: matrix.config.kind == 'test_debug' if: matrix.kind == 'test_debug'
run: cargo test --locked --all-targets run: cargo test --locked --all-targets
- name: Run Benchmarks - name: Run Benchmarks
if: matrix.config.kind == 'bench' if: matrix.kind == 'bench'
run: cargo bench run: cargo bench
- name: Post Benchmarks - name: Post Benchmarks
if: | if: |
matrix.config.kind == 'bench' && matrix.kind == 'bench' &&
github.repository == 'denoland/deno' && github.repository == 'denoland/deno' &&
github.ref == 'refs/heads/master' github.ref == 'refs/heads/master'
env: env:
@ -168,15 +168,15 @@ jobs:
git push origin gh-pages git push origin gh-pages
- name: Worker info - name: Worker info
if: matrix.config.kind == 'bench' if: matrix.kind == 'bench'
run: | run: |
cat /proc/cpuinfo cat /proc/cpuinfo
cat /proc/meminfo cat /proc/meminfo
- name: Pre-release (linux) - name: Pre-release (linux)
if: | if: |
startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.os, 'ubuntu') &&
matrix.config.kind == 'test_release' matrix.kind == 'test_release'
run: | run: |
cd target/release cd target/release
zip -r deno-x86_64-unknown-linux-gnu.zip deno zip -r deno-x86_64-unknown-linux-gnu.zip deno
@ -184,23 +184,23 @@ jobs:
- name: Pre-release (mac) - name: Pre-release (mac)
if: | if: |
startsWith(matrix.config.os, 'macOS') && startsWith(matrix.os, 'macOS') &&
matrix.config.kind == 'test_release' matrix.kind == 'test_release'
run: | run: |
cd target/release cd target/release
zip -r deno-x86_64-apple-darwin.zip deno zip -r deno-x86_64-apple-darwin.zip deno
- name: Pre-release (windows) - name: Pre-release (windows)
if: | if: |
startsWith(matrix.config.os, 'windows') && startsWith(matrix.os, 'windows') &&
matrix.config.kind == 'test_release' matrix.kind == 'test_release'
run: | run: |
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: | if: |
matrix.config.kind == 'test_release' && matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' && github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') && startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/') !startsWith(github.ref, 'refs/tags/std/')
@ -217,8 +217,8 @@ jobs:
- name: Publish - name: Publish
if: | if: |
startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.os, 'ubuntu') &&
matrix.config.kind == 'test_release' && matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' && github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') && startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/') !startsWith(github.ref, 'refs/tags/std/')