BREAKING CHANGES: Merge pull request #507 from Duke-MatSci/develop #152
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
name: Production CI | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
jobs: | |
appTest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Use NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '17.9.1' | |
- name: Install frontend dependencies & test | |
run: | | |
cd app | |
npm ci | |
- name: App Coverage Test | |
run: | | |
cd app | |
npm run test:unit -- --coverage | |
env: | |
CI: true | |
- name: Zip Frontend App Assets | |
if: github.event_name == 'push' | |
run: | | |
zip -r app-test-coverage-report.zip app/coverage && rm -rf app/coverage && zip -r app-src_code.zip ./app | |
mkdir app_asset_artifacts && mv app-src_code.zip app_asset_artifacts && mv app-test-coverage-report.zip app_asset_artifacts | |
- name: Upload App Assets | |
if: github.event_name == 'push' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-assets | |
path: app_asset_artifacts | |
restfulServiceTest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Use NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '17.9.1' | |
- name: Install frontend dependencies & test | |
run: | | |
cd resfulservice | |
npm install | |
- name: Backend Coverage Test | |
run: | | |
cd resfulservice | |
npm run test | |
env: | |
CI: true | |
- name: Zip Backend Assets | |
if: github.event_name == 'push' | |
run: | | |
zip -r backend-test-coverage-report.zip resfulservice/coverage && rm -rf resfulservice/coverage && zip -r backend-src_code.zip ./resfulservice | |
mkdir backend_asset_artifacts && mv backend-src_code.zip backend_asset_artifacts && mv backend-test-coverage-report.zip backend_asset_artifacts | |
- name: Upload Backend Assets | |
if: github.event_name == 'push' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: backend-assets | |
path: backend_asset_artifacts | |
release: | |
needs: [appTest, restfulServiceTest] | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Use NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.4.0' | |
- name: Install root | |
run: npm install | |
- name: Download Asset Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Create prod release | |
id: version | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
version_output: ${{ steps.version.outputs.nextVer }} | |
buildFrontendApp: | |
needs: [release] | |
uses: Duke-MatSci/materialsmine/.github/workflows/prodBuilder.yml@main | |
with: | |
myid: app | |
context: ./app | |
tags: dukematsci/prod-app | |
next_ver: ${{ needs.release.outputs.version_output}} | |
secrets: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
buildBackendApp: | |
if: github.event_name == 'push' | |
needs: [buildFrontendApp, release] | |
uses: Duke-MatSci/materialsmine/.github/workflows/prodBuilder.yml@main | |
with: | |
myid: restful | |
context: ./resfulservice | |
tags: dukematsci/prod-restful | |
next_ver: ${{ needs.release.outputs.version_output}} | |
secrets: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
buildMgdServicesApp: | |
if: github.event_name == 'push' | |
needs: release | |
uses: Duke-MatSci/materialsmine/.github/workflows/prodBuilder.yml@main | |
with: | |
myid: mserv | |
context: ./services | |
tags: dukematsci/prod-mserv | |
next_ver: ${{ needs.release.outputs.version_output}} | |
secrets: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
buildWhyisApp: | |
if: github.event_name == 'push' | |
needs: release | |
uses: Duke-MatSci/materialsmine/.github/workflows/prodBuilder.yml@main | |
with: | |
myid: kgapp | |
context: ./whyis | |
tags: dukematsci/prod-kgapp | |
next_ver: ${{ needs.release.outputs.version_output}} | |
secrets: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
testBuilds: | |
runs-on: ubuntu-latest | |
needs: | |
[buildFrontendApp, buildBackendApp, buildMgdServicesApp, buildWhyisApp] | |
env: | |
MM_MONGO_USER: ${{secrets.MM_MONGO_USER}} | |
MM_MONGO_PWD: ${{secrets.MM_MONGO_PWD}} | |
MONGO_TEST: ${{secrets.MONGO_TEST}} | |
MONGO_TEST_PWD: ${{secrets.MONGO_TEST_PWD}} | |
MM_DB: ${{secrets.MM_DB}} | |
MONGO_ADDRESS: ${{secrets.MONGO_ADDRESS}} | |
MONGO_PORT: ${{secrets.MONGO_PORT}} | |
NM_MONGO_DUMP: ${{secrets.NM_MONGO_DUMP}} | |
TKNS: ${{secrets.TKNS}} | |
MINIO_ROOT_USER: ${{secrets.MINIO_ROOT_USER}} | |
MINIO_ROOT_PASSWORD: ${{secrets.MINIO_ROOT_PASSWORD}} | |
PROXY_PORT: ${{secrets.PROXY_PORT}} | |
MINIO_PORT: ${{secrets.MINIO}} | |
ES_PORT: ${{secrets.ES_PORT}} | |
PORT: ${{secrets.PORT}} | |
CLIENT_PORT: ${{secrets.CLIENT_PORT}} | |
KG_PORT: ${{secrets.KG_PORT}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download and run images | |
run: docker-compose -f docker-compose.test.git.yml up -d | |
- name: Kill containers | |
run: docker-compose down -v |