Skip to content

Set output tool! Output schema. Remove update_report (#218) #2452

Set output tool! Output schema. Remove update_report (#218)

Set output tool! Output schema. Remove update_report (#218) #2452

Workflow file for this run

# This workflow runs CI checks including building, typechecking, and testing the codebase
# Tests are parallelized to run faster by splitting them into separate jobs that run concurrently
#
# See the workflow visualization in knowledge file
name: CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
# Define reusable job template
jobs:
# Build and check
build-and-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2.12'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
packages/*/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Set environment variables
env:
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
run: |
VAR_NAMES=$(node scripts/generate-ci-env.js)
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
' >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
echo "NEXT_PUBLIC_CB_ENVIRONMENT=test" >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Typecheck and Build web in parallel
run: |
timeout 10m bash -c '
bun run typecheck &
cd web && bun run build &
wait
'
# - name: Build npm-app
# run: cd npm-app && bun run build
# - name: Open interactive debug shell
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15 # optional guard
# Template for test jobs
test:
needs: [build-and-check]
strategy:
matrix:
package: [npm-app, backend, common]
include:
- package: npm-app
- package: backend
- package: common
name: test-${{ matrix.package }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2.12'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
packages/*/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Set environment variables
env:
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
run: |
VAR_NAMES=$(node scripts/generate-ci-env.js)
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
' >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
echo "NEXT_PUBLIC_CB_ENVIRONMENT=test" >> $GITHUB_ENV
echo "NEXT_PUBLIC_INFISICAL_UP=true" >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Run ${{ matrix.package }} tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 5
command: cd ${{ matrix.package }} && find src -name '*.test.ts' ! -name '*.integration.test.ts' | sort | xargs -I {} bun test {}
# - name: Open interactive debug shell
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15 # optional guard
# Integration tests job
test-integration:
needs: [build-and-check]
strategy:
matrix:
package: [npm-app, backend, common]
include:
- package: npm-app
- package: backend
- package: common
name: test-integration-${{ matrix.package }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2.12'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
packages/*/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Set environment variables
env:
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
run: |
VAR_NAMES=$(node scripts/generate-ci-env.js)
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
' >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
echo "NEXT_PUBLIC_CB_ENVIRONMENT=test" >> $GITHUB_ENV
echo "NEXT_PUBLIC_INFISICAL_UP=true" >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Run ${{ matrix.package }} integration tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
command: cd ${{ matrix.package }} && find src -name '*.integration.test.ts' | sort | xargs -I {} bun test {}
# - name: Open interactive debug shell
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15 # optional guard