Skip to content

Commit

Permalink
ci: improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
motss committed Feb 4, 2022
1 parent 8425a1f commit efdf1e7
Show file tree
Hide file tree
Showing 10 changed files with 329 additions and 310 deletions.
59 changes: 34 additions & 25 deletions .github/workflows/ci-helpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,83 @@ defaults:

env:
CI_SKIP: false
GITHUB_COMMIT_MESSAGE: ''
NODE_VERSION: v0.0.0
NPM_CACHE_DIR: ~/.npm
NPM_VERSION: 0.0.0

jobs:
test:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, 'doc:')"
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'doc:')"
env:
GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
name: ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest]
target: [16.x]
timeout-minutes: 120

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Git log
- name: CI skip check
run: |
if [ -n "$(git log --format=%B -n 1 | grep -iE '^[0-9]+[.]{1,}[0-9]+[.]{1,}[0-9]+')" ]; then
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@v1
if: env.CI_SKIP == 'false'
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.target }}

- name: List versions
if: "env.CI_SKIP == 'false'"
continue-on-error: true
- name: Install latest npm
if: env.CI_SKIP == 'false'
run: |
npm i -g npm@latest
node -v && npm version && which npm && pwd && npx envinfo
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
- name: List versions
if: env.CI_SKIP == 'false'
run: |
pwd && ls -la
- name: Cache dependencies
if: env.CI_SKIP == 'false'
id: npm-cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ matrix.os }}-npm-${{ hashFiles('**/package-lock.json') }}
path: ${{ env.NPM_CACHE_DIR }}
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-npm-
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-
- name: Install dependencies
if: env.CI_SKIP == 'false'
run: |
npm ci --quiet
- name: Lint
if: "env.CI_SKIP == 'false'"
if: env.CI_SKIP == 'false'
run: |
npm run lint:build
- name: Check build
if: "env.CI_SKIP == 'false'"
shell: bash
run: |
pwd && ls -la
- name: Run Test
if: "env.CI_SKIP == 'false'"
if: env.CI_SKIP == 'false'
run: |
npm run test:helpers
- name: Upload coverage to codecov
if: env.CI_SKIP == 'false' && success()
uses: codecov/codecov-action@v1
if: env.CI_SKIP != 'true' && success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
Expand Down
63 changes: 36 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,78 +18,87 @@ defaults:

env:
CI_SKIP: false
GITHUB_COMMIT_MESSAGE: ''
NODE_VERSION: v0.0.0
NPM_CACHE_DIR: ~/.npm
NPM_VERSION: 0.0.0

jobs:
test:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, 'doc:')"
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'doc:')"
env:
GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
name: ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest]
target: [16.x]
timeout-minutes: 120

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Git log
- name: CI skip check
run: |
if [ -n "$(git log --format=%B -n 1 | grep -iE '^[0-9]+[.]{1,}[0-9]+[.]{1,}[0-9]+')" ]; then
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@v1
if: env.CI_SKIP == 'false'
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.target }}

- name: Setup Playwright
if: env.CI_SKIP != 'true'
if: env.CI_SKIP == 'false'
uses: microsoft/playwright-github-action@v1

- name: List versions
if: "env.CI_SKIP == 'false'"
continue-on-error: true
- name: Install latest npm
if: env.CI_SKIP == 'false'
run: |
npm i -g npm@latest
node -v && npm version && which npm && pwd && npx envinfo
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
- name: List versions
if: env.CI_SKIP == 'false'
run: |
pwd && ls -la && npx envinfo
- name: Cache dependencies
if: env.CI_SKIP == 'false'
id: npm-cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ matrix.os }}-npm-${{ hashFiles('**/package-lock.json') }}
path: ${{ env.NPM_CACHE_DIR }}
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-npm-
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-
- name: Install dependencies
if: "env.CI_SKIP == 'false'"
if: env.CI_SKIP == 'false'
run: |
npm ci --quiet
- name: Lint
if: "env.CI_SKIP == 'false'"
if: env.CI_SKIP == 'false'
run: |
npm run lint:build
- name: Check build
if: "env.CI_SKIP == 'false'"
shell: bash
run: |
pwd && ls -la
- name: Run Test
if: "env.CI_SKIP == 'false'"
if: env.CI_SKIP == 'false'
run: |
npm run test:elements
- name: Upload coverage to codecov
if: env.CI_SKIP == 'false' && success()
uses: codecov/codecov-action@v1
if: env.CI_SKIP != 'true' && success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ defaults:
run:
shell: bash

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
build:
name: ${{ matrix.os }} ${{ matrix.target }}
Expand All @@ -26,15 +29,14 @@ jobs:
uses: actions/checkout@v2

- name: Setup node@${{ matrix.target }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.target }}
registry-url: 'https://registry.npmjs.org'

- name: List versions
run: |
npm i -g npm@latest
node -v && npm version && which npm && pwd && npx envinfo
node -v && npm version && which npm
- name: Install dependencies
run: |
Expand All @@ -45,16 +47,12 @@ jobs:
run: |
npm config list
npm publish . --tag=next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
if: contains(github.ref, '-') == false
run: |
npm config list
npm publish .
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# See https://github.com/actions/setup-node/issues/73.
# - name: Setup node@${{ matrix.target }}
Expand All @@ -69,13 +67,9 @@ jobs:
# run: |
# npm config list
# npm publish . --tag=next
# env:
# NODE_AUTH_TOKEN: ${{github.token}}

# - name: Publish to GPR (Prerelease)
# if: success() && contains(github.ref, '-') == false
# run: |
# npm config list
# npm publish .
# env:
# NODE_AUTH_TOKEN: ${{github.token}}
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
[![ci-helpers][ga-ci-helpers-badge]][ga-ci-helpers-url]
[![codecov][codecov-badge]][codecov-url]

[![codebeat badge][codebeat-badge]][codebeat-url]
[![Language grade: JavaScript][lgtm-badge]][lgtm-url]
[![Code of Conduct][coc-badge]][coc-url]

> A different way of `datepicker`-ing on the web.
Expand Down Expand Up @@ -287,8 +285,6 @@ Tested on the following browsers:
[ga-ci-helpers-badge]: https://github.com/motss/app-datepicker/actions/workflows/ci-helpers.yml/badge.svg
[codecov-badge]: https://codecov.io/gh/motss/app-datepicker/branch/master/graph/badge.svg?token=0M1yaJNDxq

[codebeat-badge]: https://codebeat.co/badges/3a212108-43cd-4a1f-ab2c-fe890ad734b6
[lgtm-badge]: https://flat.badgen.net/lgtm/grade/javascript/g/motss/app-datepicker?icon=lgtm
[coc-badge]: https://flat.badgen.net/badge/code%20of/conduct/pink

<!-- Links -->
Expand All @@ -306,8 +302,6 @@ Tested on the following browsers:
[ga-ci-helpers-url]: https://github.com/motss/app-datepicker/actions/workflows/ci-helpers.yml
[codecov-url]: https://codecov.io/gh/motss/app-datepicker

[codebeat-url]: https://codebeat.co/projects/github-com-motss-app-datepicker-master-68699d41-3539-4c5f-81df-c9202be34919?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=motss/app-datepicker
[lgtm-url]: https://lgtm.com/projects/g/motss/app-datepicker/context:javascript?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=motss/app-datepicker
[coc-url]: https://github.com/motss/app-datepicker/blob/master/code-of-conduct.md?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=motss/app-datepicker

<!-- [intl-polyfill-url]: https://github.com/andyearnshaw/Intl.js -->
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
@media (prefers-color-scheme: dark) {
:root {
--app-focus: var(--c);
--app-ink: var(--c);
--app-on-disabled: var(--a);
--app-on-primary: var(--c);
--app-on-selected: var(--c);
Expand Down

0 comments on commit efdf1e7

Please sign in to comment.