Skip to content

Feature/add ci pipelines #86

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

Open
wants to merge 1 commit into
base: Release-0.0.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build

on:
workflow_call:

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Get version from package.json
id: package-version
run: |
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
echo "Project Version: $VERSION"

- name: Cache node_modules
uses: actions/cache@v3
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm clean-install

- name: Cache build frontend
uses: actions/cache@v3
id: cache-build-frontend
with:
path: apps/frontend
key: ${{ runner.os }}-frontend-${{ github.sha }}

- name: Run build production application
run: npm run frontend:build

- name: Cache build backend
uses: actions/cache@v3
id: cache-build-backend
with:
path: apps/backend
key: ${{ runner.os }}-backend-${{ github.sha }}

- name: Run build backend server
run: npm run backend:build
51 changes: 5 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,12 @@ env:
CI: false

jobs:
test:
uses: ./.github/workflows/test.yml

build:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Get version from package.json
id: package-version
run: |
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
echo "Project Version: $VERSION"

- name: Cache node_modules
uses: actions/cache@v3
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm clean-install

- name: Cache build frontend
uses: actions/cache@v3
id: cache-build-frontend
with:
path: apps/frontend
key: ${{ runner.os }}-frontend-${{ github.sha }}

- name: Run build production application
run: npm run frontend:build

- name: Cache build backend
uses: actions/cache@v3
id: cache-build-backend
with:
path: apps/backend
key: ${{ runner.os }}-backend-${{ github.sha }}

- name: Run build backend server
run: npm run backend:build
uses: ./.github/workflows/build.yml
needs: test

deploy:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ on:
workflow_dispatch:

jobs:
test:
uses: ./.github/workflows/test.yml

build:
name: Build image
runs-on: ubuntu-22.04
needs: test

steps:
- name: Set env variables
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Pull Request checks

on:
pull_request:

jobs:
build:
uses: ./.github/workflows/build.yml

test:
uses: ./.github/workflows/test.yml

37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Unit tests

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Get version from package.json
id: package-version
run: |
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
echo "Project Version: $VERSION"

- name: Cache node_modules
uses: actions/cache@v3
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm clean-install

- name: Run frontend unit tests
run: npm run frontend:test