Skip to content

Commit

Permalink
chore: update workflows for github actions (growingio#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack0pan authored Aug 17, 2020
1 parent 5c876bd commit d1d3d93
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 46 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/auto_rebase.yml

This file was deleted.

10 changes: 8 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore lerna
- name: Restore Node.js modules
uses: actions/cache@v2
with:
path: |
Expand All @@ -24,6 +24,12 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Build packages and website
run: yarn bootstrap && yarn build && yarn workspace website build:gh-pages
- name: Test
run: yarn test --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
directory: ./packages/components/coverage/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
95 changes: 85 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,108 @@ on:
pull_request:
types: [opened, synchronize]
jobs:
run:
strategy:
matrix:
node_version: [10.x, 12.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
scan:
name: Code Scanning
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
- name: Detect Secrets
uses: zricethezav/gitleaks-action@master
install:
name: Install dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- name: Restore lerna
node-version: 12.x
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Bootstrap
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn bootstrap
lint:
name: Lint Checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Node.js modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Lint
run: yarn lint
build:
name: Build Packages
needs: install
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Node.js modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: yarn build
test:
name: Test Coverage
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Node.js modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: yarn build
- name: Test
run: yarn test
run: yarn test --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
directory: ./packages/components/coverage/
13 changes: 0 additions & 13 deletions .github/workflows/gitleaks.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publishing Packages
on:
release:
types:
- created
jobs:
install:
name: Install dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Bootstrap
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn bootstrap

publish_npm:
name: Publishing packages to the npm registry
needs: install
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: 'https://registry.npmjs.org'
- name: Restore node modules from cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Build packages
run: yarn build
- name: Publish from package
run: yarn run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ lerna-debug.log
junit.xml
report.*.json
yarn-error.log
.temp.less
.temp.less
coverage
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
"lint:style": "stylelint 'packages/components/src/**/*.{css,less}' --syntax less",
"lint-fix:components": "yarn run lint:components --fix",
"lint-fix:style": "yarn run lint:style --fix",
"test": "yarn test:components",
"test:components": "yarn workspace @gio-design/components test",
"test": "yarn workspace @gio-design/components test",
"version": "npx lerna version --no-private --no-git-tag-version",
"publish": "npx lerna publish from-package --yes"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/components/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ module.exports = {
'<rootDir>/__mocks__/fileMock.js',
'iconfont.js': '<rootDir>/__mocks__/iconMock.js',
},
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/index.{ts,tsx}', '!src/**/interface.ts'],
coverageDirectory: './coverage/',
};

0 comments on commit d1d3d93

Please sign in to comment.