-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow: add github action to continuous integration
actions: * install, build and test * deploy itowns.github.io if merged in master
- Loading branch information
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |