forked from NationalBankBelgium/stark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(build-main): replace Travis by GitHub Actions
Scripts to build, release-publish, gh-deploy have been adapted. Removed stark-ssh key
- Loading branch information
1 parent
7ad6e7d
commit 1191c3f
Showing
29 changed files
with
431 additions
and
463 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
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
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,222 @@ | ||
name: ci | ||
|
||
on: | ||
schedule: | ||
- cron: "0 12 * * *" | ||
push: | ||
branches: | ||
- master | ||
- /^\d+\.\d+\.\d(-alpha\.\d+|-beta\.\d+|-rc\.\d+)?$/ | ||
tags: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-test: | ||
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node_version: ["10", "12"] | ||
os: [ubuntu-latest, macOS-latest] | ||
env: | ||
LOGS_DIR: /tmp/stark/logs | ||
LOGS_FILE: /tmp/stark/logs/build-perf.log | ||
TZ: "Europe/Brussels" | ||
steps: | ||
- name: Set environment variable 'IS_MAIN_ENVIRONMENT' | ||
run: | | ||
if [[ '${{ matrix.node_version }}' == '10' ]] && [[ '${{ matrix.os }}' == 'ubuntu-latest' ]]; then | ||
IS_MAIN_ENVIRONMENT=1 | ||
else | ||
IS_MAIN_ENVIRONMENT=0 | ||
fi | ||
echo "::set-env name=IS_MAIN_ENVIRONMENT::$(echo $IS_MAIN_ENVIRONMENT)" | ||
# See: https://github.com/marketplace/actions/checkout | ||
- uses: actions/checkout@v2 | ||
|
||
# See: https://github.com/marketplace/actions/setup-node-js-for-use-with-actions | ||
- name: Use Node.js ${{ matrix.node_version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
|
||
- name: Create file & folder for GitHub Actions logs | ||
run: | | ||
# cfr scripts/_ghactions-group.sh | ||
mkdir -p $LOGS_DIR | ||
touch $LOGS_FILE | ||
- name: Install npm 6.9.2 | ||
run: npm i -g npm@6.9.2 | ||
|
||
- name: Get tag name if exists | ||
id: get_tag_name | ||
run: echo ::set-env name=GH_ACTIONS_TAG::$(echo $GITHUB_REF | sed -n "s/^refs\/tags\/\(\S*\).*$/\1/p") | ||
|
||
- name: List main variables | ||
run: | | ||
echo "Commit SHA : ${GITHUB_SHA}" | ||
echo "Reference : ${GITHUB_REF}" | ||
echo "Repository : ${GITHUB_REPOSITORY}" | ||
echo "Event : ${GITHUB_EVENT_NAME}" | ||
echo "Author : ${GITHUB_ACTOR}" | ||
echo "Main ENV : ${IS_MAIN_ENVIRONMENT}" | ||
NODE_VERSION="$(node -v)" | ||
echo "Node version: $NODE_VERSION" | ||
# This ensures that we are authenticated without requiring to have an actual .npmrc file within the project | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | ||
# See: https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action | ||
- name: Cache node modules | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
npm run install:ci:all | ||
# See: https://github.com/marketplace/actions/upload-artifact | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: stark-dist | ||
path: dist/packages-dist | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Linting and testing | ||
run: | | ||
npm run lint:all | ||
npm run test:ci:all | ||
- name: "Build showcase:ghpages" | ||
run: npm run build:showcase:ghpages | ||
|
||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: showcase-dist | ||
path: showcase/dist | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Browserstack testing | ||
run: | | ||
#npm run test:showcase:e2e:browserstack | ||
env: | ||
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Generate docs coverage | ||
run: npm run docs:coverage | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Save logs | ||
run: bash ./scripts/ci/print-logs.sh | ||
|
||
- name: Combine coveralls reports | ||
run: node combine-packages-coverage.js | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: "combined-lcov.info" | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
release: | ||
name: Release | ||
runs-on: "ubuntu-latest" | ||
needs: build-test | ||
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'schedule' | ||
env: | ||
LOGS_DIR: /tmp/ngx-form-errors/logs | ||
LOGS_FILE: /tmp/ngx-form-errors/logs/build-perf.log | ||
TZ: "Europe/Brussels" | ||
steps: | ||
- name: Get tag name if exists | ||
id: get_tag_name | ||
run: echo ::set-env name=GH_ACTIONS_TAG::$(echo $GITHUB_REF | sed -n "s/^refs\/tags\/\(\S*\).*$/\1/p") | ||
|
||
# See: https://github.com/marketplace/actions/checkout | ||
- uses: actions/checkout@v2 | ||
|
||
# See: https://github.com/marketplace/actions/setup-node-js-for-use-with-actions | ||
- name: Use Node.js 10 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "10" | ||
|
||
- name: Install npm 6.9.2 | ||
run: npm i -g npm@6.9.2 | ||
|
||
- uses: actions/download-artifact@v1 | ||
with: | ||
name: stark-dist | ||
path: dist/packages-dist | ||
|
||
- uses: actions/download-artifact@v1 | ||
with: | ||
name: showcase-dist | ||
path: showcase/dist | ||
|
||
# See: https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action | ||
- name: Cache node modules | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install Stark packages dependencies | ||
run: | | ||
npm ci | ||
npm run install:ci:stark-build | ||
npm run install:ci:stark-core | ||
npm run install:ci:stark-rbac | ||
npm run install:ci:stark-ui | ||
if: github.event_name != 'schedule' | ||
|
||
- name: Create file & folder for GitHub Actions logs | ||
run: | | ||
# cfr scripts/_ghactions-group.sh | ||
mkdir -p $LOGS_DIR | ||
touch $LOGS_FILE | ||
- name: Generate docs | ||
run: npm run docs:publish | ||
env: | ||
GH_ACTIONS_JOB_STATUS: ${{ job.status }} | ||
if: github.event_name != 'schedule' | ||
|
||
- name: Push docs & showcase on gh-pages | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
directory: ".tmp/ghpages" | ||
branch: "gp-pages" | ||
if: github.event_name != 'schedule' | ||
|
||
- name: Release stark | ||
run: npm run release:publish | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Save logs | ||
run: bash ./scripts/ci/print-logs.sh |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Build | ||
dist/ | ||
/dist/ | ||
.awcache/ | ||
dist/ | ||
.tmp/ | ||
/.tmp/ | ||
tmp/ | ||
|
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 |
---|---|---|
@@ -1,62 +0,0 @@ | ||
language: node_js | ||
node_js: | ||
- "10" | ||
- "12" | ||
|
||
dist: trusty | ||
sudo: false # better for performance | ||
|
||
before_install: | ||
- echo $TRAVIS_COMMIT | ||
- echo $TRAVIS_TAG | ||
- echo $TRAVIS_BRANCH | ||
- echo $TRAVIS_BUILD_NUMBER | ||
- echo $TRAVIS_REPO | ||
- export TZ=Europe/Brussels | ||
- npm i -g npm@6.9.2 | ||
- NODE_VERSION="$(node -v)" | ||
- echo $NODE_VERSION | ||
# This ensures that we are authenticated without requiring to have an actual .npmrc file within the project | ||
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc' | ||
|
||
install: | ||
# Create file & folder for Travis logs | ||
# cfr scripts/_travis-fold.sh | ||
- mkdir -p $LOGS_DIR | ||
- touch $LOGS_DIR/build-perf.log | ||
- npm ci | ||
- npm run install:ci:all | ||
- npm run build:showcase:ghpages | ||
|
||
env: | ||
global: | ||
- LOGS_DIR=/tmp/stark/logs | ||
- LOGS_FILE=/tmp/stark/logs/build-perf.log | ||
|
||
branches: | ||
only: | ||
- master | ||
- /^dependabot/npm_and_yarn/.*$/ | ||
- /^\d+\.\d+\.\d(-alpha\.\d+|-beta\.\d+|-rc\.\d+)?$/ | ||
|
||
cache: | ||
directories: | ||
- $HOME/.npm | ||
|
||
# Not needed since we use Puppeteer in karma.conf.ci.js | ||
# It downloads Chrome itself and works with or without Travis | ||
# chrome: stable | ||
|
||
script: | ||
- npm run lint:all | ||
- npm run test:ci:all | ||
# E2E tests only need to be run on 1 node version (v10) | ||
# and the secure environmentals BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY should be set. (only on secure builds) | ||
- if [[ ${NODE_VERSION} =~ ^v10.*$ && -n "${BROWSERSTACK_USERNAME}" && -n "${BROWSERSTACK_ACCESS_KEY}" ]]; then npm run test:showcase:e2e:browserstack; else echo "Skipping browserstack tests."; fi | ||
- npm run docs:coverage | ||
- npm run docs:publish | ||
- npm run release:publish | ||
- bash ./scripts/ci/print-logs.sh | ||
|
||
after_success: | ||
- npm run test:ci:coveralls:combined | ||
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
Oops, something went wrong.