Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#38): running ci checks #54

Merged
merged 14 commits into from
Jan 9, 2022
223 changes: 134 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
branches: [develop]
push:
branches: [develop]
env:
DCK_USER: ${{ secrets.DOCKERHUB_USERNAME }}
DCK_PWD: ${{ secrets.DOCKERHUB_TOKEN }}
jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -45,92 +48,134 @@ jobs:
- run: npm run test
env:
CI: true
Build:
runs-on: ubuntu-latest
outputs:
initfile: ${{ steps.passinit.output.content }}
needs: [test]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx
- name: Build Frontend
id: app-docker_build
uses: docker/build-push-action@v2
with:
context: ./app
push: true
tags: dukematsci/dev-app:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build Restful Service
id: restuful-docker_build
uses: docker/build-push-action@v2
with:
context: ./restfulservice
push: true
tags: dukematsci/dev-restful:latest
- name: Build Proxy
id: proxy-docker_build
uses: docker/build-push-action@v2
with:
context: ./nginx
push: true
tags: dukematsci/dev-proxy:latest
- name: Copy Init Shell
id: passinit
run: |
cd mockDB
echo ::set-output name=content::$(cat mongo-init.sh)
testBuild:
runs-on: ubuntu-latest
env:
MONGO_INITDB_ROOT_USERNAME: ${{secrets.MM_MONGO_USER}}
MONGO_INITDB_ROOT_PASSWORD: ${{secrets.MM_MONGO_PWD}}
MONGO_DEVS: ${{secrets.MONGO_TEST}}
MONGO_DEV_PWD: ${{secrets.MONGO_TEST_PWD}}
MM_DB: ${{secrets.MM_DB}}
needs: [build]
if: github.event_name == 'push'
steps:
- name: Get Init
run: |
cd /
echo ${{ needs.build.output.initfile }} >> mongo-init.sh
chmod +x mongo-init.sh
services:
mongo:
image: mongo:4.4
ports:
- '27017:27017'
volumes:
- ./mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh
proxy:
image: dukematsci/dev-proxy:latest
ports:
- '80:80'
api:
image: dukematsci/dev-restful:latest
env:
DB_USERNAME: ${MONGO_DEVS}
DB_PASSWORD: ${MONGO_DEV_PWD}
client:
image: dukematsci/dev-app:latest
# BuildFrontend:
# needs: [test]
# uses: Duke-MatSci/materialsmine/.github/workflows/builder.yml@v1
# with:
# id: app
# context: ./app
# tags: dukematsci/dev-app:latest
# secrets:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# BuildRESTFUL:
# needs: [test]
# uses: Duke-MatSci/materialsmine/.github/workflows/builder.yml@v1
# with:
# id: restful
# context: ./restfulservice
# tags: dukematsci/dev-restful:latest
# secrets:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# BuildProxy:
# needs: [test]
# uses: Duke-MatSci/materialsmine/.github/workflows/builder.yml@v1
# with:
# id: proxy
# context: ./nginx
# tags: dukematsci/dev-proxy:latest
# secrets:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# TestBuild:
# if: github.event_name == 'push'
# runs-on: ubuntu-latest
# needs: [BuildFrontend,BuildRESTFUL,BuildProxy]
# steps:
# - name: Status
# run : pwd
# Build:
# runs-on: ubuntu-latest
# outputs:
# initfile: ${{ steps.passinit.output.content }}
# needs: [test]
# # if: github.event_name == 'push'
# steps:
# - uses: actions/checkout@v2
# - name: Set up Docker Buildx
# id: buildx
# uses: docker/setup-buildx-action@v1
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-single-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-single-buildx
# - name: Build Frontend
# id: app-docker_build
# uses: docker/build-push-action@v2
# with:
# context: ./app
# push: true
# tags: dukematsci/dev-app:latest
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new
# - name: Build Restful Service
# needs: [steps.app-docker_build]
# id: restuful-docker_build
# uses: docker/build-push-action@v2
# with:
# context: ./restfulservice
# push: true
# tags: dukematsci/dev-restful:latest
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new
# - name: Build Proxy
# id: proxy-docker_build
# uses: docker/build-push-action@v2
# with:
# context: ./nginx
# push: true
# tags: dukematsci/dev-proxy:latest
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new
# - name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# - name: Copy Init Shell
# id: passinit
# run: |
# cd mockDB
# echo ::set-output name=content::$(cat mongo-init.sh)
# testBuild:
# runs-on: ubuntu-latest
# env:
# MONGO_INITDB_ROOT_USERNAME: ${{secrets.MM_MONGO_USER}}
# MONGO_INITDB_ROOT_PASSWORD: ${{secrets.MM_MONGO_PWD}}
# MONGO_DEVS: ${{secrets.MONGO_TEST}}
# MONGO_DEV_PWD: ${{secrets.MONGO_TEST_PWD}}
# MM_DB: ${{secrets.MM_DB}}
# needs: [build]
# if: github.event_name == 'push'
# steps:
# - name: Get Init
# run: |
# cd /
# echo ${{ needs.build.output.initfile }} >> mongo-init.sh
# chmod +x mongo-init.sh
# services:
# mongo:
# image: mongo:4.4
# ports:
# - '27017:27017'
# volumes:
# - ./mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh
# proxy:
# image: dukematsci/dev-proxy:latest
# ports:
# - '80:80'
# api:
# image: dukematsci/dev-restful:latest
# env:
# DB_USERNAME: ${MONGO_DEVS}
# DB_PASSWORD: ${MONGO_DEV_PWD}
# client:
# image: dukematsci/dev-app:latest
3 changes: 2 additions & 1 deletion resfulservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"start": "nodemon src/server.js",
"test": "echo \"Error: no test specified\" && exit 0",
"lint": "eslint src",
"lint:test": "npm-run-all -s lint test"
"lint:test": "npm-run-all -s lint test",
"start:prod": "node src/server.js"
},
"repository": {
"type": "git",
Expand Down