Skip to content

Commit

Permalink
chore: use github actions for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer committed May 23, 2020
1 parent 4eadd26 commit 5f71975
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 15 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: CI

on:
pull_request:
types: [opened, synchronize, reopened]

env:
NODE_VERSION: "12.x"

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"

- name: Cache node modules
id: cache
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

eslint:
name: Eslint
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"

- name: Fetch all branches
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}

- name: ESLint
run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx')

typescript:
name: Typescript
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"

- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Typescript
run: npm run ci:tsc

tests:
name: Tests
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"

- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}

- name: unit tests
run: npm run ci:test
env:
GATSBY_BING_API_KEY: ${{ secrets.BING_API_KEY }}
GATSBY_GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GATSBY_LOCATIONIQ_API_KEY: ${{ secrets.LOCATIONIQ_API_KEY }}
GATSBY_OPENCAGE_API_KEY: ${{ secrets.OPENCAGE_API_KEY }}
GATSBY_HERE_API_KEY: ${{ secrets.HERE_API_KEY }}
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

7 changes: 0 additions & 7 deletions circle.yml

This file was deleted.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
"docz:build": "docz build --base /leaflet-geosearch/",
"docz:serve": "docz build && docz serve",
"docs:update": "run-s clean build && npm run docz:build && git checkout gh-pages && find .docz/dist -name '*.js.map' -delete && cp -r .docz/dist/* . && git add . && git commit -m \"update docs\" && git checkout - && git push origin gh-pages",
"prepublish": "run-s clean build"
"prepublish": "run-s test clean build",
"ci:lint": "eslint 'src/**/*.{js,ts,tsx}' -c ./.eslintrc.js",
"ci:tsc": "tsc --noEmit --project ./tsconfig.json",
"ci:test": "jest --ci"
},
"mangle": {
"regex": "^_"
Expand Down

0 comments on commit 5f71975

Please sign in to comment.