Skip to content

fix(functions): fall back to proxy when subhosting host is unreachable #148

fix(functions): fall back to proxy when subhosting host is unreachable

fix(functions): fall back to proxy when subhosting host is unreachable #148

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run format:check
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run typecheck
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
unit-tests:
name: Unit Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run test:run -- --coverage
- name: Upload coverage artifact
uses: actions/upload-artifact@v7
if: matrix.node-version == 20
with:
name: coverage
path: coverage/
- name: Generate coverage summary
if: matrix.node-version == 20
id: coverage-summary
run: |
if [ -f coverage/coverage-summary.json ]; then
echo "COVERAGE<<EOF" >> $GITHUB_OUTPUT
npx -y coverage-summary-to-text coverage/coverage-summary.json >> $GITHUB_OUTPUT 2>/dev/null || \
node -e "
const s = require('./coverage/coverage-summary.json').total;
const fmt = (m) => m.pct + '%';
console.log('Coverage Summary');
console.log('================');
console.log('Statements: ' + fmt(s.statements));
console.log('Branches: ' + fmt(s.branches));
console.log('Functions: ' + fmt(s.functions));
console.log('Lines: ' + fmt(s.lines));
" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "COVERAGE=Coverage report not generated" >> $GITHUB_OUTPUT
fi
- name: Email coverage report to maintainer
if: matrix.node-version == 20 && github.event_name == 'push' && github.ref == 'refs/heads/main' && env.MAIL_SMTP_HOST != ''
uses: dawidd6/action-send-mail@v18
env:
MAIL_SMTP_HOST: ${{ secrets.MAIL_SMTP_HOST }}
with:
server_address: ${{ secrets.MAIL_SMTP_HOST }}
server_port: ${{ secrets.MAIL_SMTP_PORT }}
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: '[${{ github.repository }}] Coverage Report – ${{ github.sha }}'
to: ${{ secrets.MAINTAINER_EMAIL }}
from: ${{ secrets.MAIL_FROM || 'CI Bot <ci@insforge.dev>' }}
body: |
Coverage report for ${{ github.repository }}
Commit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ steps.coverage-summary.outputs.COVERAGE }}
Full HTML report is available as a build artifact.
attachments: coverage/lcov.info
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: [typecheck, build, unit-tests]
# Only run on main pushes when the test project is configured
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
- run: npm ci
- name: Run integration tests
run: npm run test:integration:ci
env:
INSFORGE_INTEGRATION_BASE_URL: ${{ vars.INSFORGE_INTEGRATION_BASE_URL }}
INSFORGE_INTEGRATION_ANON_KEY: ${{ secrets.INSFORGE_INTEGRATION_ANON_KEY }}
INSFORGE_INTEGRATION_TEST_EMAIL: ${{ secrets.INSFORGE_INTEGRATION_TEST_EMAIL }}
INSFORGE_INTEGRATION_TEST_PASSWORD: ${{ secrets.INSFORGE_INTEGRATION_TEST_PASSWORD }}