chore: add healthcheck server #166
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Strategy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint-api: | |
name: Lint API | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install deps | |
run: pnpm install | |
- name: Lint | |
run: pnpm api lint | |
lint-client: | |
name: Lint Client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install deps | |
run: pnpm install | |
- name: Lint | |
run: pnpm client lint | |
typecheck-api: | |
name: Typecheck API | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install deps | |
run: pnpm install | |
- name: Typecheck | |
run: pnpm api typecheck | |
typecheck-client: | |
name: Typecheck Client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install deps | |
run: pnpm install | |
- name: Typecheck | |
run: pnpm client typecheck | |
vitest: | |
name: Unit test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install deps | |
run: pnpm install | |
- name: vitest | |
run: pnpm -r test | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: [lint-api, vitest, typecheck-client, typecheck-api, lint-client] | |
steps: | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
- name: SSH Remote Commands | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | |
sudo ln -s "$NVM_DIR/versions/node/v20.9.0/bin/node" "/usr/local/bin/node" | |
cd SkillCoop/ | |
git pull origin main | |
npm install -g pnpm | |
pnpm install | |
pnpm schema build | |
pnpm date build | |
pnpm type build | |
pnpm api build | |
pnpm chat build | |
pnpm api db:migrate:deploy | |
npm install pm2 -g | |
pm2 reload skillcoop-pm2.json |