Skip to content

Commit e27c903

Browse files
author
Julien Bouquillon
committed
chore: add GH workflow
1 parent e168c79 commit e27c903

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/main.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: main
2+
on:
3+
- push
4+
- pull_request
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version:
13+
- 12.x
14+
15+
steps:
16+
- name: Set up Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
21+
- name: Get yarn cache directory path
22+
id: init
23+
shell: bash
24+
run: |
25+
echo "::set-output name=yarn_cache::$(yarn cache dir)"
26+
#
27+
echo "Node $(node --version)"
28+
echo "Yarn $(yarn --version)"
29+
- uses: actions/checkout@v2
30+
31+
- name: Cache Yarn packages
32+
id: yarn_cache_packages
33+
uses: actions/cache@v1
34+
with:
35+
path: ${{ steps.init.outputs.yarn_cache }}
36+
key: ${{ runner.os }}-yarn_cache-${{ hashFiles('yarn.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-yarn_cache-
39+
- name: Cache node_modules
40+
uses: actions/cache@v1
41+
with:
42+
path: node_modules
43+
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('yarn.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-${{ matrix.node-version }}-yarn-
46+
47+
- name: Installing
48+
run: yarn --frozen-lockfile --perfer-offline --link-duplicates
49+
50+
- name: Lint
51+
run: yarn lint
52+
53+
- name: Unit tests
54+
run: yarn test --coverage --coverageReporters=lcov --coverageReporters=text-summary
55+
56+
- name: Send test coverage to codecov
57+
continue-on-error: true
58+
uses: codecov/codecov-action@v1
59+
60+
- name: Build
61+
run: yarn build
62+
63+
release:
64+
needs: [build]
65+
if: github.event_name == 'push'
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Set up Node
69+
uses: actions/setup-node@v1
70+
with:
71+
node-version: 12.x
72+
73+
- uses: actions/checkout@v2
74+
75+
- name: Semantic Release
76+
uses: cycjimmy/semantic-release-action@v2
77+
with:
78+
extra_plugins: |
79+
@semantic-release/changelog
80+
@semantic-release/git
81+
env:
82+
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
83+
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
84+
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
85+
GIT_COMMITTER_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)