Skip to content

Merge Dev to Main

Merge Dev to Main #161

Workflow file for this run

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@v3
# 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: Setup Node.js 22 for frontend
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Enable pnpm for frontend
run: corepack enable && corepack prepare pnpm@latest --activate
- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('app/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install frontend dependencies
run: |
cd app
pnpm install --frozen-lockfile
env:
MM_GHT: ${{ secrets.MM_GHT }}
# - 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@v3
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@v3
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@v4
- 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 }}
MM_GHT: ${{ secrets.MM_GHT }}

Check failure on line 138 in .github/workflows/prodci.yml

View workflow run for this annotation

GitHub Actions / Production CI

Invalid workflow file

The workflow is not valid. .github/workflows/prodci.yml (Line: 138, Col: 15): Invalid secret, MM_GHT is not defined in the referenced workflow. .github/workflows/prodci.yml (Line: 139, Col: 16): Invalid secret, FE_PORT is not defined in the referenced workflow.
FE_PORT: ${{ secrets.FE_PORT }}
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