Skip to content

Commit

Permalink
ci: improve CI scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Rong Sen Ng (motss) <wes.ngrongsen@gmail.com>
  • Loading branch information
motss committed Mar 21, 2022
1 parent 2fa05d2 commit 46cbf3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/ci-helpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ defaults:
shell: bash

env:
# CI_SKIP: false
COVERAGE: false
# GITHUB_COMMIT_MESSAGE: ''
IS_UBUNTU: false
NODE_VERSION: v0.0.0
NPM_CACHE_DIR: ~/.npm
Expand All @@ -29,8 +27,10 @@ env:
jobs:
test:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:') && !contains(github.event.head_commit.message, 'chore(release)')"
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
# GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }}
name: ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
Expand All @@ -41,32 +41,20 @@ jobs:
target: [16.x]

steps:
# - name: CI skip check
# run: |
# if [[ -n "$(echo $GITHUB_COMMIT_MESSAGE | grep -iE '^[0-9]+[.]{1,}[0-9]+[.]{1,}[0-9]+')" ]]; then
# echo "[INFO] SKIP CI"
# echo "CI_SKIP=true" >> $GITHUB_ENV
# fi

- name: Checkout
# if: env.CI_SKIP == 'false'
uses: actions/checkout@v2

# - name: Setup node@${{ matrix.target }}
# if: env.CI_SKIP == 'false'
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.target }}

# - name: Install latest npm
# if: env.CI_SKIP == 'false'
# run: |
# npm i -g npm@latest

- name: List versions
# if: env.CI_SKIP == 'false'
run: |
# echo "IS_UBUNTU=${{ contains(matrix.os, 'ubuntu') }}" >> $GITHUB_ENV
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
Expand All @@ -76,7 +64,6 @@ jobs:
which npm
- name: Cache dependencies
# if: env.CI_SKIP == 'false'
id: npm-cache
uses: actions/cache@v2
with:
Expand All @@ -89,12 +76,10 @@ jobs:
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}
- name: Install dependencies
# if: env.CI_SKIP == 'false'
run: |
npm ci
- name: Lint
# if: env.CI_SKIP == 'false'
run: |
npm run lint:build
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ defaults:
shell: bash

env:
# CI_SKIP: false
COVERAGE: false
# GITHUB_COMMIT_MESSAGE: ''
IS_UBUNTU: false
NODE_VERSION: v0.0.0
NPM_CACHE_DIR: ~/.npm
Expand All @@ -28,8 +26,10 @@ env:
jobs:
test:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:') && !contains(github.event.head_commit.message, 'chore(release)')"
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
# GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }}
name: ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
Expand All @@ -40,32 +40,20 @@ jobs:
target: [16.x]

steps:
# - name: CI skip check
# run: |
# if [[ -n "$(echo $GITHUB_COMMIT_MESSAGE | grep -iE '^[0-9]+[.]{1,}[0-9]+[.]{1,}[0-9]+')" ]]; then
# echo "[INFO] SKIP CI"
# echo "CI_SKIP=true" >> $GITHUB_ENV
# fi

- name: Checkout
# if: env.CI_SKIP == 'false'
uses: actions/checkout@v2

# - name: Setup node@${{ matrix.target }}
# if: env.CI_SKIP == 'false'
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.target }}

# - name: Install latest npm
# if: env.CI_SKIP == 'false'
# run: |
# npm i -g npm@latest

- name: List versions
# if: env.CI_SKIP == 'false'
run: |
# echo "IS_UBUNTU=${{ contains(matrix.os, 'ubuntu') }}" >> $GITHUB_ENV
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
Expand All @@ -76,7 +64,6 @@ jobs:
# npm x -y -- envinfo@latest
- name: Cache dependencies
# if: env.CI_SKIP == 'false'
id: npm-cache
uses: actions/cache@v2
with:
Expand All @@ -89,18 +76,15 @@ jobs:
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}
- name: Install dependencies
# if: env.CI_SKIP == 'false'
run: |
npm ci
sh $(npm root)/@reallyland/tools/list-npx-cache.sh
- name: Setup Playwright
# if: env.CI_SKIP == 'false'
run: |
$(npm bin)/playwright install-deps
- name: Lint
# if: env.CI_SKIP == 'false'
run: |
npm run lint:build
Expand Down

0 comments on commit 46cbf3a

Please sign in to comment.