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): separate packages and showcase+starter build in GitHu…
…b Actions
- Loading branch information
1 parent
7eea6f1
commit 7b1aa25
Showing
7 changed files
with
327 additions
and
46 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 |
---|---|---|
|
@@ -24,6 +24,8 @@ jobs: | |
build-and-test: | ||
name: Build and test on Node.js ${{ matrix.node_version }} and ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
if: github.actor != 'dependabot[bot]' || startsWith(github.ref_head, 'dependabot/npm_and_yarn/showcase') | ||
|| startsWith(github.ref_head, 'dependabot/npm_and_yarn/starter') | ||
strategy: | ||
matrix: | ||
node_version: ["10", "12"] | ||
|
@@ -42,6 +44,9 @@ jobs: | |
# See: https://github.com/marketplace/actions/checkout | ||
- uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
|
||
# See: https://github.com/marketplace/actions/setup-node-js-environment | ||
- name: Use Node.js ${{ matrix.node_version }} | ||
|
@@ -77,6 +82,8 @@ jobs: | |
echo "Commit SHA : ${GITHUB_SHA}" | ||
echo "Tag name : ${{ env.GH_ACTIONS_TAG }}" | ||
echo "Reference : ${GITHUB_REF}" | ||
echo "Head branch : ${GITHUB_HEAD_REF}" | ||
echo "Base branch : ${GITHUB_BASE_REF}" | ||
echo "Build number: ${GITHUB_RUN_NUMBER}" | ||
echo "Repository : ${GITHUB_REPOSITORY}" | ||
echo "Event : ${GITHUB_EVENT_NAME}" | ||
|
@@ -93,27 +100,17 @@ jobs: | |
mkdir -p ${{ env.LOGS_DIR }} | ||
touch ${{ env.LOGS_FILE }} | ||
- name: Sync packages dependencies when Dependabot bumps dependenciess | ||
run: | | ||
git config user.name "NBB Bot" | ||
git config user.email "[email protected]" | ||
npm run sync:packages-dependencies | ||
git push | ||
if: github.actor == 'dependabot[bot]' | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
npm run install:ci:all | ||
run: npm ci | ||
|
||
- name: Linting | ||
run: npm run lint:all | ||
- name: Build packages | ||
run: npm run build:trace | ||
|
||
- name: Testing | ||
run: npm run test:ci:all | ||
- name: Linting packages | ||
run: npm run lint:packages | ||
|
||
- name: "Build showcase:ghpages" | ||
run: npm run build:showcase:ghpages | ||
- name: Testing packages | ||
run: npm run test:ci:packages | ||
|
||
# See: https://github.com/marketplace/actions/upload-artifact | ||
- name: Upload stark packages-dist folder | ||
|
@@ -123,6 +120,46 @@ jobs: | |
path: dist/packages-dist | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Generate docs coverage | ||
run: npm run docs:coverage:packages | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Combine coveralls reports | ||
run: node combine-packages-coverage.js | ||
if: env.IS_MAIN_ENVIRONMENT == 1 | ||
|
||
- name: Clean root node_modules | ||
run: rm -rf ./node_modules | ||
|
||
- name: Install starter | ||
run: npm i | ||
working-directory: starter | ||
|
||
- name: "Install showcase with install command" | ||
if: github.actor == 'nbb-bot' && startsWith(github.ref_head, 'dependabot/npm_and_yarn') | ||
run: | | ||
rm package-lock.json | ||
npm install | ||
working-directory: showcase | ||
|
||
- name: "Install showcase with ci command" | ||
if: github.actor != 'nbb-bot' || !startsWith(github.ref_head, 'dependabot/npm_and_yarn') | ||
run: npm ci | ||
working-directory: showcase | ||
|
||
- name: Linting showcase & starter | ||
run: | | ||
npm run lint:showcase | ||
npm run lint:starter | ||
- name: Testing showcase & starter | ||
run: | | ||
npm run test:ci:showcase | ||
npm run test:ci:starter | ||
- name: "Build showcase:ghpages" | ||
run: npm run build:showcase:ghpages | ||
|
||
# See: https://github.com/marketplace/actions/upload-artifact | ||
- name: Upload showcase dist folder | ||
uses: actions/upload-artifact@v2 | ||
|
@@ -163,17 +200,13 @@ jobs: | |
local-testing: stop | ||
if: env.IS_MAIN_ENVIRONMENT == 1 && github.event_name == 'push' | ||
|
||
- name: Generate docs coverage | ||
run: npm run docs:coverage | ||
- name: Generate starter docs coverage | ||
run: npm run docs:starter: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: | ||
|
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,24 @@ | ||
name: Dependabot Pull Request check | ||
|
||
on: | ||
pull_request: | ||
|
||
env: | ||
TZ: "Europe/Brussels" | ||
|
||
jobs: | ||
check-if-dependabot-root-pr: | ||
name: Check PR has been opened by Dependabot for a root dependency | ||
if: github.actor == 'dependabot[bot]' && !startsWith(github.head_ref, 'dependabot/npm_and_yarn/showcase') && !startsWith(github.head_ref, 'dependabot/npm_and_yarn/starter') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: List main variables | ||
run: | | ||
echo "Commit SHA : ${GITHUB_SHA}" | ||
echo "Reference : ${GITHUB_REF}" | ||
echo "Head branch : ${GITHUB_HEAD_REF}" | ||
echo "Base branch : ${GITHUB_BASE_REF}" | ||
echo "Build number: ${GITHUB_RUN_NUMBER}" | ||
echo "Repository : ${GITHUB_REPOSITORY}" | ||
echo "Event : ${GITHUB_EVENT_NAME}" | ||
echo "Author : ${GITHUB_ACTOR}" |
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,64 @@ | ||
name: Dependabot - Sync stark-* packages dependencies versions | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Dependabot Pull Request check"] | ||
types: | ||
- completed | ||
env: | ||
TZ: "Europe/Brussels" | ||
NPM_VERSION: "latest-6" | ||
|
||
jobs: | ||
run_checks: | ||
runs-on: "ubuntu-latest" | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
&& github.actor == 'dependabot[bot]' | ||
env: | ||
PR_NUMBER: "${{ github.event.workflow_run.pull_requests[0].number }}" | ||
name: "Sync Stark-* dependencies versions for Dependabot PR #${{ github.event.workflow_run.pull_requests[0].number }}" | ||
steps: | ||
# See: https://github.com/marketplace/actions/setup-node-js-environment | ||
- name: Use Node.js 10 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 10 | ||
|
||
- name: Install npm ${{ env.NPM_VERSION }} | ||
run: npm i -g npm@${{ env.NPM_VERSION }} | ||
|
||
- name: List main variables | ||
run: | | ||
echo "Commit SHA : ${GITHUB_SHA}" | ||
echo "Reference : ${GITHUB_REF}" | ||
echo "Head branch : ${GITHUB_HEAD_REF}" | ||
echo "Base branch : ${GITHUB_BASE_REF}" | ||
echo "Build number: ${GITHUB_RUN_NUMBER}" | ||
echo "Repository : ${GITHUB_REPOSITORY}" | ||
echo "Event : ${GITHUB_EVENT_NAME}" | ||
echo "Author : ${GITHUB_ACTOR}" | ||
echo "PR Number : ${PR_NUMBER}" | ||
# See: https://github.com/marketplace/actions/checkout | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.BOT_TOKEN }} | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
|
||
- name: Configure git user info | ||
run: | | ||
git config --local user.name "NBB Bot" | ||
git config --local user.email "[email protected]" | ||
- name: Sync stark packages dependendencies | ||
run: | | ||
echo "Sync packages dependencies when based on Dependabot update for PR ${PR_NUMBER}: $(_jq '.title')" | ||
npm run sync:packages-dependencies | ||
git push | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" \ | ||
--data '{"body": "Dependency has been updated in stark-* packages dependencies. You should wait for green result before merging this! :+1:"}' \ | ||
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" |
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,5 +1,4 @@ | ||
.git/ | ||
.github/ | ||
.idea/ | ||
.vscode/ | ||
dist/ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.