From a8f7b2c1596c28ace6672c4929e713a8db453236 Mon Sep 17 00:00:00 2001 From: segayuu Date: Sat, 11 Jul 2020 14:37:58 +0900 Subject: [PATCH] Replace from travis to github actions --- .github/workflows/benchmark.yml | 35 +++++++++++++++++++++++++++++++++ .github/workflows/linter.yml | 4 ++-- .travis.yml | 2 -- test/profiling.sh | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..b67d8b73a8 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,35 @@ +name: Benchmark + +on: + push: + branchs: [ master ] + pull_request: + +jobs: + benchmark: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['10.x', '12.x', '14.x'] + fail-fast: false + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Cache NPM dependencies + uses: actions/cache@v1 + with: + path: node_modules + key: ${{ runner.OS }}-npm-cache + restore-keys: | + ${{ runner.OS }}-npm-cache + - name: Running benchmark + run: | + echo "============== Hexo Benchmark ==============" > benchmark-result-${{ matrix.node-version }}.txt + node test/benchmark.js >> benchmark-result-${{ matrix.node-version }}.txt + - uses: actions/upload-artifact@v2 + with: + name: benchmark-results + path: benchmark-result-${{ matrix.node-version }}.txt diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 2ecf6abc69..d15a8f2386 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -6,13 +6,13 @@ jobs: linter: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Use Node.js 12.x uses: actions/setup-node@v1 with: node-version: '12.x' - name: Cache NPM dependencies - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: node_modules key: ${{ runner.OS }}-npm-cache diff --git a/.travis.yml b/.travis.yml index 80ada5b559..aa3c3806e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,6 @@ before_script: - chmod +x ./test/profiling.sh script: - - echo "============== Hexo Benchmark ==============" - - node ./test/benchmark.js - ./test/profiling.sh deploy: diff --git a/test/profiling.sh b/test/profiling.sh index d4431812a2..894b57dcff 100644 --- a/test/profiling.sh +++ b/test/profiling.sh @@ -30,7 +30,7 @@ echo "" echo "- Generating flamegraph..." npm install 0x --silent -node ./node_modules/.bin/0x --output-dir "${TRAVIS_BUILD_DIR}/0x" -- node ./node_modules/.bin/hexo g > build.log 2>&1 ; +npx 0x --output-dir "${TRAVIS_BUILD_DIR}/0x" -- npx --no-install hexo g > build.log 2>&1 ; echo "Flamegraph will be deployed to: https://${TRAVIS_COMMIT}-${TRAVIS_NODE_VERSION}-hexo.surge.sh/flamegraph.html"