Skip to content

Fix ambiguous field name error #62

Fix ambiguous field name error

Fix ambiguous field name error #62

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
workflow_call:
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
# https://github.com/actions/setup-node/issues/904
-
uses: actions/setup-node@v3
with:
node-version: latest
-
run: corepack enable
# Build JS
-
uses: actions/setup-node@v3
with:
node-version: latest
cache: yarn
-
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-stack-cache-${{ hashFiles('stack.yaml', 'package.yaml') }}
-
name: Build graphql-codegen-haskell
run: yarn install --immutable && yarn build
-
uses: actions/upload-artifact@v3
with:
name: graphql-codegen-haskell.js
path: graphql-client/js/graphql-codegen-haskell.js
# Build + test Haskell
-
name: Build + Test
run: stack test graphql-client --haddock --no-haddock-deps --coverage
# Coverage
-
name: Convert coverage output
run: |
HPC_LCOV_VERSION=1.1.1
curl -fsSL \
"https://github.com/brandonchinn178/hpc-lcov/releases/download/v${HPC_LCOV_VERSION}/hpc-lcov-${HPC_LCOV_VERSION}-linux-x86_64" \
-o /usr/local/bin/hpc-lcov
chmod +x /usr/local/bin/hpc-lcov
hpc-lcov
-
name: Generate hpc overlay file
run: |
scripts/make_hpc_overlay.py
hpc-lcov --file overlay.tix -o lcov-overlay.info
-
uses: codecov/codecov-action@v3
with:
files: lcov.info,lcov-overlay.info
# Build + test example
-
name: Test that example API is up to date
run: |
example/scripts/codegen.sh
git diff --exit-code example/src/Example/GraphQL/
-
name: Build + Test example
run: stack test graphql-client-example
-
name: Run example
run: stack exec graphql-client-example
ghc_compat_test:
strategy:
matrix:
ghc_version:
- '9.4'
- '9.6'
- '9.8'
include:
- ghc_version: 9.4.1
oldest: true
name: ghc_compat_test (${{ matrix.ghc_version }})
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
# https://github.com/actions/setup-node/issues/904
-
uses: actions/setup-node@v3
with:
node-version: latest
-
run: corepack enable
# Build JS
-
uses: actions/setup-node@v3
with:
node-version: latest
cache: yarn
-
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-stack-cache-${{ hashFiles('stack.yaml', 'package.yaml') }}
-
name: Build graphql-codegen-haskell
run: yarn install --immutable && yarn build
-
uses: actions/upload-artifact@v3
with:
name: graphql-codegen-haskell.js
path: graphql-client/js/graphql-codegen-haskell.js
# Build + Test Cabal
-
id: setup
name: Set up GHC ${{ matrix.ghc_version }}
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc_version }}
-
name: Configure the build
run: >
cabal configure
--enable-test
--test-show-details=streaming
--ghc-options '-Wno-unused-packages'
-
if: ${{ matrix.oldest }}
name: Use oldest dependencies
run:
cabal configure --enable-append
--prefer-oldest
-
name: Get build plan
run:
cabal build all --dry-run
-
name: Get current month to clear cache
run: echo "CURR_MONTH=$(date +%B)" | tee -a "$GITHUB_ENV"
-
uses: actions/cache@v3
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-${{ hashFiles('**/plan.json') }}
restore-keys: |
${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-
-
run: cabal build all
-
run: cabal exec cabal test all
-
name: Check that files are unmodified
run: git add -A && git diff --staged --exit-code
test_node:
strategy:
matrix:
version: [18, 20]
include:
- version: latest
latest: true
name: test_node (${{ matrix.version }})
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
# HACK
# https://github.com/actions/setup-node/issues/904
-
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
-
run: corepack enable
# END HACK
-
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
cache: yarn
-
run: yarn install --immutable
-
run: yarn build
-
run: yarn graphql-codegen test --coverage --runInBand
-
if: ${{ matrix.latest }}
uses: codecov/codecov-action@v3
with:
files: graphql-codegen-haskell/coverage/coverage-final.json
lint:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
name: Install fourmolu
run: |
curl -fsSL \
"https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \
-o /usr/local/bin/fourmolu
chmod +x /usr/local/bin/fourmolu
env:
FOURMOLU_VERSION: '0.13.0.0'
-
name: Install hlint
run: |
tmpdir=$(mktemp -d)
curl -fsSL \
"https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/hlint-${HLINT_VERSION}-x86_64-linux.tar.gz" \
-o "${tmpdir}/hlint.tar.gz"
tar xzf "${tmpdir}/hlint.tar.gz" -C "${tmpdir}"
mv "${tmpdir}/hlint-${HLINT_VERSION}/hlint" /usr/local/bin/hlint
chmod +x /usr/local/bin/hlint
rm -rf "${tmpdir}"
env:
HLINT_VERSION: '3.5'
-
name: Install ESLint
run: corepack enable && yarn install --immutable
-
name: Install pre-commit
run: pip install pre-commit
-
name: Run pre-commit
run: pre-commit run -a --show-diff-on-failure
check_sdist:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
run: corepack enable
-
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-check_sdist-${{ hashFiles('stack.yaml', 'package.yaml') }}
-
name: Build graphql-codegen-haskell
run: yarn install --immutable && yarn build
-
name: Strip unreleased section from CHANGELOG
run: sed -i -n '/^# Unreleased/d; /^#/,$p' graphql-client/CHANGELOG.md
-
name: Create sdist bundle
run: stack sdist graphql-client --test-tarball --tar-dir .
-
uses: actions/upload-artifact@v3
with:
name: graphql-client-sdist
path: graphql-client-*.tar.gz