Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Normalize line endings: everything text is LF in the repo and on checkout
# (the shell scripts and node scripts run under WSL/Linux CI).
* text=auto eol=lf
*.png binary
*.ico binary
*.jpg binary
*.gif binary
*.woff binary
*.woff2 binary
148 changes: 148 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: build-and-test

# Build the netlify provider from the committed spec snapshot and run the
# credential-free test layers on each push / PR; the live smoke suite runs
# only where the Netlify token secret is configured; a scheduled spec-drift
# job re-downloads the upstream Swagger document and opens an issue when it
# has moved (Netlify serves a single unversioned document - drift is
# expected and must be reviewed, never silently regenerated).

on:
push:
branches: [main, 'feature/**']
paths-ignore: ['website/**']
pull_request:
branches: [main]
paths-ignore: ['website/**']
schedule:
- cron: '23 3 * * 1' # weekly spec-drift check (Monday 03:23 UTC)
workflow_dispatch:

jobs:
build-and-test:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm ci

# puts the latest stackql on PATH; bin/start-server.sh resolves it from
# there (no wrapper - the real binary is needed)
- name: Install stackql
uses: stackql/setup-stackql@v2

- name: stackql version
run: stackql --version

- name: Build provider from the committed spec snapshot
run: make build SPEC_REFRESH=0

- name: Fail on uncommitted generation drift
run: |
git add -N .
if ! git diff --quiet -- provider-dev/openapi provider-dev/config provider-dev/source; then
echo "Generated output differs from the committed artifacts - run 'make build' and commit."
git diff --stat -- provider-dev/openapi provider-dev/config provider-dev/source
exit 1
fi

- name: Meta-route tests
run: make meta-test

- name: Generate docs (sanity - the site build runs on the web workflows)
run: make docs

smoke:
# secret-gated live smoke suite against the test account; skipped with a
# notice when the secret is not configured (forks, PRs from outside).
# The suite is read-mostly plus a disposable environment variable
# lifecycle - nothing billable is created.
runs-on: ubuntu-latest
needs: build-and-test
if: github.event_name != 'pull_request' && github.event_name != 'schedule'
env:
NETLIFY_API_TOKEN: ${{ secrets.NETLIFY_API_TOKEN }}
TEST_SITE_NAME: ${{ vars.NETLIFY_TEST_SITE_NAME }}
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm

- uses: actions/setup-python@v7
with:
python-version: '3.12'

- name: Install dependencies
run: npm ci

- name: Live smoke suite (local build, exec + pgwire)
if: env.NETLIFY_API_TOKEN != ''
run: |
echo "NETLIFY_API_TOKEN=${NETLIFY_API_TOKEN}" > .env
make smoke-test MODE=both

- name: Live smoke skipped (no credentials)
if: env.NETLIFY_API_TOKEN == ''
run: |
echo "::notice title=Live smoke suite skipped::NETLIFY_API_TOKEN secret is not configured - the live smoke suite did not run. Credential-free coverage still ran via the meta-route gate."

spec-drift:
# Re-download the upstream document on a schedule and on demand, and open
# an issue when the preprocessed OpenAPI output differs from the committed
# snapshot.
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm ci

- name: Fetch and compare against the committed snapshot
id: drift
run: |
make spec preprocess
if git diff --quiet -- provider-dev/downloaded/openapi.json; then
echo "drift=false" >> "$GITHUB_OUTPUT"
else
echo "drift=true" >> "$GITHUB_OUTPUT"
git diff --stat -- provider-dev/downloaded > drift.txt || true
node -e "const s=require('./provider-dev/downloaded/swagger.json');console.log('upstream spec version', s.info.version)" >> drift.txt
cat drift.txt
fi

- name: Report drift
if: steps.drift.outputs.drift == 'true'
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const stat = fs.existsSync('drift.txt') ? fs.readFileSync('drift.txt', 'utf8') : '(diff unavailable)';
const title = 'Netlify API spec drift detected';
const body = 'The document served at https://open-api.netlify.com/swagger.json no longer matches the committed snapshot in provider-dev/downloaded/.\n\n```\n' + stat + '\n```\nRun `make all`, review the generated diff (new operations reported by `make split` / `make mappings`, changed schemas), update NOTES.md, and commit.';
await core.summary.addHeading(title).addCodeBlock(stat).write();
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner, repo: context.repo.repo, state: 'open', labels: 'spec-drift'
});
if (issues.some(i => i.title === title)) return;
await github.rest.issues.create({
owner: context.repo.owner, repo: context.repo.repo, title, body, labels: ['spec-drift']
});
116 changes: 58 additions & 58 deletions .github/workflows/prod-web-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
name: Deploy to GitHub Pages
on:
push:
branches:
- main
paths:
- 'website/**'
jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
cache-dependency-path: website/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: website
- name: Build website
run: yarn build
working-directory: website
- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: website/build # Ensure the path is correctly set to the Docusaurus build output
deploy:
name: Deploy to GitHub Pages
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
working-directory: website/build # Ensures the correct directory is used for deployment
name: Deploy to GitHub Pages

on:
push:
branches:
- main
paths:
- 'website/**'

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-node@v7
with:
node-version: 20
cache: yarn
cache-dependency-path: website/yarn.lock

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: website

- name: Build website
run: yarn build
working-directory: website

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v5
with:
path: website/build # Ensure the path is correctly set to the Docusaurus build output

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
with:
working-directory: website/build # Ensures the correct directory is used for deployment
42 changes: 0 additions & 42 deletions .github/workflows/star-check.yml

This file was deleted.

60 changes: 30 additions & 30 deletions .github/workflows/test-web-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: Test deployment
on:
pull_request:
branches:
- main
paths:
- 'website/**'
jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
cache-dependency-path: website/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: website
- name: Test build website
run: yarn build
name: Test deployment

on:
pull_request:
branches:
- main
paths:
- 'website/**'

jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-node@v7
with:
node-version: 20
cache: yarn
cache-dependency-path: website/yarn.lock

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: website

- name: Test build website
run: yarn build
working-directory: website
Loading
Loading