Skip to content

Commit

Permalink
Merge pull request #19 from Multiwoven/feat/server-actions
Browse files Browse the repository at this point in the history
feat: move server and ui github action ci to root
  • Loading branch information
subintp authored Apr 7, 2024
2 parents 85fc3d0 + 2362a30 commit 20725bb
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 157 deletions.
File renamed without changes.
56 changes: 56 additions & 0 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: server-ci

on:
push:
branches: [main]
paths:
- "server/**"
pull_request:
branches: [main]
paths:
- "server/**"

env:
DB_HOST: localhost
DB_USERNAME: postgres
DB_PASSWORD: postgres

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: multiwoven_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.0

- name: Bundle Install
run: bundle install
working-directory: ./server

- name: Database Setup
run: bundle exec rake db:create db:schema:load --trace
working-directory: ./server

- name: Run RuboCop
run: bundle exec rubocop
working-directory: ./server

- name: Run Tests
run: bundle exec rspec
working-directory: ./server
29 changes: 29 additions & 0 deletions .github/workflows/server-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: server-docker-build

on:
workflow_run:
workflows: ["server-ci"]
branches: [main]
types:
- completed

env:
IMAGE_NAME: multiwoven/multiwoven-server
IMAGE_TAG: latest-main

jobs:
build_and_push:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin

- name: Build and Push Docker image
run: |
docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -t ${{ env.IMAGE_NAME }}:${{ github.sha }} -f server/Dockerfile ./server
docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
26 changes: 26 additions & 0 deletions .github/workflows/ui-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: frontend-ci

on:
pull_request:
paths:
- "ui/**"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
run: npm install
working-directory: ./ui

- name: Run tests and collect coverage
run: npm test -- --coverage
working-directory: ./ui
29 changes: 29 additions & 0 deletions .github/workflows/ui-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: frontend-docker-build

on:
workflow_run:
workflows: ["frontend-ci"]
branches: [main]
types:
- completed

env:
IMAGE_NAME: multiwoven/multiwoven-ui
IMAGE_TAG: latest-main

jobs:
build_and_push:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin

- name: Build and Push Docker image
run: |
docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -t ${{ env.IMAGE_NAME }}:${{ github.sha }} -f ui/Dockerfile ./ui
docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: Validate Workflow
name: UI - Validate Workflow

on:
push:
branches:
- main
paths:
- "ui/**"
pull_request:
branches:
- develop
- main
paths:
- "ui/**"

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -17,11 +22,16 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
node-version: "18"

- name: Install dependencies
run: npm install
working-directory: ./ui

- name: Build Source Code
run: npm run build
working-directory: ./ui

- name: Lint Source Code
run: npm run lint
working-directory: ./ui
62 changes: 0 additions & 62 deletions server/.github/workflows/ci.yml

This file was deleted.

29 changes: 0 additions & 29 deletions server/.github/workflows/docker-build.yml

This file was deleted.

34 changes: 0 additions & 34 deletions ui/.github/workflows/ci.yml

This file was deleted.

29 changes: 0 additions & 29 deletions ui/.github/workflows/docker-build.yml

This file was deleted.

0 comments on commit 20725bb

Please sign in to comment.