From 967cd80f8dd53ff6ef83fb52ff2ebdd6d70e3fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Beauvais?= Date: Fri, 25 Oct 2024 12:23:48 -0700 Subject: [PATCH] - deleted obsolete Makefile (#754) - app version = 5.13.0 - added scripts to package.json - updated CD script - updated CI script Co-authored-by: Severin Beauvais --- .github/workflows/cd.yml | 23 +++++------- .github/workflows/ci.yml | 80 +++++----------------------------------- Makefile | 77 -------------------------------------- package-lock.json | 4 +- package.json | 10 +++-- 5 files changed, 29 insertions(+), 165 deletions(-) delete mode 100644 Makefile diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 27bd413e4..106fefaee 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,13 +1,15 @@ -name: BUSINESS CREATE UI CD +name: Business Create UI CD on: push: branches: - main + - feature* + - hotfix* workflow_dispatch: inputs: - environment: - description: "Environment" + target: + description: "Deploy To" required: true type: choice options: @@ -15,18 +17,13 @@ on: - test - sandbox - prod - tagname: - description: "Specify a previous version (git tag) to deploy" - required: false - default: "" jobs: business-create-ui-cd: - uses: bcgov/bcregistry-sre/.github/workflows/ui-cd-node20.yaml@main + uses: bcgov/bcregistry-sre/.github/workflows/frontend-cd.yaml@main with: - environment: ${{ inputs.environment }} - tagname: ${{ inputs.tagname }} + target: ${{ inputs.target }} + app_name: "business-create-ui" secrets: - APP_NAME: "business-create" - OP_CONNECT_URL: ${{ secrets.OP_CONNECT_URL }} - OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }} + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a7476b04..f48d50d25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,79 +1,19 @@ -name: BUSINESS CREATE UI CI +name: Business Create UI CI on: pull_request: - types: [assigned, synchronize] + branches: + - main + - feature* + workflow_dispatch: defaults: run: shell: bash jobs: - setup-job: - runs-on: ubuntu-20.04 - - if: github.repository == 'bcgov/business-create-ui' - - steps: - - uses: actions/checkout@v3 - - run: "true" - - linting: - needs: setup-job - runs-on: ubuntu-20.04 - - strategy: - matrix: - node-version: [20.5.1] - - steps: - - uses: actions/checkout@v3 - - 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: [20.5.1] - - steps: - - uses: actions/checkout@v3 - - 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 Vitest - id: test - run: | - make test - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - name: codecov-business-create - fail_ci_if_error: false - token: ${{ secrets.CODECOV_TOKEN }} - - build-check: - needs: setup-job - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - - name: build to check strictness - id: build - run: | - make build-nc + business-create-ui-ci: + uses: bcgov/bcregistry-sre/.github/workflows/frontend-ci.yaml@main + with: + node_version: "20.5.1" + app_name: "business-create-ui" diff --git a/Makefile b/Makefile deleted file mode 100644 index 7f4180c79..000000000 --- a/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -.PHONY: setup -.PHONY: ci cd - -PROJECT_NAME=business-create -DOCKER_NAME=business-create - -################################################################################# -# COMMANDS -- Setup -# expects the terminal to be openshift login -# expects export OPENSHIFT_REPOSITORY="" -################################################################################# -setup: ## Clean and Install npm dependencies - npm ci - -################################################################################# -# COMMANDS - CI # -################################################################################# -ci: lint test - -lint: ## Run linting ofcode. - npm run lint - -test: ## Unit testing - npm run test:unit - -################################################################################# -# COMMANDS - CD -# expects the terminal to be openshift login -# expects export OPENSHIFT_DOCKER_REGISTRY="" -# expects export OPENSHIFT_SA_NAME="$(oc whoami)" -# expects export OPENSHIFT_SA_TOKEN="$(oc whoami -t)" -# expects export OPENSHIFT_REPOSITORY="" -# expects export TAG_NAME="dev/test" -################################################################################# -cd: ## CD flow -ifeq ($(TAG_NAME), test) -BUILD_TAG_NAME=test-latest -cd: build tag -else ifeq ($(TAG_NAME), prod) -BUILD_TAG_NAME=prod-latest -cd: build tag-production -else -BUILD_TAG_NAME=dev-latest -TAG_NAME=dev -cd: build tag -endif - -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) . - -REGISTRY_IMAGE=$(OPENSHIFT_DOCKER_REGISTRY)/$(OPENSHIFT_REPOSITORY)-tools/$(DOCKER_NAME) -push: #build ## Push the docker container to the registry & tag latest - @echo "$(OPENSHIFT_SA_TOKEN)" | docker login $(OPENSHIFT_DOCKER_REGISTRY) -u $(OPENSHIFT_SA_NAME) --password-stdin ;\ - docker tag $(DOCKER_NAME) $(REGISTRY_IMAGE):$(BUILD_TAG_NAME) ;\ - docker push $(REGISTRY_IMAGE):$(BUILD_TAG_NAME) - -tag: push ## tag image - oc -n "$(OPENSHIFT_REPOSITORY)-tools" tag $(DOCKER_NAME):$(BUILD_TAG_NAME) $(DOCKER_NAME):$(TAG_NAME) - -tag-production: push ## tag image - oc -n "$(OPENSHIFT_REPOSITORY)-tools" tag $(DOCKER_NAME):$(TAG_NAME) $(DOCKER_NAME):$(TAG_NAME)-$(shell date +%F) ;\ - oc -n "$(OPENSHIFT_REPOSITORY)-tools" tag $(DOCKER_NAME):$(BUILD_TAG_NAME) $(DOCKER_NAME):$(TAG_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}' diff --git a/package-lock.json b/package-lock.json index 6db0205f8..0ce4bbe00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.12.11", + "version": "5.13.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.12.11", + "version": "5.13.0", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.1.3", diff --git a/package.json b/package.json index e348e7333..33a8c934e 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,19 @@ { "name": "business-create-ui", - "version": "5.12.11", + "version": "5.13.0", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components", "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview", - "lint": "eslint . --ext .js,.ts,.vue", + "build-check": "vite build", + "preview": "vite preview --port 8080", + "lint": "eslint . --ext js,ts,vue --no-fix", + "lint:fix": "eslint . --ext js,ts,vue --fix src", + "test": "vitest run", "test:unit": "vitest run", + "test:watch": "vitest watch", "test:coverage": "vitest run --coverage" }, "dependencies": {