feat: custom scripts #2358
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Studio CI | |
on: | |
pull_request: | |
paths: | |
- "studio/**/*" | |
- "connect/**/*" | |
- ".github/workflows/studio-ci.yaml" | |
concurrency: | |
group: ${{github.workflow}}-${{github.head_ref}} | |
cancel-in-progress: true | |
env: | |
CI: true | |
DO_NOT_TRACK: '1' | |
jobs: | |
build_test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/node | |
- uses: actions/cache@v4 | |
name: Cache Next.js build | |
with: | |
path: | | |
${{ github.workspace }}/web/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('studio/**.[jt]s', 'studio/**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Generate code | |
run: pnpm buf generate --template buf.ts.gen.yaml | |
- name: Check if git is not dirty after generating files | |
run: git diff --no-ext-diff --exit-code | |
- name: Build | |
run: pnpm run --filter ./studio --filter ./connect --filter ./shared --filter ./composition build | |
- name: Lint | |
run: pnpm run --filter studio lint | |
- name: Test | |
run: pnpm run --filter studio test | |
build_push_image: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/build-push-image | |
with: | |
docker_username: ${{secrets.DOCKER_USERNAME}} | |
docker_password: ${{secrets.DOCKER_PASSWORD}} | |
docker_context: . | |
dockerfile: studio/Dockerfile | |
token: ${{secrets.GITHUB_TOKEN}} | |
image_name: studio | |
image_description: "Cosmo Studio" |