Skip to content

Commit

Permalink
workflow: add github action to continuous integration
Browse files Browse the repository at this point in the history
actions:
* install, build and test
* deploy itowns.github.io if merged in master
  • Loading branch information
gchoqueux committed Dec 16, 2020
1 parent 617326c commit e8e4f01
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: integration
env:
CI: true

jobs:
tests:
name: build and test
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v1

- name: Use Node.js 15.x
uses: actions/setup-node@v1
with:
node-version: 15.x
# install package
# TODO: add cache npm to speed up installing
- name: Install packages
run: npm ci
# Prepare before build
- name: Prepare
run: npm run prepare
# check linter
- name: Linter
run: npm run lint -- --max-warnings=0
# Build bundle
- name: Build bundle
if: ${{ success() }}
run: npm run build
# run unit tests
- name: Unit tests
run: npm run test-with-coverage_lcov
# run functional tests
# TODO functional tests don't stop if one fails
- name: Functional tests
if: ${{ success() }}
run: npm run test-functional
# build doc
- name: Build docs
if: ${{ success() }}
run: npm run doc -- -d buildDocs
# prepare archive to deploying
- name: Archive production artifacts
if: ${{ success() && github.ref == 'refs/heads/master' }}
uses: actions/upload-artifact@v2
with:
name: dist-itowns
path: |
dist/**/*.js
examples
buildDocs
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: tests
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
name: deploy
steps:
- name: Download bundle
uses: actions/download-artifact@v2
with:
name: dist-itowns
- name: build site
run: |
mkdir -p itowns/dist
cp -R dist/*.js itowns/dist/
cp -R examples itowns/
cp -R buildDocs itowns/docs
- name: Deploy to github
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: iTowns/itowns.github.io
publish_dir: ./itowns
destination_dir: ./itowns
publish_branch: master
enable_jekyll: true

0 comments on commit e8e4f01

Please # to comment.