-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12382 - Add in CI for frontend. (#283)
* Add in CI for frontend. * Change branch back to master. * Add in install dependencies. * Fix makefile. * Add in Dockerfile. * Missing nginx.conf. * Remove hello1, hello2. * Minor unit test fixes. * Update package-lock.json * Delete Dockerfile and nginx.conf. * Minor CI changes. * Spacing issue. * Path fix. * Add in codecov.yaml. * Fix path. * Update package.json with coverage flag. * Fix branch to master.
- Loading branch information
Showing
10 changed files
with
361 additions
and
195 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,88 @@ | ||
name: SBC-Common-Components Web CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- "vue/sbc-common-components/**" | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./vue/sbc-common-components | ||
|
||
jobs: | ||
setup-job: | ||
runs-on: ubuntu-20.04 | ||
|
||
if: github.repository == 'bcgov/sbc-common-components' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: "true" | ||
|
||
linting: | ||
needs: setup-job | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: | | ||
make setup | ||
- name: Linting | ||
run: | | ||
make lint | ||
testing-coverage: | ||
needs: setup-job | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: | | ||
make setup | ||
- name: Test with Jest | ||
id: test | ||
run: | | ||
make test | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
flags: sbccommoncomponentsweb | ||
name: codecov-vue | ||
fail_ci_if_error: true | ||
|
||
build-check: | ||
needs: setup-job | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: | | ||
make setup | ||
- run: npm run build --if-present | ||
working-directory: ./vue/sbc-common-components/ |
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,39 @@ | ||
codecov: | ||
require_ci_to_pass: true | ||
branch: master | ||
max_report_age: false | ||
|
||
coverage: | ||
precision: 2 | ||
round: down | ||
range: "5...100" | ||
status: | ||
patch: false | ||
project: | ||
default: false | ||
ui: | ||
target: 5% | ||
flags: | ||
- sbccommoncomponentsweb | ||
|
||
ignore: | ||
- "^/tests/**/*" # ignore test harness code | ||
|
||
parsers: | ||
gcov: | ||
branch_detection: | ||
conditional: true | ||
loop: true | ||
method: false | ||
macro: false | ||
|
||
comment: | ||
layout: "diff,flags,tree" | ||
behavior: default | ||
require_changes: true | ||
|
||
flags: | ||
sbccommoncomponentsweb: | ||
paths: | ||
- vue/sbc-common-components/src | ||
carryforward: true |
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,2 @@ | ||
**/node_modules | ||
**/dist |
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,48 @@ | ||
.PHONY: setup | ||
.PHONY: ci cd | ||
|
||
PROJECT_NAME:=sbc-common-components-web | ||
DOCKER_NAME:=sbc-common-components-web | ||
|
||
################################################################################# | ||
# COMMANDS -- Setup | ||
# expects the terminal to be openshift login | ||
# expects export OPENSHIFT_REPOSITORY="" | ||
################################################################################# | ||
setup: ## Clean and Install npm dependencies | ||
npm ci | ||
|
||
create-env: ## create the configration files from dev | ||
@oc get configmap $(DOCKER_NAME)-dev-keycloak-config -n "$(OPENSHIFT_REPOSITORY)-dev" \ | ||
-o json | jq -r '.data["keycloak.json"]' > ./public/config/kc/keycloak.json.dev | ||
@oc get configmap $(DOCKER_NAME)-dev-ui-configuration -n "$(OPENSHIFT_REPOSITORY)-dev" \ | ||
-o json | jq -r '.data["configuration.json"]' > ./public/config/configuration.json.dev | ||
|
||
################################################################################# | ||
# COMMANDS - CI # | ||
################################################################################# | ||
ci: lint test | ||
|
||
lint: ## Run linting ofcode. | ||
npm run lint | ||
|
||
test: ## Unit testing | ||
npm run test:unit | ||
|
||
build: ## Build the docker container | ||
docker build . -t $(DOCKER_NAME) \ | ||
--build-arg VCS_REF=$(shell git rev-parse --short HEAD) \ | ||
--build-arg BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \ | ||
|
||
build-nc: ## Build the docker container without caching | ||
docker build --no-cache -t $(DOCKER_NAME) . | ||
|
||
################################################################################# | ||
# Self Documenting Commands # | ||
################################################################################# | ||
.PHONY: help | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
Oops, something went wrong.