From 109ef0a5e2dece922c68d9ca9310cdc99968112a Mon Sep 17 00:00:00 2001 From: Thomas De Meyer Date: Fri, 14 Jun 2024 14:18:08 +0200 Subject: [PATCH 1/3] feat: updated project files, updated dependencies --- .github/workflows/codeql.yml | 81 ++++++++++++++++++++++++++++++++++++ .github/workflows/tests.yaml | 12 +++++- Makefile | 3 -- Taskfile.yaml | 8 ++++ generate.go | 2 +- go.mod | 10 ++--- go.sum | 13 ++++-- sbmgmt/main.gen.go | 2 +- tools.go | 2 +- 9 files changed, 117 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/codeql.yml delete mode 100644 Makefile create mode 100644 Taskfile.yaml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..5d7800d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,81 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '44 19 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d50a6c7..0a609c3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -7,13 +7,17 @@ jobs: test: runs-on: ubuntu-latest + strategy: + matrix: + go-version: [ "1.20", "1.21", "1.22" ] + steps: - uses: actions/checkout@v4 - - name: Set up Go 1.20 + - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: ${{ matrix.go-version }} - name: golangci-lint continue-on-error: true @@ -29,6 +33,10 @@ jobs: with: verbose: true + - name: Has changes file + if: github.actor != 'dependabot[bot]' + uses: mach-composer/check-changie-changes-action@main + changie: runs-on: ubuntu-latest needs: test diff --git a/Makefile b/Makefile deleted file mode 100644 index a1f2dfd..0000000 --- a/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -generate: - npx @redocly/cli bundle --output openapi.yaml - oapi-codegen -config oapi-config.yaml openapi.yaml diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..5f3462b --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,8 @@ +version: '3' + +tasks: + generate: + cmds: + - npx @redocly/cli bundle --output openapi.yaml + - oapi-codegen -config oapi-config.yaml openapi.yaml + - go generate ./... diff --git a/generate.go b/generate.go index 548b000..46fd2a0 100644 --- a/generate.go +++ b/generate.go @@ -1,3 +1,3 @@ package main -//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --config oapi-config.yaml ./openapi.yaml +//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config oapi-config.yaml ./openapi.yaml diff --git a/go.mod b/go.mod index b7163d2..f6a60ff 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/labd/storyblok-go-sdk go 1.20 require ( - github.com/deepmap/oapi-codegen v1.16.3 github.com/gofrs/uuid v4.4.0+incompatible + github.com/oapi-codegen/oapi-codegen/v2 v2.3.0 github.com/oapi-codegen/runtime v1.1.1 github.com/wk8/go-ordered-map/v2 v2.1.8 ) @@ -13,7 +13,7 @@ require ( github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/buger/jsonparser v1.1.1 // indirect - github.com/getkin/kin-openapi v0.124.0 // indirect + github.com/getkin/kin-openapi v0.125.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/google/uuid v1.6.0 // indirect @@ -22,9 +22,9 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/tools v0.21.0 // indirect + golang.org/x/mod v0.18.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.22.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1933707..ce9d5c1 100644 --- a/go.sum +++ b/go.sum @@ -8,10 +8,10 @@ github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMU github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/deepmap/oapi-codegen v1.16.3 h1:GT9G86SbQtT1r8ZB+4Cybi9VGdu1P5ieNvNdEoCSbrA= -github.com/deepmap/oapi-codegen v1.16.3/go.mod h1:JD6ErqeX0nYnhdciLc61Konj3NBASREMlkHOgHn8WAM= github.com/getkin/kin-openapi v0.124.0 h1:VSFNMB9C9rTKBnQ/fpyDU8ytMTr4dWI9QovSKj9kz/M= github.com/getkin/kin-openapi v0.124.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= +github.com/getkin/kin-openapi v0.125.0 h1:jyQCyf2qXS1qvs2U00xQzkGCqYPhEhZDmSmVt65fXno= +github.com/getkin/kin-openapi v0.125.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= @@ -32,6 +32,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/oapi-codegen/oapi-codegen/v2 v2.3.0 h1:rICjNsHbPP1LttefanBPnwsSwl09SqhCO7Ee623qR84= +github.com/oapi-codegen/oapi-codegen/v2 v2.3.0/go.mod h1:4k+cJeSq5ntkwlcpQSxLxICCxQzCL772o30PxdibRt4= github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= @@ -46,14 +48,19 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/sbmgmt/main.gen.go b/sbmgmt/main.gen.go index b17e3ad..fa17ac8 100644 --- a/sbmgmt/main.gen.go +++ b/sbmgmt/main.gen.go @@ -1,6 +1,6 @@ // Package sbmgmt provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.16.3 DO NOT EDIT. +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT. package sbmgmt import ( diff --git a/tools.go b/tools.go index e5c5182..35e0f39 100644 --- a/tools.go +++ b/tools.go @@ -4,5 +4,5 @@ package main import ( - _ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen" + _ "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen" ) From 9f3d0aeda21349c165bc43831694cfab3a30f361 Mon Sep 17 00:00:00 2001 From: Thomas De Meyer Date: Fri, 14 Jun 2024 14:21:17 +0200 Subject: [PATCH 2/3] feat: run changes file once to ignore matrix --- .github/workflows/tests.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 0a609c3..e0a05f8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -33,13 +33,16 @@ jobs: with: verbose: true - - name: Has changes file - if: github.actor != 'dependabot[bot]' - uses: mach-composer/check-changie-changes-action@main + changes-file: + runs-on: ubuntu-latest + if: github.actor != 'dependabot[bot]' + steps: + - uses: actions/checkout@v4 + - uses: mach-composer/check-changie-changes-action@main changie: runs-on: ubuntu-latest - needs: test + needs: [test, changes-file] if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' permissions: contents: write From 5a174662c4cc6ee622bccac0fafc2440f9c72d32 Mon Sep 17 00:00:00 2001 From: Thomas De Meyer Date: Fri, 14 Jun 2024 14:23:23 +0200 Subject: [PATCH 3/3] feat: run changes file once to ignore matrix --- .changes/unreleased/Fixed-20240614-141426.yaml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changes/unreleased/Fixed-20240614-141426.yaml diff --git a/.changes/unreleased/Fixed-20240614-141426.yaml b/.changes/unreleased/Fixed-20240614-141426.yaml new file mode 100644 index 0000000..5d023a1 --- /dev/null +++ b/.changes/unreleased/Fixed-20240614-141426.yaml @@ -0,0 +1,3 @@ +kind: Fixed +body: Updated project +time: 2024-06-14T14:14:26.127299369+02:00