Develop #303
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: "OCWA" | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
types: | |
- opened | |
release: | |
types: ['created'] | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
QUAYIO_PASSWORD: ${{ secrets.QUAYIO_PASSWORD }} | |
QUAYIO_USERNAME: ${{ secrets.QUAYIO_USERNAME }} | |
MONGODB: 4.1.1 | |
HELM_TGZ: helm-v2.4.1-linux-amd64.tar.gz | |
HELM_URL: https://get.helm.sh | |
YAMLLINT_VERSION: 1.8.1 | |
jobs: | |
project_api: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: microservices/projectApi | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 11.15.0 | |
cache: 'npm' | |
cache-dependency-path: microservices/projectApi/package-lock.json | |
- name: install dependencies | |
run: npm ci | |
- name: test | |
run: | | |
cp config/test.json.example config/test.json | |
cp config/default.json.example config/default.json | |
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz | |
export PWD=$(pwd) | |
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz | |
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo projectDb --eval 'db.createUser({user:"projectUser", pwd:"projectPass", roles:["readWrite"]});' | |
npm test | |
- name: helm | |
run: | | |
wget -q ${HELM_URL}/${HELM_TGZ} | |
tar xzfv ${HELM_TGZ} | |
PATH=`pwd`/linux-amd64/:$PATH | |
sudo pip install yamllint=="${YAMLLINT_VERSION}" | |
helm lint ./helm/projectApi | |
- name: quayio_push | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_quayio_push ocwa_project_api | |
- name: deploy | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created') | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_push ocwa_project_api | |
request_api: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
defaults: | |
run: | |
shell: bash | |
working-directory: microservices/requestApi | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 11.15.0 | |
cache: 'npm' | |
cache-dependency-path: microservices/requestApi/package-lock.json | |
- name: install dependencies | |
run: npm ci | |
- name: test | |
run: | | |
wget -q https://dl.minio.io/server/minio/release/linux-amd64/minio | |
chmod +x minio | |
export MINIO_ACCESS_KEY="accesskey" | |
export MINIO_SECRET_KEY="secretkey" | |
mkdir ./tmp | |
./minio server ./tmp & | |
cp config/test.json.example config/test.json | |
cp config/default.json.example config/default.json | |
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz | |
export PWD=$(pwd) | |
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz | |
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo forumDb --eval 'db.createUser({user:"forumUser", pwd:"forumPass", roles:["dbAdmin", "readWrite"]});' | |
cd ../shared/js | |
npm ci | |
cd ../../formio | |
wget -q https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz | |
tar xzf mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz | |
./mongodb-database-tools-ubuntu2204-x86_64-100.8.0/bin/mongorestore -u forumUser -p forumPass -d forumDb db | |
git clone -b v1.90.15 https://github.com/formio/formio.git | |
cd formio | |
npm ci | |
cp ../default.json ./config/default.json | |
cp ../prompt.txt ./prompt.txt | |
npm start < prompt.txt & | |
cd ../.. | |
git clone https://github.com/bcgov/forum-api.git | |
cd forum-api | |
cp config/default.json.example config/default.json | |
cp config/test.json.example config/test.json | |
npm ci | |
NODE_ENV=test npm run serve & | |
cd ../validateApi | |
cp config/default.json.template config/default.json | |
pip3 install --upgrade -r requirements.txt | |
pip3 install -e . | |
python3.5 wsgi.py & | |
cd ../policyApi | |
cp config/default.json.template config/default.json | |
pip3 install --upgrade -r requirements.txt | |
pip3 install -e . | |
python3.5 wsgi.py & | |
cd ../requestApi | |
NODE_ENV=test npm start & | |
NODE_ENV=test npm test | |
- name: helm | |
run: | | |
wget -q ${HELM_URL}/${HELM_TGZ} | |
tar xzfv ${HELM_TGZ} | |
PATH=`pwd`/linux-amd64/:$PATH | |
sudo pip install yamllint=="${YAMLLINT_VERSION}" | |
helm lint ./helm/requestApi | |
- name: quayio_push | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_quayio_push ocwa_request_api | |
- name: deploy | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created') | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_push ocwa_request_api | |
policy_api: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: microservices/policyApi | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install dependencies | |
run: pip3 install --upgrade pip setuptools==58.0.0 | |
- name: test | |
run: | | |
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz | |
export PWD=$(pwd) | |
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz | |
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo projectDb --eval 'db.createUser({user:"projectUser", pwd:"projectPass", roles:["readWrite"]});' | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo forumDb --eval 'db.createUser({user:"forumUser", pwd:"forumPass", roles:["dbAdmin", "readWrite"]});' | |
cp ./config/default.json.template ./config/default.json | |
pip3 install -r requirements.txt | |
pip3 install -e . | |
coverage run --branch --source=db,v1 -m pytest | |
coverage xml | |
- name: helm | |
run: | | |
wget -q ${HELM_URL}/${HELM_TGZ} | |
tar xzfv ${HELM_TGZ} | |
PATH=`pwd`/linux-amd64/:$PATH | |
sudo pip install yamllint=="${YAMLLINT_VERSION}" | |
helm lint ./helm/policyApi | |
- name: quayio_push | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_quayio_push ocwa_policy_api | |
- name: deploy | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created') | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_push ocwa_policy_api | |
validation_api: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: microservices/validateApi | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install dependencies | |
run: pip3 install --upgrade pip setuptools==58.0.0 | |
- name: test | |
run: | | |
cd ../policyApi | |
pip3 install -r requirements.txt | |
pip3 install -e . | |
cp config/default.json.template config/default.json | |
python3 wsgi.py & | |
cd ../validateApi | |
wget -q http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz | |
export PWD=$(pwd) | |
tar xzf mongodb-linux-x86_64-${MONGODB}.tgz | |
mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo projectDb --eval 'db.createUser({user:"projectUser", pwd:"projectPass", roles:["readWrite"]});' | |
${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongo forumDb --eval 'db.createUser({user:"forumUser", pwd:"forumPass", roles:["dbAdmin", "readWrite"]});' | |
cp config/default.json.template config/default.json | |
pip3 install --upgrade -r requirements.txt | |
pip3 install -e . | |
coverage run --branch --source=db,v1 -m pytest | |
coverage xml | |
- name: helm | |
run: | | |
wget -q ${HELM_URL}/${HELM_TGZ} | |
tar xzfv ${HELM_TGZ} | |
PATH=`pwd`/linux-amd64/:$PATH | |
sudo pip install yamllint=="${YAMLLINT_VERSION}" | |
helm lint ./helm/validate-api | |
- name: quayio_push | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_quayio_push ocwa_validate_api | |
- name: deploy | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created') | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_push ocwa_validate_api | |
frontend: | |
needs: ["project_api", "request_api", "policy_api", "validation_api"] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: frontend | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 11.15.0 | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: install dependencies | |
run: npm ci | |
- name: test | |
run: | | |
cp config/default.json.example config/default.json | |
cp config/test.json.example config/test.json | |
npm test | |
- name: helm | |
run: | | |
wget -q ${HELM_URL}/${HELM_TGZ} | |
tar xzfv ${HELM_TGZ} | |
PATH=`pwd`/linux-amd64/:$PATH | |
sudo pip install yamllint=="${YAMLLINT_VERSION}" | |
helm lint ./helm/frontend | |
- name: quayio_push | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_quayio_push ocwa_frontend | |
- name: deploy | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'created') | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
bash docker_push ocwa_frontend |