Skip to content

Commit

Permalink
feat(#19): add Github Actions workflow (#21)
Browse files Browse the repository at this point in the history
* feat(#19): add WIP workflow

* chore(#19): add tests to ci
  • Loading branch information
Decipher authored Jan 2, 2022
1 parent dc4423a commit 21338e2
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: ci

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [14]

steps:
- name: Checkout πŸ›Ž
uses: actions/checkout@master

- name: Setup node env πŸ—
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
check-latest: true

- name: Get yarn cache directory path πŸ› 
id: yarn-cache-dir-path
run: cd nuxt && echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules πŸ“¦
uses: actions/[email protected]
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies πŸ‘¨πŸ»β€πŸ’»
run: cd nuxt && yarn

- name: Run linting πŸ”Ž
run: cd nuxt && yarn lint

- name: Run tests πŸ§ͺ
run: cd nuxt && yarn test

- uses: codecov/codecov-action@v2
with:
files: ./nuxt/coverage/clover.xml
name: codecov-umbrella
fail_ci_if_error: true
verbose: true

21 changes: 21 additions & 0 deletions nuxt/components/StuartClark.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { mount } from '@vue/test-utils'
import StuartClark from './StuartClark.vue'

const mocks = {
$store: {
state: {
config: {
title: undefined,
social: {},
},
},
},
}
const stubs = ['LogoDrupal', 'LogoGithub', 'LogoTwitter']

describe('StuartClark', () => {
test('is a Vue instance', () => {
const wrapper = mount(StuartClark, { mocks, stubs })
expect(wrapper.vm).toBeTruthy()
})
})

0 comments on commit 21338e2

Please sign in to comment.