diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..cadcbdbf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: + push: + branches: + - main + - dev + pull_request: + # Run on all PRs, regardless of target branch + +jobs: + lint-and-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Run typecheck + run: npm run typecheck + + - name: Run linter + run: npm run lint + + - name: Run tests + run: npm test + + validate-commits: + runs-on: ubuntu-latest + # Skip validation for PRs from dev to main (release PRs) since dev accumulates merge commit history + if: github.event_name == 'pull_request' && !(github.head_ref == 'dev' && github.base_ref == 'main') + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Validate PR commits + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..ba725e80 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,27 @@ +name: Deploy to Fly.io + +on: + push: + branches: + - main + +jobs: + deploy-webhooks: + name: Deploy Webhooks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --config fly.toml --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + deploy-router: + name: Deploy Router + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --config fly.router.toml --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 0626bb34..37310c5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,7 @@ RUN apt-get update && apt-get install -y \ psutils \ tmux \ postgresql \ + sudo \ && rm -rf /var/lib/apt/lists/* \ && ln -s $(which fdfind) /usr/local/bin/fd