Skip to content

Commit

Permalink
feat: use 'ci' option to npm in pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeCap08055 committed Jul 25, 2024
1 parent fca5f62 commit e2b445f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/common/openapi-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,20 @@ runs:
node-version: 20

- name: Install dependencies
run: npm ci
run: make npm-${{ inputs.service }}
shell: bash
working-directory: ./services/${{ inputs.service }}

- name: Generate Swagger Metadata
run: npm run build:metadata
run: make metadata-${{ inputs.service }}
shell: bash
working-directory: ./services/${{ inputs.service }}

- name: Generate OpenAPI/Swagger JSON
run: npm run build:swagger
run: make openapi-${{ inputs.service }}
shell: bash
working-directory: ./services/${{ inputs.service }}

- name: Generate OpenAPI/Swagger UI
run: npm run generate-swagger-ui
run: make swagger-${{ inputs.service }}
shell: bash
working-directory: ./services/${{ inputs.service }}

- name: Copy OpenAPI Spec (index.html) to root docs directory
run: cp ./services/${{ inputs.service }}/docs/index.html ./docs/${{ inputs.service }}/
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SERVICES := $(shell (cd services ; ls))

NPM_TARGETS=$(SERVICES:%=npm-%)
NPM_TARGETS:=$(SERVICES:%=npm-%)
NPM_UPDATE_TARGETS:=$(SERVICES:%=npm-update-%)
BUILD_TARGETS=$(SERVICES:%=build-%)
METADATA_TARGETS=$(SERVICES:%=metadata-%)
OPENAPI_TARGETS=$(SERVICES:%=openapi-%)
Expand All @@ -16,6 +17,7 @@ DOCKER_BUILD_TARGETS=$(SERVICES:%=docker-build-%)
.PHONY: build test test-e2e lint format docker-build $(BUILD_TARGETS) $(TEST_TARGETS) $(E2E_TARGETS) $(LINT_TARGETS) $(FORMAT_TARGETS) $(DOCKER_BUILD_TARGETS)

deps: $(NPM_TARGETS)
update-packages: $(NPM_UPDATE_TARGETS)
build: $(BUILD_TARGETS)
generate-metadata: $(METADATA_TARGETS)
generate-openapi: $(OPENAPI_TARGETS)
Expand All @@ -28,7 +30,11 @@ format: $(FORMAT_TARGETS)
docker-build: $(DOCKER_BUILD_TARGETS)

$(NPM_TARGETS):
( cd services/$(@:npm-%=%) ; npm i )
@( cd services/$(@:npm-%=%) ; npm ci )

# $(NPM_TARGETS:npm-%=npm-update-%):
$(NPM_UPDATE_TARGETS):
@( cd services/$(@:npm-update-%=%) ; npm i )

$(BUILD_TARGETS): build-%: npm-%
@( cd services/$(@:build-%=%) ; npm run build )
Expand Down

0 comments on commit e2b445f

Please sign in to comment.