|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the master branch |
| 8 | + push: |
| 9 | + branches: [master, main, next] |
| 10 | + pull_request: |
| 11 | + branches: [master, main, next] |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + # This workflow contains a single job called "build" |
| 19 | + build: |
| 20 | + # The type of runner that the job will run on |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + node-version: [12] |
| 26 | + |
| 27 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 28 | + steps: |
| 29 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v2 |
| 32 | + |
| 33 | + - name: Use Node.js ${{ matrix.node-version }} |
| 34 | + uses: actions/setup-node@v2 |
| 35 | + with: |
| 36 | + node-version: ${{ matrix.node-version }} |
| 37 | + |
| 38 | + - name: Remove demo folder |
| 39 | + run: rm -rdf demo |
| 40 | + |
| 41 | + - name: Install Yarn |
| 42 | + run: npm install -g yarn |
| 43 | + |
| 44 | + - name: Get yarn cache directory path |
| 45 | + id: yarn-cache-dir-path |
| 46 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 47 | + |
| 48 | + - uses: actions/cache@v2 |
| 49 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 50 | + with: |
| 51 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 52 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 53 | + restore-keys: | |
| 54 | + ${{ runner.os }}-yarn- |
| 55 | +
|
| 56 | + - name: Install dependencies |
| 57 | + run: yarn --frozen-lockfile |
| 58 | + |
| 59 | + - name: Install Codecov |
| 60 | + run: yarn global add codecov |
| 61 | + |
| 62 | + - name: Lint |
| 63 | + run: yarn lint |
| 64 | + |
| 65 | + - name: Test |
| 66 | + run: yarn test |
| 67 | + |
| 68 | + - name: Upload to Codecov |
| 69 | + uses: codecov/codecov-action@v2.1.0 |
0 commit comments