Skip to content

Commit

Permalink
Add CI (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhdev authored Jan 5, 2025
1 parent baba7f8 commit 9842d1f
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @xuhdev
52 changes: 52 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# @license AGPL-3.0-or-later
#
# Copyright(C) 2025 Hong Xu <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

name: Lint

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
lint:
name: Lint
runs-on: ubuntu-24.04

steps:
- uses: actions/[email protected]

- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 22
cache: "npm"

- name: Install Dependencies
run: npm ci

- name: Install Caddy
run: |
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
- name: Lint
run: npm run lint
53 changes: 53 additions & 0 deletions .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# @license AGPL-3.0-or-later
#
# Copyright(C) 2025 Hong Xu <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

name: Runtime

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test:
name: Runtime
runs-on: ubuntu-24.04

steps:
- uses: actions/[email protected]

- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 22
cache: "npm"

- name: Install podman
run: sudo apt-get update && sudo apt-get install -y podman

- name: Build
run: npm run build

- name: Start the container
run: podman run --detach -p 3000:80 -p 3001:443 app

- name: Install npm dependencies
run: npm ci

- name: Run test
run: npm run test
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
"author": "Hong Xu <[email protected]>",
"type": "module",
"scripts": {
"lint": "eslint *.ts *.mjs && prettier . --check",
"lint": "eslint *.ts *.mjs && prettier . --check && caddy fmt --diff Caddyfile.base",
"build": "podman build . -t app",
"start": "podman run -it --rm -p 3000:80 -p 3001:443 app",
"test": "vitest --run index.test.ts",
"test_live": "vitest --run docker.test.ts",
"format": "eslint --fix *.ts *.mjs && prettier . --write",
"compile": "tsc -p tsconfig.json",
"dev": "npm run build && node dist/index.js"
"format": "eslint --fix *.ts *.mjs && prettier . --write && caddy fmt --overwrite Caddyfile.base",
"compile": "tsc -p tsconfig.json"
},
"devDependencies": {
"@types/eslint": "^9.6.1",
Expand Down

0 comments on commit 9842d1f

Please sign in to comment.