Showcase invalid ID producing top-level error and erasing rest of response #1562
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: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ci-new-2-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
check-changes: | |
name: Check for Changes | |
runs-on: ubuntu-latest | |
outputs: | |
website_changes: ${{ steps.check-website.outputs.website_changes }} | |
library_changes: ${{ steps.check-library.outputs.library_changes }} | |
src_changes: ${{ steps.check-src.outputs.src_changes }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
show-progress: false | |
- name: Check for changes in website directory | |
id: check-website | |
run: | | |
changes=$(git diff --name-only HEAD~1 HEAD -- ./website) | |
if [[ -n "$changes" ]]; then | |
echo "::set-output name=website_changes::true" | |
else | |
echo "::set-output name=website_changes::false" | |
fi | |
- name: Check for changes outside website directory | |
id: check-library | |
run: | | |
changes=$(git diff --name-only HEAD~1 HEAD -- ':!./website') | |
if [[ -n "$changes" ]]; then | |
echo "::set-output name=library_changes::true" | |
else | |
echo "::set-output name=library_changes::false" | |
fi | |
- name: Check for changes in src directory | |
id: check-src | |
run: | | |
changes=$(git diff --name-only HEAD~1 HEAD -- ./src) | |
if [[ -n "$changes" ]]; then | |
echo "::set-output name=src_changes::true" | |
else | |
echo "::set-output name=src_changes::false" | |
fi | |
spellcheck: | |
name: "Spellcheck Documentation" | |
runs-on: ubuntu-latest | |
needs: check-changes | |
if: needs.check-changes.outputs.website_changes == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
name: Check out the code | |
with: | |
show-progress: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
cache-dependency-path: "website/yarn.lock" | |
- name: Install cspell | |
run: npm install -g cspell | |
- name: run cspell | |
run: cspell --config ./cspell.json "website/src/**/*.md" --no-progress --no-cache | |
linting: | |
name: "Markdown linting" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Check out the code | |
with: | |
show-progress: false | |
- uses: actions/setup-node@v4 | |
name: Setup node | |
with: | |
node-version: "20" | |
- run: npm install -g markdownlint-cli2 | |
name: Install markdownlint-cli2 | |
- run: markdownlint-cli2 "*.md" "website/src/**/*.md" | |
name: run Markdownlint | |
website-tests: | |
name: "Website Tests" | |
needs: check-changes | |
if: needs.check-changes.outputs.website_changes == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "14.x" | |
cache: "yarn" | |
cache-dependency-path: "website/yarn.lock" | |
- name: Cache Yarn Packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
website/.yarn/cache | |
website/.cache/yarn | |
key: ${{ runner.os }}-yarn-${{ hashFiles('website/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Packages | |
run: yarn --immutable --network-timeout 100000 | |
working-directory: website | |
- name: Build Website | |
run: yarn build --prefix-paths | |
working-directory: website | |
configure: | |
name: Generate Test Matrix | |
runs-on: ubuntu-latest | |
needs: check-changes | |
if: needs.check-changes.outputs.library_changes == 'true' | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout to repository | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
7.x | |
8.x | |
- name: Generate Test Matrix | |
run: dotnet run --project ./.build -- GenerateMatrix | |
- name: Export Test Matrix | |
id: set-matrix | |
run: echo "matrix=$(jq -c . < ./matrix.json)" >> $GITHUB_OUTPUT | |
library-tests: | |
name: Cover ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
needs: [configure, check-changes] | |
if: needs.check-changes.outputs.library_changes == 'true' | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.configure.outputs.matrix) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- name: Run Build | |
id: run-build | |
run: dotnet build ${{ matrix.path }} --framework net8.0 --verbosity q | |
timeout-minutes: 5 | |
- name: Create directory for test results | |
run: mkdir -p ./.test-results | |
- name: Run tests | |
id: run-tests | |
timeout-minutes: 15 | |
continue-on-error: false | |
run: | | |
dotnet test ${{ matrix.path }} --no-build --framework net8.0 --verbosity q /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./.coverage/${{ matrix.name }}.xml --logger "trx;LogFileName=./.test-results/${{ matrix.name }}.trx" /p:ExcludeByFile="**/test/**" | |
env: | |
CI_BUILD: true | |
- name: Copy test results | |
continue-on-error: true | |
run: | | |
mkdir -p ./output/coverage | |
mkdir -p ./output/test-results | |
cp "${{ matrix.directoryPath }}/.coverage/${{ matrix.name }}.net8.0.xml" ./output/coverage/ | |
cp "${{ matrix.directoryPath }}/.test-results/${{ matrix.name }}.trx" ./output/test-results/ | |
- name: Upload Test Results as Artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.name }} | |
path: ./output/test-results/*.trx | |
- name: Upload Coverage Files as Artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.name }} | |
path: ./output/coverage/*.xml | |
- name: Upload mismatch files as Artifacts | |
if: steps.run-tests.outcome == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mismatch-files-${{ matrix.name }} | |
path: | | |
**/__mismatch__/* | |
library-tests-no-coverage: | |
name: Run ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
needs: [configure, check-changes] | |
if: needs.check-changes.outputs.library_changes == 'true' | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.configure.outputs.matrix) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- name: Run Build | |
id: run-build | |
run: dotnet build ${{ matrix.path }} --framework net8.0 --verbosity q | |
timeout-minutes: 5 | |
- name: Create directory for test results | |
run: mkdir -p ./.test-results | |
- name: Run tests | |
id: run-tests | |
timeout-minutes: 15 | |
continue-on-error: false | |
run: | | |
dotnet test ${{ matrix.path }} --no-build --framework net8.0 | |
env: | |
CI_BUILD: true | |
merge-coverage: | |
name: Merge and Upload Coverage | |
needs: library-tests | |
if: always() && needs.library-tests.result != 'cancelled' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Install .NET | |
if: ${{ !cancelled() }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- name: Create All.sln | |
if: ${{ !cancelled() }} | |
run: ./build.sh CreateAllSln | |
- name: Build | |
if: ${{ !cancelled() }} | |
run: dotnet build ./src/All.sln | |
- name: Download all coverage artifacts | |
if: ${{ !cancelled() }} | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./output/download | |
- name: Merge Coverage Files | |
if: ${{ !cancelled() }} | |
timeout-minutes: 10 | |
run: | | |
dotnet tool install -g dotnet-reportgenerator-globaltool | |
reportgenerator "-reports:./output/download/**/*.xml" "-targetdir:./output/coverage/merged" -reporttypes:Opencover -license:$ReportGenerator_License | |
env: | |
ReportGenerator_License: ${{ secrets.REPORTGENERATOR_LICENSE }} | |
- name: Upload Combined Coverage to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/codecov-action@v4 | |
timeout-minutes: 10 | |
with: | |
file: ./output/coverage/merged/OpenCover.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: graphql-platform | |
flags: unittests | |
fail_ci_if_error: true | |
ci-status-check: | |
name: "CI Status Check" | |
needs: [library-tests, website-tests] | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if Library Tests or Website Tests failed | |
run: exit 1 | |
if: | | |
always() && | |
(needs.library-tests.result == 'failure' || | |
needs.website-tests.result == 'failure') |