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

UI/API: Create CI workflow triggered on PR #35

Merged
merged 8 commits into from
Oct 25, 2023
Merged
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
5 changes: 5 additions & 0 deletions .codecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
target: 80%
110 changes: 110 additions & 0 deletions .github/workflows/btr-api-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: BTR API CI

on:
pull_request:
types: [assigned, synchronize]
paths:
- "btr-api/**"

defaults:
run:
shell: bash
working-directory: ./btr-api

jobs:
lint:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install

- name: Run linters
run: |
poetry run pylint --rcfile=setup.cfg src/btr_api
poetry run flake8 src/btr_api

# unit-testing:
# env:
# DATABASE_TEST_USERNAME: postgres
# DATABASE_TEST_PASSWORD: postgres
# DATABASE_TEST_NAME: btr_test
# DATABASE_TEST_HOST: db
# DATABASE_TEST_PORT: 5432

# runs-on: ubuntu-20.04

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

# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.11

# - name: Install Poetry
# uses: snok/install-poetry@v1

# - name: Install dependencies
# run: poetry install

# - name: Update db
# run: |
# poetry run flask db upgrade
# poetry run flask db migrate

# - name: Run tests
# run: poetry run pytest --cov=./ --cov-report=xml

# - name: Check coverage
# run: poetry run coverage report --fail-under=80

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# file: ./btr-api/coverage.xml
# flags: btr-api
# name: codecov-btr-api
# fail_ci_if_error: false

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

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install

- name: Build the project
run: poetry build
186 changes: 186 additions & 0 deletions .github/workflows/btr-ui-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: BTR UI CI

on:
pull_request:
types: [assigned, synchronize]
paths:
- "btr-web/**"

defaults:
run:
shell: bash

jobs:
setup-job:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- run: "true"

linting:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
project: ["btr-main-app", "btr-common-components", "btr-layouts"]
fail-fast: false

defaults:
run:
working-directory: btr-web/${{ matrix.project }}

steps:
- uses: actions/checkout@v3

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

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Run linting
run: pnpm run lint


unit-testing:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
project: ["btr-main-app", "btr-common-components", "btr-layouts"]
fail-fast: false

defaults:
run:
working-directory: btr-web/${{ matrix.project }}

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Run unit tests
run: pnpm test:cov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./btr-web/btr-main-app/coverage/clover.xml
flags: btr-ui
name: codecov-btr-ui
fail_ci_if_error: false

cypress-e2e-test:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
project: ["btr-main-app", "btr-common-components", "btr-layouts"]
fail-fast: false

defaults:
run:
working-directory: btr-web/${{ matrix.project }}

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: btr-web/${{ matrix.project }}
build: pnpm run build
start: pnpm start

build-check:
kialj876 marked this conversation as resolved.
Show resolved Hide resolved
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
project: ["btr-main-app", "btr-common-components", "btr-layouts"]
fail-fast: false

defaults:
run:
working-directory: btr-web/${{ matrix.project }}

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Build Check
run: pnpm build

build-check-for-deployment:
needs: setup-job
runs-on: ubuntu-20.04

defaults:
run:
working-directory: btr-web

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Build Check
run: pnpm build:btr-main-app
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
.coverage
coverage.xml

# nyc test coverage
.nyc_output
Expand Down
Loading
Loading