From b1be7999e3af1a0ae774191dd8c171666bc190c4 Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 19:30:11 +0100 Subject: [PATCH 1/7] feat: Add staticcheck linting --- .github/workflows/pr-checks.yml | 26 ++++++++++++++++++++++++++ .github/workflows/release.yml | 3 +++ internal/loader.go | 1 + justfile | 2 ++ 4 files changed, 32 insertions(+) create mode 100644 .github/workflows/pr-checks.yml diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..6d0ab18 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,26 @@ +name: PR Checks + +on: + pull_request: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install just + run: | + mkdir -p "$HOME/.local/bin" + curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to "$HOME/.local/bin" + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: "Set up Go" + uses: actions/setup-go@v5 + with: + go-version: '^1.13.1' + + - name: Run lint + run: just lint \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8bbd48f..b796b33 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,9 @@ on: - main pull_request: +permissions: + contents: write + jobs: build: runs-on: ubuntu-latest diff --git a/internal/loader.go b/internal/loader.go index b6ae10a..6c1fa0c 100644 --- a/internal/loader.go +++ b/internal/loader.go @@ -3,6 +3,7 @@ package internal import ( "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "time" ) import ( "errors" diff --git a/justfile b/justfile index f9131c1..8461fac 100644 --- a/justfile +++ b/justfile @@ -30,3 +30,5 @@ build: go build -ldflags="-s -w" -o "build/$output" . done done + +lint: staticcheck ./... \ No newline at end of file From f84504c1bcee87ee6f76b8821fbec85af8a82f8b Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 19:36:48 +0100 Subject: [PATCH 2/7] fix: Fix workflow syntax error --- .github/workflows/pr-checks.yml | 58 +++++++++++++++++++++------------ internal/loader.go | 1 - justfile | 3 +- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 6d0ab18..49d1438 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -1,26 +1,42 @@ name: PR Checks on: - pull_request: + pull_request: jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install just - run: | - mkdir -p "$HOME/.local/bin" - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to "$HOME/.local/bin" - echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: "Set up Go" - uses: actions/setup-go@v5 - with: - go-version: '^1.13.1' - - - name: Run lint - run: just lint \ No newline at end of file + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: extractions/setup-just@v1 + + - name: "Set up Go" + uses: actions/setup-go@v5 + with: + go-version: '^1.13.1' + + - name: Build + run: just build + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: extractions/setup-just@v1 + + - name: Install staticcheck + uses: dominikh/staticcheck-action@v1.2.0 + with: + version: "2022.1.1" + + - name: "Set up Go" + uses: actions/setup-go@v5 + with: + go-version: '^1.13.1' + + - name: Run lint + run: just lint \ No newline at end of file diff --git a/internal/loader.go b/internal/loader.go index 6c1fa0c..b6ae10a 100644 --- a/internal/loader.go +++ b/internal/loader.go @@ -3,7 +3,6 @@ package internal import ( "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "time" ) import ( "errors" diff --git a/justfile b/justfile index 8461fac..8c8755a 100644 --- a/justfile +++ b/justfile @@ -31,4 +31,5 @@ build: done done -lint: staticcheck ./... \ No newline at end of file +lint: + staticcheck ./... From ee77e285d7dcdb5d54de7a54d571708b0ea16cd8 Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 22:34:22 +0100 Subject: [PATCH 3/7] fix: Fix lint workflow --- .github/workflows/pr-checks.yml | 21 +++++++++++++++++++-- .github/workflows/release.yml | 1 - 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 49d1438..533125a 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -28,15 +28,32 @@ jobs: - uses: extractions/setup-just@v1 + - name: "Set up Go" + uses: actions/setup-go@v5 + with: + go-version: '^1.13.1' + - name: Install staticcheck uses: dominikh/staticcheck-action@v1.2.0 with: version: "2022.1.1" + install-go: false + + - name: Run lint + run: just lint + + unit-test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: extractions/setup-just@v1 - name: "Set up Go" uses: actions/setup-go@v5 with: go-version: '^1.13.1' - - name: Run lint - run: just lint \ No newline at end of file + - name: Unit tests + run: go test ./... \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b796b33..a9e1aaa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ on: - '*' branches: - main - pull_request: permissions: contents: write From 87b73b2489b430559a08ee98a7f12e6ae9fbf483 Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 22:36:25 +0100 Subject: [PATCH 4/7] fix: Fix go version --- .github/workflows/pr-checks.yml | 6 +++--- .github/workflows/release.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 533125a..66b4125 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -15,7 +15,7 @@ jobs: - name: "Set up Go" uses: actions/setup-go@v5 with: - go-version: '^1.13.1' + go-version: '1.23.1' - name: Build run: just build @@ -31,7 +31,7 @@ jobs: - name: "Set up Go" uses: actions/setup-go@v5 with: - go-version: '^1.13.1' + go-version: '1.23.1' - name: Install staticcheck uses: dominikh/staticcheck-action@v1.2.0 @@ -53,7 +53,7 @@ jobs: - name: "Set up Go" uses: actions/setup-go@v5 with: - go-version: '^1.13.1' + go-version: '1.23.1' - name: Unit tests run: go test ./... \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9e1aaa..d3ce329 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: "Set up Go" uses: actions/setup-go@v5 with: - go-version: '^1.13.1' + go-version: '^1.23.1' - name: Build binaries run: just build From f347c34cf931ec95940d385f0b8708aa107b94df Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 22:37:50 +0100 Subject: [PATCH 5/7] yeah I don't know --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 069f11e..d307dea 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/simse/faster-graphql-codegen -go 1.23.1 +go 1.23 require ( github.com/VividCortex/ewma v1.2.0 // indirect From 6ba450315316adc839b65339c011ad5cafa9700a Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 22:40:53 +0100 Subject: [PATCH 6/7] fix: Update staticcheck --- .github/workflows/pr-checks.yml | 3 ++- go.mod | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 66b4125..3dac725 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -36,8 +36,9 @@ jobs: - name: Install staticcheck uses: dominikh/staticcheck-action@v1.2.0 with: - version: "2022.1.1" + version: '2024.1.1' install-go: false + min-go-version: '1.23.1' - name: Run lint run: just lint diff --git a/go.mod b/go.mod index d307dea..069f11e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/simse/faster-graphql-codegen -go 1.23 +go 1.23.1 require ( github.com/VividCortex/ewma v1.2.0 // indirect From df427754db76eed60b01f491bf75cb4ed5da8287 Mon Sep 17 00:00:00 2001 From: simse Date: Fri, 13 Sep 2024 22:45:12 +0100 Subject: [PATCH 7/7] feat: Update README --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8b7ac8f..5942abc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ +[![Build and Release](https://github.com/simse/faster-graphql-codegen/actions/workflows/release.yml/badge.svg)](https://github.com/simse/faster-graphql-codegen/actions/workflows/release.yml) # 🚀 faster-graphql-codegen 🚀 A reimplementation of graphql-codegen designed to be (much) faster than the original. It aims to be drop-in compatible where possible. +[Docs](https://faster-graphql-codegen.simse.io/) | [Quick Start](https://faster-graphql-codegen.simse.io/quick-start) + ## Current functionality - [x] Parse single graphql schema from file - [ ] Parse and merge multiple graphql schemas @@ -10,14 +13,14 @@ A reimplementation of graphql-codegen designed to be (much) faster than the orig - [x] Comments - [x] InputObjects - [x] Objects - - [ ] Implements - - [ ] Custom Scalars + - [x] Implements + - [x] Custom Scalars - [ ] Lots of other things -- [ ] Load .yaml config +- [x] Load .yaml config - [ ] Load .js/.ts config - [ ] Extract and generate types for queries - [ ] Extract and generate types for mutations -- [ ] Monorepo support +- [x] Monorepo support ## Yo! This is still just an experiment. \ No newline at end of file