Skip to content

Commit

Permalink
Merge pull request #51 from modusbox/mbp-315
Browse files Browse the repository at this point in the history
feat: Apply typescript-svc-template to repo
- https://modusbox.atlassian.net/browse/MBP-315
  • Loading branch information
gibaros authored Jun 16, 2022
2 parents 02c8679 + 0dacc37 commit 102be3c
Show file tree
Hide file tree
Showing 225 changed files with 19,801 additions and 10,060 deletions.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions .github/workflows/prLintTitleWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint PR Title Check

on:
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/prWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PR Checks

on:
pull_request:
branches: [ main ]

##
# Re-usable workflows can be found at https://github.com/modusbox/github-actions-node
##

jobs:
test_lint:
uses: modusbox/github-actions-node/.github/workflows/testLintJob.yml@v0.0.4

test_dependencies:
uses: modusbox/github-actions-node/.github/workflows/testDependencyJob.yml@v0.0.4

test_audit:
uses: modusbox/github-actions-node/.github/workflows/testAuditJob.yml@v0.0.4

test_license:
uses: modusbox/github-actions-node/.github/workflows/testLicenseJob.yml@v0.0.4

# TODO: Uncomment if unit tests added
# test_unit:
# uses: modusbox/github-actions-node/.github/workflows/testUnitJob.yml@v0.0.4

# TODO: Test coverage applies to unit tests and since there is none is commentted out
# test_coverage:
# uses: modusbox/github-actions-node/.github/workflows/testCoverageJob.yml@v0.0.4

test_int:
uses: modusbox/github-actions-node/.github/workflows/testIntJob.yml@v0.0.4

test_func:
uses: ./.github/workflows/testFuncJob.yml
95 changes: 0 additions & 95 deletions .github/workflows/publish_docker.yml

This file was deleted.

107 changes: 107 additions & 0 deletions .github/workflows/releaseWorkflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Create Tagged Release

on:
push:
branches:
- main

##
# Re-usable workflows can be found at https://github.com/modusbox/github-actions-node
##

jobs:
test_lint:
uses: modusbox/github-actions-node/.github/workflows/testLintJob.yml@v0.0.4

test_dependencies:
uses: modusbox/github-actions-node/.github/workflows/testDependencyJob.yml@v0.0.4

test_audit:
uses: modusbox/github-actions-node/.github/workflows/testAuditJob.yml@v0.0.4

test_license:
uses: modusbox/github-actions-node/.github/workflows/testLicenseJob.yml@v0.0.4

# TODO: Enable when there are unit tests
# test_unit:
# uses: modusbox/github-actions-node/.github/workflows/testUnitJob.yml@v0.0.4

# TODO: Enable when there is coveragte for unit tests
# test_coverage:
# uses: modusbox/github-actions-node/.github/workflows/testCoverageJob.yml@v0.0.4

test_int:
uses: modusbox/github-actions-node/.github/workflows/testIntJob.yml@v0.0.4

test_func:
uses: ./.github/workflows/testFuncJob.yml

release_tag:
needs:
- test_lint
- test_dependencies
- test_audit
- test_license
# - test_unit
# - test_coverage
- test_int
- test_func
uses: modusbox/github-actions-node/.github/workflows/createReleaseTagJob.yml@v0.0.2
secrets:
GIT_KEY: ${{ secrets.PSO_GIT_KEY }}
GIT_USER: ${{ secrets.PSO_GIT_USER }}
GIT_EMAIL: ${{ secrets.PSO_GIT_EMAIL }}

release_gh:
needs:
- release_tag
uses: modusbox/github-actions-node/.github/workflows/createReleaseGHJob.yml@v0.0.2
with:
RELEASE_VERSION: v${{ needs.release_tag.outputs.VERSION }}
RELEASE_CHANGE_ARTEFACT: ${{ needs.release_tag.outputs.RELEASE_CHANGE_ARTEFACT }}
RELEASE_CHANGE_FILENAME: ${{ needs.release_tag.outputs.RELEASE_CHANGE_FILENAME }}
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# ATTENTION: Choose this when you are building a service. Comment-out/Remove if not needed!
publish_image:
needs:
- release_tag
- release_gh
uses: modusbox/github-actions-node/.github/workflows/publishImageJob.yml@v0.0.2
with:
RELEASE_VERSION: v${{ needs.release_tag.outputs.VERSION }}
RELEASE_URL: ${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ needs.release_tag.outputs.VERSION }}
secrets:
USER: ${{ github.actor }}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}

# ATTENTION: Choose this when you are creating a NPM library
# Commentted out as this repo is no creating a NPM library
# publish_lib:
# needs:
# - release_tag
# - release_gh
# uses: modusbox/github-actions-node/.github/workflows/publishLibraryJob.yml@v0.0.2
# with:
# RELEASE_VERSION: v${{ needs.release_tag.outputs.VERSION }}
# secrets:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

notify:
needs:
- release_tag
- release_gh
# ATTENTION: Choose 'publish_image' or/and 'publish_lib' depending on the type of project. Comment-out/Remove if not needed!
- publish_image
# - publish_lib
if: ${{ always() }} # Here we report on the final state of the workflow!
uses: modusbox/github-actions-node/.github/workflows/notifyReleaseJob.yml@v0.0.2
with:
JOB_STATUS: ${{ ((needs.release_tag.result == 'success') && (needs.release_gh.result == 'success') && (needs.publish_image.result == 'success') && (needs.publish_lib.result == 'success')) && 'success' || 'failed' }}
TYPE: Release
RELEASE_VERSION: ${{ ((needs.release_tag.result == 'success') && (needs.release_gh.result == 'success') && (needs.publish_image.result == 'success') && (needs.publish_lib.result == 'success')) && format('v{0}', needs.release_tag.outputs.VERSION) || 'n/a' }}
RELEASE_URL: ${{ ((needs.release_tag.result == 'success') && (needs.release_gh.result == 'success') && (needs.publish_image.result == 'success') && (needs.publish_lib.result == 'success')) && format('{0} {1}/{2}/releases/tag/v{3}', ':shipit:', github.server_url, github.repository, needs.release_tag.outputs.VERSION) || ':fire:' }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANEL: ${{ secrets.SLACK_CHANNEL_PSO_RELEASE }}
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
name: build-and-test
name: Run Local Test Functional Job

on:
pull_request: {}
push:
branches:
- main

workflow_call: {}

env:
IMAGE_NAME: ${{github.event.repository.name}}
IMAGE_TAG: ${{ github.sha }}
APP_WORK_DIRECTORY: server
APP_WORK_DIRECTORY: .
APP_CACHE_NAME: cache-app-node-modules
APP_SCRIPT_DIRECTORY: scripts
TEST_FUNC_WORK_DIRECTORY: functional-tests
TEST_FUNC_WORK_DIRECTORY: test/functional-tests
NODE_VERSION: lts/*

jobs:

build-node:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -47,7 +45,7 @@ jobs:
- name: Build and export
uses: docker/build-push-action@v2
with:
context: ./server
context: .
tags: ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}
outputs: type=docker,dest=/tmp/${{env.IMAGE_NAME}}.tar
- name: Upload artifact
Expand All @@ -56,41 +54,7 @@ jobs:
name: ${{env.IMAGE_NAME}}-${{env.IMAGE_TAG}}
path: /tmp/${{env.IMAGE_NAME}}.tar

test-integration:
runs-on: ubuntu-latest
needs:
- build-node
steps:
# Setup
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install node
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
cache: npm
cache-dependency-path: ${{env.APP_WORK_DIRECTORY}}/package-lock.json
- name: Install App dependencies
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: npm i

# Actions
- name: Start backends
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: npm run start:backend

- name: Validate Integration Tests
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: npm test

# Cleanup
- name: Stop backends
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: npm run stop:backend

test-functional:
test_func:
runs-on: ubuntu-latest
needs:
- build-node
Expand Down Expand Up @@ -125,14 +89,13 @@ jobs:
# Actions
- name: Start backends
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: npm run start:backend
run: npm run backend:start

- name: Start App
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: |
VAULT_DIR="`pwd`/.vault"
docker run --net=host -d --rm --name ${{env.IMAGE_NAME}} --env-file ../docker/functional-tests.env -v $VAULT_DIR:/tmp/vault ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}
docker run --net=host -d --rm --name ${{env.IMAGE_NAME}} --env-file ./docker/functional-tests.env -v $VAULT_DIR:/tmp/vault ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}
- name: Wait for App
uses: cygnetdigital/wait_for_response@v2.0.0
with:
Expand Down Expand Up @@ -169,8 +132,8 @@ jobs:

- name: Stop backends
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: npm run stop:backend
run: npm run backend:stop

- name: Stop App
working-directory: ${{env.APP_WORK_DIRECTORY}}
run: docker stop ${{env.IMAGE_NAME}}
run: docker stop ${{env.IMAGE_NAME}}
15 changes: 0 additions & 15 deletions .github/workflows/validate-kustomize.yaml

This file was deleted.

Loading

0 comments on commit 102be3c

Please sign in to comment.