Skip to content

[Fusion] @semanticNonNull Support #2334

[Fusion] @semanticNonNull Support

[Fusion] @semanticNonNull Support #2334

Workflow file for this run

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: |
8.x
9.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: 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: |
8.x
9.x
- name: Run Build
id: run-build
run: dotnet build ${{ matrix.path }} --framework net9.0 --verbosity q
timeout-minutes: 5
- name: Run tests
id: run-tests
timeout-minutes: 15
continue-on-error: false
run: >
dotnet test ${{ matrix.path }}
--collect:"XPlat Code Coverage;Format=opencover"
--framework net9.0
--logger trx
--no-build
--
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByFile="**/test/**"
env:
CI_BUILD: true
- name: Upload Test Results as Artifact
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.name }}
path: ${{ matrix.directoryPath }}/TestResults/*.trx
- name: Upload Coverage File as Artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.name }}
# The * matches a single directory that is named with a GUID.
# Take note of https://github.com/microsoft/vstest/issues/2334.
path: ${{ matrix.directoryPath }}/TestResults/*/coverage.opencover.xml
- name: Upload mismatch files as Artifact
if: steps.run-tests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: mismatch-files-${{ matrix.name }}
path: ${{ matrix.directoryPath }}/**/__mismatch__/*
upload-coverage:
name: Upload Coverage
needs: library-tests
runs-on: ubuntu-latest
steps:
- name: Download all coverage artifacts
uses: actions/download-artifact@v4
with:
path: ./output/download
pattern: coverage-*
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
timeout-minutes: 10
with:
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')