Skip to content

User-service: Move all microservice code into src #139

User-service: Move all microservice code into src

User-service: Move all microservice code into src #139

Workflow file for this run

name: Pre-release build test
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2 # Use v2 of the action
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Create env file for userservice test
run: echo -e "${{ secrets.USER_SERVICE_TEST_ENV_FILE}}" > ./user-service/.env
- name: Build PostgreSQL Docker image
working-directory: ./user-service
run: |
docker build -f Dockerfile.postgres-db -t user-service-psql .
- name: Start PostgreSQL Docker container
working-directory: ./user-service
run: |
docker run -p 1111:5432 -e POSTGRES_PASSWORD=123 --name user-service-db -d user-service-psql
sleep 10
- name: Build and test user-service
working-directory: ./user-service
run: |
npm ci
npm run test
- name: Stop and remove PostgreSQL Docker container
run: |
docker stop user-service-db
docker rm user-service-db
- name: Build and test client
working-directory: ./client
run: |
npm ci
npm test
- name: Build and test question-service
working-directory: ./question-service
run: |
npm ci
npm test
- name: Build and test matching-service
working-directory: ./matching-service
run: |
npm ci
npm run test
- name: Build and test collaboration-service
working-directory: ./collaboration-service
run: |
npm ci
npm run test
- name: Prevent PR merge
if: github.event.pull_request.merged == 'true'
run: echo "This PR cannot be merged. Please make necessary changes."
- name: Set up pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GH_TOKEN }}"
automatic_release_tag: "pre-release"
prerelease: true
title: "Pre-release build"
# - name: Build Docker containers
# run: docker-compose -f docker-compose.yml build
# - name: Push Docker containers to Docker Hub
# run: docker-compose -f docker-compose.yml push
# - name: Generate deployment package
# run: zip -r deploy.zip . -x '*.git*'
# - name: Deploy to AWS Elastic Beanstalk
# uses: einaregilsson/beanstalk-deploy@v18
# with:
# aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
# aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
# application_name: multi-docker
# environment_name: Multi-docker-env
# existing_bucket_name: elasticbeanstalk-ap-southeast-1-332848504892
# region: ap-southeast-1
# version_label: ${{ github.sha }}
# deployment_package: deploy.zip