Skip to content

[pull] main from tinacms:main #1174

[pull] main from tinacms:main

[pull] main from tinacms:main #1174

Workflow file for this run

name: Build, Test, Lint, Format for Main
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 15
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Check out code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
name: Install pnpm
id: pnpm-install
with:
package_json_file: package.json
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Build Types
run: pnpm types
- name: Test
run: pnpm test
- name: Test Packages
run: pnpm run test:packages
- name: Coverage (v4)
if: matrix.os == 'ubuntu-latest'
run: pnpm coverage
- name: Lint
if: matrix.os == 'ubuntu-latest'
run: pnpm lint
- name: Format
if: matrix.os == 'ubuntu-latest'
run: |
pnpm format
git diff --exit-code
- name: Check Tina lock changes
run: pnpm diff-tina-lock
# Gate adapter-matrix on whether the push / PR actually touched code that
# can affect it. workflow_dispatch falls through unconditionally so a manual
# run always exercises the matrix.
adapter-changes:
name: Detect adapter-relevant changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.adapter == 'true' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
if: github.event_name != 'workflow_dispatch'
with:
filters: |
adapter:
- 'packages/@tinacms/cli/**'
- 'packages/@tinacms/graphql/**'
- 'packages/@tinacms/schema-tools/**'
- 'packages/@tinacms/mdx/**'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- '.github/workflows/main.yml'
adapter-matrix:
name: Adapter Compatibility (${{ matrix.adapter }})
needs: adapter-changes
if: needs.adapter-changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- adapter: memory-level
needs_mongo: false
- adapter: sqlite-level
needs_mongo: false
- adapter: mongodb-level
needs_mongo: true
- adapter: tina-level-client
needs_mongo: false
services:
mongodb:
image: ${{ matrix.needs_mongo && 'mongo:7' || '' }}
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --quiet --eval 'db.runCommand({ ping: 1 })'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Check out code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
name: Install pnpm
id: pnpm-install
with:
package_json_file: package.json
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
# Adapter tests run CLI TS source via ts-jest, but need built graphql
# runtime output. Turbo also builds graphql's workspace deps.
- name: Build adapter test prerequisites
run: pnpm turbo run build --filter=@tinacms/graphql
- name: Run adapter test
if: ${{ !matrix.needs_mongo }}
env:
ADAPTER: ${{ matrix.adapter }}
run: pnpm --filter @tinacms/cli test:adapters
- name: Run adapter test (mongo)
if: matrix.needs_mongo
env:
ADAPTER: ${{ matrix.adapter }}
MONGO_URI: mongodb://localhost:27017
run: pnpm --filter @tinacms/cli test:adapters