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

Feat(CI): Check starting the app #229

Merged
merged 27 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5434807
Try to start an app on CI
GoldenJaden Mar 20, 2024
5fae1b0
Setup db in Start test
GoldenJaden Mar 20, 2024
d30b7e1
Try fixing db credentials:
GoldenJaden Mar 22, 2024
7093f89
Try changing DB HOST
GoldenJaden Mar 22, 2024
771859b
Try changing DB HOST
GoldenJaden Mar 22, 2024
116c2fa
Grant permission to postgres user
GoldenJaden Mar 22, 2024
2f1f45c
Grant permission to postgres user
GoldenJaden Mar 22, 2024
11b228b
Change permissions
GoldenJaden Mar 22, 2024
bb562f0
Change permissions to db
GoldenJaden Mar 22, 2024
38deb81
Define config to use
GoldenJaden Mar 23, 2024
41435ab
Update db credentials
GoldenJaden Mar 23, 2024
5e2d3f8
Give db all permisions for test
GoldenJaden Mar 23, 2024
3389d2a
Debugging
GoldenJaden Mar 23, 2024
b6a3d8e
Restart postgresql in CI
GoldenJaden Mar 23, 2024
0d32d14
Add updating db address in config during runtime
GoldenJaden Mar 23, 2024
77153c3
Add changing bd user name to runner
GoldenJaden Mar 23, 2024
bb4eb4a
Switch to postgres user
GoldenJaden Mar 23, 2024
b7fb453
Create runner user in postgres
GoldenJaden Mar 23, 2024
da3ccb7
Try to set up db another way
GoldenJaden Mar 23, 2024
61aced2
Remove redundant step
GoldenJaden Mar 23, 2024
6007c70
Yet another try to set up db
GoldenJaden Mar 23, 2024
2bb8d70
Revert some changes
GoldenJaden Mar 24, 2024
dbff8d7
Add timeout to the step
GoldenJaden Mar 24, 2024
7311821
Add checking app status
GoldenJaden Mar 24, 2024
c96baca
Try to break the app
GoldenJaden Mar 24, 2024
89bf811
Fix the app
GoldenJaden Mar 24, 2024
ee42853
Check if app is healthy or not
GoldenJaden Mar 25, 2024
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
66 changes: 66 additions & 0 deletions .github/workflows/run-build-and-start-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and start

on:
push:
branches:
- 'main'
tags:
- 'v*'

pull_request:
types: [opened, synchronize, reopened]

jobs:
build-and-start:
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: codex
POSTGRES_DB: notes
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

name: Build and start the app
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Change database address
run: |
sed -i "s/@postgres/@localhost/" app-config.yaml

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build
neSpecc marked this conversation as resolved.
Show resolved Hide resolved
neSpecc marked this conversation as resolved.
Show resolved Hide resolved

# Start an app in the background
- name: Start
run: node dist/index.js -c app-config.yaml &

- name: Check if the app is running
run: |
sleep 5
response=$(curl -s http://localhost:9090/health)
echo "$response"
message=$(echo "$response" | jq -r '.message')
if [ "$message" = "ok" ]; then
echo "Application is healthy"
else
echo "Application is not healthy"
exit 1
fi
32 changes: 0 additions & 32 deletions .github/workflows/run-build-check.yml

This file was deleted.

Loading