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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Keep the distributed package small: none of this is needed at runtime.
/.github export-ignore
/.idea export-ignore
/tests export-ignore
/workbench export-ignore
/.codeclimate.yml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.phpstorm.meta.php export-ignore
/CHANGELOG.md export-ignore
/graphql.config.yml export-ignore
/ide.json export-ignore
/local.graphql export-ignore
/phpunit.xml.dist export-ignore
/testbench.yaml export-ignore

*.php diff=php
10 changes: 5 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
coverage: pcov

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
vendor
Expand All @@ -35,10 +35,10 @@ jobs:
- name: Install dependencies
env:
COMPOSER_DISCARD_CHANGES: true
run: composer require --no-progress --no-interaction --prefer-dist --update-with-all-dependencies "laravel/framework:10.*" "orchestra/testbench:8.*"
run: composer install --no-progress --no-interaction --prefer-dist

- name: Run and publish code coverage
uses: paambaati/codeclimate-action@v2.4.0
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,37 @@ name: Code Style
on: [ pull_request, push ]

jobs:
coverage:
code-style:
runs-on: ubuntu-latest

name: Run code style checks

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check out the repository
uses: actions/checkout@v4

- name: Setup PHP
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
tools: composer:v2

- name: Register the Composer cache directory
id: composer-cache-files-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
vendor
${{ steps.composer-cache-files-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
env:
COMPOSER_DISCARD_CHANGES: true
run: composer require --no-progress --no-interaction --prefer-dist --update-with-all-dependencies "laravel/framework:9.*" "orchestra/testbench:7.*"
run: composer install --no-interaction --prefer-dist

- name: Run PHP CS Fixer
run: ./vendor/bin/php-cs-fixer fix --diff --dry-run
run: vendor/bin/php-cs-fixer fix --diff --dry-run
60 changes: 0 additions & 60 deletions .github/workflows/phpunit.yml

This file was deleted.

135 changes: 135 additions & 0 deletions .github/workflows/sync-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Sync Linear Schema

on:
schedule:
- cron: '0 9 * * *' # Daily at 9am UTC
workflow_dispatch:
inputs:
force_release:
description: 'Tag a release even if the schema has not changed'
type: boolean
default: false

concurrency:
group: sync-schema
cancel-in-progress: false

permissions:
contents: write

jobs:
sync:
runs-on: ubuntu-latest
name: Rebuild from the live schema

steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
tools: composer:v2

- name: Register the Composer cache directory
id: composer-cache-files-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
vendor
${{ steps.composer-cache-files-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Fetch the schema
id: schema
env:
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
LINEAR_SCHEMA_SUMMARY: ${{ github.workspace }}/schema-changes.md
run: php vendor/bin/testbench linear:schema

- name: Stop here if nothing changed
id: proceed
run: |
if [ "${{ steps.schema.outputs.changed }}" = "true" ] || [ "${{ inputs.force_release }}" = "true" ]; then
echo "run=true" >> $GITHUB_OUTPUT
else
echo "run=false" >> $GITHUB_OUTPUT
echo "The schema is unchanged. Nothing to do."
fi

# New types are only visible to the default-field resolver once their classes exist
# on disk, so we generate twice: the first pass writes them, the second fills in
# the default fields for anything that was missing.
- name: Rebuild the generated code
if: steps.proceed.outputs.run == 'true'
run: |
php vendor/bin/testbench reset:data
php vendor/bin/testbench generate:data
composer dump-autoload
php vendor/bin/testbench generate:data
vendor/bin/php-cs-fixer fix --quiet
composer dump-autoload

- name: Run the test suite
if: steps.proceed.outputs.run == 'true'
run: vendor/bin/phpunit

- name: Check code style
if: steps.proceed.outputs.run == 'true'
run: vendor/bin/php-cs-fixer fix --diff --dry-run

- name: Work out the next version
if: steps.proceed.outputs.run == 'true'
id: version
env:
LINEAR_VERSION_BUMP: ${{ steps.schema.outputs.bump }}
run: |
CURRENT=$(git tag --list --sort=-v:refname | head -n 1)
CURRENT=${CURRENT:-0.0.0}
NEXT=$(php vendor/bin/testbench linear:next-version "$CURRENT" | tail -n 1 | tr -d '[:space:]')
echo "current=$CURRENT" >> $GITHUB_OUTPUT
echo "next=$NEXT" >> $GITHUB_OUTPUT
echo "Releasing $CURRENT -> $NEXT (${{ steps.schema.outputs.bump }})"

- name: Commit the rebuilt code
if: steps.proceed.outputs.run == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "Nothing to commit."
else
git commit -m "Rebuild from the Linear schema for ${{ steps.version.outputs.next }}"
git push origin HEAD:${{ github.ref_name }}
fi

- name: Write the release notes
if: steps.proceed.outputs.run == 'true'
run: |
{
echo "Rebuilt from the Linear GraphQL schema as of $(date -u '+%Y-%m-%d')."
echo
cat "${{ github.workspace }}/schema-changes.md" 2>/dev/null || echo "No schema changes recorded."
} > "${{ github.workspace }}/release-notes.md"

- name: Tag the release
if: steps.proceed.outputs.run == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.version.outputs.next }}" \
--title "${{ steps.version.outputs.next }}" \
--notes-file "${{ github.workspace }}/release-notes.md" \
--target "$(git rev-parse HEAD)"
71 changes: 71 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Kept at this path rather than phpunit.yml: GitHub disables scheduled workflows
# in repositories that go quiet, and the old file had been disabled for inactivity.
# The workflow name is unchanged, so the README badge still resolves.
name: PHPUnit

on:
push:
pull_request:
schedule:
- cron: '0 14 * * 3' # Run Wednesdays at 2pm EST

jobs:
php-tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [ 8.2, 8.3, 8.4 ]
laravel: [ 11.*, 12.*, 13.* ]
dependency-version: [ stable, lowest ]
include:
# orchestra/testbench below 9.2 sets a static property it never declares,
# which fails every test, so the Laravel 11 floor starts there
- laravel: 11.*
testbench: ^9.2
- laravel: 12.*
testbench: ^10.0
- laravel: 13.*
testbench: ^11.0
exclude:
# Laravel 13 needs PHP 8.3 or newer
- laravel: 13.*
php: 8.2

timeout-minutes: 15

name: "PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }} (${{ matrix.dependency-version }})"

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
tools: composer:v2

- name: Register the Composer cache directory
id: composer-cache-files-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
vendor
${{ steps.composer-cache-files-dir.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.laravel }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-

- name: Install dependencies
run: |
composer require --no-interaction --prefer-dist --no-update "laravel/framework:${{ matrix.laravel }}"
composer require --dev --no-interaction --prefer-dist --no-update "orchestra/testbench:${{ matrix.testbench }}"
composer update --no-interaction --prefer-dist --with-all-dependencies --prefer-${{ matrix.dependency-version }}

- name: Execute tests
run: vendor/bin/phpunit
4 changes: 2 additions & 2 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
update-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ github.event.repository.full_name }}
ref: 'main'
Expand All @@ -19,7 +19,7 @@ jobs:
version: ${{ github.event.release.tag_name }}

- name: Commit changelog back to repo
uses: EndBug/add-and-commit@v8
uses: EndBug/add-and-commit@v9
with:
add: 'CHANGELOG.md'
message: ${{ github.event.release.tag_name }}
Expand Down
Loading
Loading