Skip to content

CI

CI #1146

Workflow file for this run

name: CI
on:
push:
schedule:
# Every day at ~7:17am Chicago time.
#
# Using a non-zero minute offset since GitHub Actions suggests
# running jobs at a random minute to avoid overloading their
# servers.
#
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '17 12 * * *'
# Cancel in progress runs of this workflow when we push changes to the branch
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- '18'
- '20'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Validate renovate config
run: npx --package renovate renovate-config-validator --strict
- name: Install dependencies
run: npm ci
- name: Run type checks
run: npm run type-check
- name: Run lint checks
run: npm run lint
- name: Run tests
run: npm run test
env:
AUTOBLOCKS_API_KEY: ${{ secrets.CI_AUTOBLOCKS_API_KEY_USER_ADAM }}
AUTOBLOCKS_INGESTION_KEY: ${{ secrets.CI_AUTOBLOCKS_INGESTION_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Run build
run: npm run build
- name: Yalc publish
run: npx yalc publish
- name: Delete top level node_modules
run: rm -rf node_modules
- name: Test CJS imports
working-directory: e2e/test-import-cjs
run: npx yalc add @autoblocks/client && npm install && npm run start
env:
AUTOBLOCKS_INGESTION_KEY: test
- name: Test ESM imports
working-directory: e2e/test-import-esm
run: npx yalc add @autoblocks/client && npm install && npm run start
env:
AUTOBLOCKS_INGESTION_KEY: test
- name: Test Prompt Manager
working-directory: e2e/test-prompt-manager-ts
run: |
npx yalc add @autoblocks/client && \
npm install && \
npm run gen && \
tsc --noEmit && \
npm run test
env:
# Org-scoped API key
AUTOBLOCKS_API_KEY: ${{ secrets.CI_AUTOBLOCKS_API_KEY }}
# User-scoped API key
AUTOBLOCKS_API_KEY_USER: ${{ secrets.CI_AUTOBLOCKS_API_KEY_USER_NICOLE }}
- name: Test Configs
working-directory: e2e/test-configs-ts
run: |
npx yalc add @autoblocks/client && \
npm install && \
tsc --noEmit && \
npm run test
env:
# Org-scoped API key
AUTOBLOCKS_API_KEY: ${{ secrets.CI_AUTOBLOCKS_API_KEY }}
# User-scoped API key
AUTOBLOCKS_API_KEY_USER: ${{ secrets.CI_AUTOBLOCKS_API_KEY_USER_NICOLE }}
notify:
needs:
- ci
if: always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: slackapi/[email protected]
with:
payload: |
{
"text": ":warning: Workflow `${{ github.workflow }}` in repository `${{ github.repository }}` failed. <${{ env.run-url }}|Logs>"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
run-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}