From 5e5f49561f982e948bbfd0e98cbd16b8f97f23da Mon Sep 17 00:00:00 2001 From: Simon Sorensen Date: Fri, 13 Sep 2024 22:47:04 +0100 Subject: [PATCH] feat: Add PR checks workflow (#3) * feat: Add staticcheck linting * fix: Fix workflow syntax error * fix: Fix lint workflow * fix: Fix go version * yeah I don't know * fix: Update staticcheck * feat: Update README --- .github/workflows/pr-checks.yml | 60 +++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 6 ++-- README.md | 11 +++--- justfile | 3 ++ 4 files changed, 74 insertions(+), 6 deletions(-) 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..3dac725 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,60 @@ +name: PR Checks + +on: + pull_request: + +jobs: + 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.23.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: "Set up Go" + uses: actions/setup-go@v5 + with: + go-version: '1.23.1' + + - name: Install staticcheck + uses: dominikh/staticcheck-action@v1.2.0 + with: + version: '2024.1.1' + install-go: false + min-go-version: '1.23.1' + + - 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.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 8bbd48f..d3ce329 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,9 @@ on: - '*' branches: - main - pull_request: + +permissions: + contents: write jobs: build: @@ -25,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 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 diff --git a/justfile b/justfile index f9131c1..8c8755a 100644 --- a/justfile +++ b/justfile @@ -30,3 +30,6 @@ build: go build -ldflags="-s -w" -o "build/$output" . done done + +lint: + staticcheck ./...