From 92b87d2139a3e816814dc24e71bf303e2ab7e685 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Fri, 24 Oct 2025 15:57:58 +0200 Subject: [PATCH 1/4] chore(ci): Add CRLF detection and fix targets to prevent CRLF contamination Add two new Makefile targets to detect and fix carriage return (CRLF) line endings that can contaminate the codebase from Windows environments: - check-crlf: Scans all text files (excluding hidden dirs and vendor) for CRLF line endings and fails if any are found - fix-crlf: Automatically converts CRLF to LF using the tr command Add CRLF check to CI workflow to catch line ending issues early in PRs. The check runs immediately after checkout, before any other validation. Also rename go.yml to validate.yml to better reflect the workflow's purpose, and fix job name casing (supportedVersions -> supported_versions). Signed-off-by: Kemal Akkoyun --- .github/workflows/{go.yml => validate.yml} | 135 +++++++++++---------- Makefile | 20 +++ 2 files changed, 89 insertions(+), 66 deletions(-) rename .github/workflows/{go.yml => validate.yml} (95%) diff --git a/.github/workflows/go.yml b/.github/workflows/validate.yml similarity index 95% rename from .github/workflows/go.yml rename to .github/workflows/validate.yml index 1bf5121ce..73c19bea2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/validate.yml @@ -1,68 +1,71 @@ ---- -name: Go -on: - pull_request: - push: - branches: - - main - - "release-*" - -# Modified to avoid canceling all matrix jobs when one fails -# Each job type will have its own concurrency group -concurrency: - group: ${{ github.workflow }}-${{ github.job }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} - cancel-in-progress: true - -# Minimal permissions to be inherited by any job that don't declare it's own permissions -permissions: - contents: read - -jobs: - supportedVersions: - name: Fetch supported Go versions - runs-on: ubuntu-latest - outputs: - supported_versions: ${{ steps.matrix.outputs.supported_versions }} - steps: - - name: Checkout code +--- +name: Validate +on: + pull_request: + push: + branches: + - main + - "release-*" + +# Modified to avoid canceling all matrix jobs when one fails +# Each job type will have its own concurrency group +concurrency: + group: ${{ github.workflow }}-${{ github.job }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} + cancel-in-progress: true + +# Minimal permissions to be inherited by any job that don't declare it's own permissions +permissions: + contents: read + +jobs: + supported_versions: + name: Fetch supported Go versions + runs-on: ubuntu-latest + outputs: + supported_versions: ${{ steps.matrix.outputs.supported_versions }} + steps: + - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - name: Read supported_go_versions.txt - id: matrix - run: | - versions=$(cat supported_go_versions.txt) - matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]" - echo "supported_versions=$matrix" >> $GITHUB_OUTPUT - - test: - name: Tests (${{ matrix.go_version }}) - runs-on: ubuntu-latest - needs: supportedVersions - # Set fail-fast to false to ensure all Go versions are tested regardless of failures - strategy: - fail-fast: false - matrix: - go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }} - # Define concurrency at the job level for matrix jobs - concurrency: - group: ${{ github.workflow }}-test-${{ matrix.go_version }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} - cancel-in-progress: true - - steps: - - name: Checkout code + - name: Read supported_go_versions.txt + id: matrix + run: | + versions=$(cat supported_go_versions.txt) + matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]" + echo "supported_versions=$matrix" >> $GITHUB_OUTPUT + + test: + name: Tests (${{ matrix.go_version }}) + runs-on: ubuntu-latest + needs: supportedVersions + # Set fail-fast to false to ensure all Go versions are tested regardless of failures + strategy: + fail-fast: false + matrix: + go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }} + # Define concurrency at the job level for matrix jobs + concurrency: + group: ${{ github.workflow }}-test-${{ matrix.go_version }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} + cancel-in-progress: true + + steps: + - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Set up Go ${{ matrix.go_version }} - uses: actions/setup-go@v6.0.0 - with: - go-version: ${{ matrix.go_version }} - check-latest: true - cache-dependency-path: go.sum - - - name: Run tests and check license - run: make check_license test - env: - CI: true - - - name: Run style and unused - if: ${{ matrix.go_version == '1.22' }} - run: make style unused + + - name: Check for CRLF line endings + run: make check-crlf + + - name: Set up Go ${{ matrix.go_version }} + uses: actions/setup-go@v6.0.0 + with: + go-version: ${{ matrix.go_version }} + check-latest: true + cache-dependency-path: go.sum + + - name: Run tests and check license + run: make check_license test + env: + CI: true + + - name: Run style and unused + if: ${{ matrix.go_version == '1.22' }} + run: make style unused diff --git a/Makefile b/Makefile index 2a5817c02..ff01ce882 100644 --- a/Makefile +++ b/Makefile @@ -65,3 +65,23 @@ test-exp: .PHONY: test-exp-short test-exp-short: cd exp && $(GOTEST) -short $(GOOPTS) $(pkgs) + +.PHONY: check-crlf +check-crlf: + @echo ">> checking for CRLF line endings" + @files=$$(find . -type f -not -path "*/\.*" -not -path "*/vendor/*" -exec file {} \; | grep CRLF | cut -d: -f1); \ + if [ -n "$$files" ]; then \ + echo "Files with CRLF line endings found:"; \ + echo "$$files"; \ + echo "Run 'make fix-crlf' to fix them"; \ + exit 1; \ + fi + +.PHONY: fix-crlf +fix-crlf: + @echo ">> fixing CRLF line endings" + @files=$$(find . -type f -not -path "*/\.*" -not -path "*/vendor/*" -exec file {} \; | grep CRLF | cut -d: -f1); \ + for file in $$files; do \ + tr -d '\r' < "$$file" > "$$file.tmp" && mv "$$file.tmp" "$$file"; \ + done + @echo ">> CRLF line endings fixed" From 48bb7861b464882987d0d96ff0e6b1221d77f3e6 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Fri, 24 Oct 2025 16:14:23 +0200 Subject: [PATCH 2/4] chore(go/fmt): Fix formatting issues Signed-off-by: Kemal Akkoyun --- api/prometheus/v1/api_bench_test.go | 2 +- internal/github.com/golang/gddo/httputil/header/header.go | 2 +- prometheus/example_clustermanager_test.go | 2 +- prometheus/graphite/bridge_test.go | 2 +- prometheus/promhttp/instrument_server.go | 2 +- prometheus/promhttp/instrument_server_test.go | 2 +- prometheus/summary_test.go | 2 +- tutorials/whatsup/internal/acceptance_test.go | 1 - tutorials/whatsup/main.go | 2 +- 9 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/prometheus/v1/api_bench_test.go b/api/prometheus/v1/api_bench_test.go index f1f8000ef..97f502e56 100644 --- a/api/prometheus/v1/api_bench_test.go +++ b/api/prometheus/v1/api_bench_test.go @@ -100,7 +100,7 @@ func generateData(timeseries, datapoints int) (floatMatrix, histogramMatrix mode floatMatrix = append(floatMatrix, fss) histogramMatrix = append(histogramMatrix, hss) } - return + return floatMatrix, histogramMatrix } func BenchmarkSamplesJsonSerialization(b *testing.B) { diff --git a/internal/github.com/golang/gddo/httputil/header/header.go b/internal/github.com/golang/gddo/httputil/header/header.go index 8547c8dfd..820bf436a 100644 --- a/internal/github.com/golang/gddo/httputil/header/header.go +++ b/internal/github.com/golang/gddo/httputil/header/header.go @@ -90,7 +90,7 @@ loop: s = skipSpace(s[1:]) } } - return + return specs } func skipSpace(s string) (rest string) { diff --git a/prometheus/example_clustermanager_test.go b/prometheus/example_clustermanager_test.go index 92b61ca85..efe06f758 100644 --- a/prometheus/example_clustermanager_test.go +++ b/prometheus/example_clustermanager_test.go @@ -53,7 +53,7 @@ func (c *ClusterManager) ReallyExpensiveAssessmentOfTheSystemState() ( "foo.example.org": 6.023e23, "bar.example.org": 3.14, } - return + return oomCountByHost, ramUsageByHost } // ClusterManagerCollector implements the Collector interface. diff --git a/prometheus/graphite/bridge_test.go b/prometheus/graphite/bridge_test.go index 8c596d5ac..10a674a2c 100644 --- a/prometheus/graphite/bridge_test.go +++ b/prometheus/graphite/bridge_test.go @@ -342,7 +342,7 @@ func stringToLines(s string) (lines []string, err error) { lines = append(lines, scanner.Text()) } err = scanner.Err() - return + return lines, err } func TestPush(t *testing.T) { diff --git a/prometheus/promhttp/instrument_server.go b/prometheus/promhttp/instrument_server.go index 9332b0249..66878b80a 100644 --- a/prometheus/promhttp/instrument_server.go +++ b/prometheus/promhttp/instrument_server.go @@ -366,7 +366,7 @@ func checkLabels(c prometheus.Collector) (code, method bool) { panic("metric partitioned with non-supported labels") } } - return + return code, method } func isLabelCurried(c prometheus.Collector, label string) bool { diff --git a/prometheus/promhttp/instrument_server_test.go b/prometheus/promhttp/instrument_server_test.go index 45640e605..e769cb9ba 100644 --- a/prometheus/promhttp/instrument_server_test.go +++ b/prometheus/promhttp/instrument_server_test.go @@ -324,7 +324,7 @@ func TestLabels(t *testing.T) { panic("metric partitioned with non-supported labels for this test") } } - return + return gotCode, gotMethod } equalLabels := func(gotLabels, wantLabels prometheus.Labels) bool { if len(gotLabels) != len(wantLabels) { diff --git a/prometheus/summary_test.go b/prometheus/summary_test.go index 440237206..2067449b4 100644 --- a/prometheus/summary_test.go +++ b/prometheus/summary_test.go @@ -422,7 +422,7 @@ func getBounds(vars []float64, q, Îĩ float64) (minBound, maxBound float64) { if upper < len(vars) { maxBound = vars[upper-1] } - return + return minBound, maxBound } func TestSummaryVecCreatedTimestampWithDeletes(t *testing.T) { diff --git a/tutorials/whatsup/internal/acceptance_test.go b/tutorials/whatsup/internal/acceptance_test.go index 38533c495..57848a9b9 100644 --- a/tutorials/whatsup/internal/acceptance_test.go +++ b/tutorials/whatsup/internal/acceptance_test.go @@ -78,5 +78,4 @@ func TestAcceptance(t *testing.T) { if gotErr { fmt.Println("Got this response from ", fmt.Sprintf("http://localhost:%v", WhatsupPort), ":", metrics) } - } diff --git a/tutorials/whatsup/main.go b/tutorials/whatsup/main.go index 5943eefb0..15ebd4e72 100644 --- a/tutorials/whatsup/main.go +++ b/tutorials/whatsup/main.go @@ -73,7 +73,7 @@ func runMain(opts internal.Config) (err error) { m := http.NewServeMux() // Create HTTP handler for Prometheus metrics. // TODO - //m.Handle("/metrics", ... + // m.Handle("/metrics", ... promClient, err := api.NewClient(api.Config{ Client: &http.Client{Transport: instrumentRoundTripper(nil, "prometheus", http.DefaultTransport)}, From 022e48100b93511d92a0a2af4f6aaac817f5c34e Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Fri, 24 Oct 2025 16:15:46 +0200 Subject: [PATCH 3/4] chore(ci): Add yaml and action formatter/linter to CI Signed-off-by: Kemal Akkoyun --- .github/actionlint.yaml | 2 ++ .github/workflows/validate.yml | 19 +++++++++++++++++++ .yamlfmt | 17 +++++++++++++++++ Makefile | 24 ++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 .github/actionlint.yaml create mode 100644 .yamlfmt diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 000000000..8a9a13016 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,2 @@ +# actionlint configuration +# https://github.com/rhysd/actionlint/blob/main/docs/config.md diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 73c19bea2..6647ea346 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -69,3 +69,22 @@ jobs: - name: Run style and unused if: ${{ matrix.go_version == '1.22' }} run: make style unused + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Set up Go + uses: actions/setup-go@v6.0.0 + with: + go-version: stable + check-latest: true + + - name: Lint YAML files + run: make lint-yaml + + - name: Lint GitHub Actions workflows + run: make lint-actions diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 000000000..65f1cfcdb --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,17 @@ +# yamlfmt configuration +# https://github.com/google/yamlfmt + +doublestar: true + +exclude: + - "**/testdata/**" + - "**/*testdata*/**" + +gitignore_excludes: true + +formatter: + type: basic + indent: 2 + include_document_start: false + retain_line_breaks: true + max_line_length: 0 diff --git a/Makefile b/Makefile index ff01ce882..6e5f0c7da 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,30 @@ test-exp: test-exp-short: cd exp && $(GOTEST) -short $(GOOPTS) $(pkgs) +YAMLFMT := $(FIRST_GOPATH)/bin/yamlfmt +ACTIONLINT := $(FIRST_GOPATH)/bin/actionlint + +$(YAMLFMT): + go install github.com/google/yamlfmt/cmd/yamlfmt@latest + +$(ACTIONLINT): + go install github.com/rhysd/actionlint/cmd/actionlint@latest + +.PHONY: format-yaml +format-yaml: $(YAMLFMT) + @echo ">> formatting YAML files" + $(YAMLFMT) -dstar '**/*.yml' '**/*.yaml' + +.PHONY: lint-yaml +lint-yaml: $(YAMLFMT) + @echo ">> linting YAML files" + $(YAMLFMT) -lint -dstar '**/*.yml' '**/*.yaml' + +.PHONY: lint-actions +lint-actions: $(ACTIONLINT) + @echo ">> linting GitHub Actions workflows" + $(ACTIONLINT) + .PHONY: check-crlf check-crlf: @echo ">> checking for CRLF line endings" From 02e9e1cf1b3ff6905ce9f104fd38325d9ed24745 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Fri, 24 Oct 2025 16:23:56 +0200 Subject: [PATCH 4/4] chore(.github/workflows): Fix action formats and issues Signed-off-by: Kemal Akkoyun --- .github/settings.yml | 1 - .github/stale.yml | 10 +--- .github/workflows/codeql-analysis.yml | 56 ++++++++++----------- .github/workflows/container_description.yml | 9 ++-- .github/workflows/golangci-lint.yml | 7 ++- .github/workflows/scorecard.yml | 2 +- .github/workflows/update-go-versions.yml | 1 - .github/workflows/validate.yml | 13 +++-- exp/api/remote/genproto/buf.gen.yaml | 28 +++++------ 9 files changed, 58 insertions(+), 69 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index e78499030..d5c2434e1 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,4 +1,3 @@ ---- branches: - name: main protection: diff --git a/.github/stale.yml b/.github/stale.yml index d9fa51d57..e7da8955d 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -68,10 +68,7 @@ pull: daysUntilClose: 14 daysUntilStale: 60 markComment: > - Hello 👋 Looks like there was no activity on this amazing PR for the last 60 days. - **Do you mind updating us on the status?** Is there anything we can help with? If you plan to still work on it, just comment on this PR or push a commit. Thanks! 🤗 - - If there will be no activity in the next 2 weeks, this issue will be closed (we can always reopen a PR if you get back to this!). + Hello 👋 Looks like there was no activity on this amazing PR for the last 60 days. **Do you mind updating us on the status?** Is there anything we can help with? If you plan to still work on it, just comment on this PR or push a commit. Thanks! 🤗 #magic___^_^___line If there will be no activity in the next 2 weeks, this issue will be closed (we can always reopen a PR if you get back to this!). # unmarkComment: No need for unmark comment. closeComment: > Closing for now as promised, let us know if you need this to be reopened! 🤗 @@ -79,10 +76,7 @@ issues: daysUntilClose: 90 daysUntilStale: 180 markComment: > - Hello 👋 Looks like there was no activity on this issue for the last 3 months. - **Do you mind updating us on the status?** Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 - - If there will be no activity in the next 4 weeks, this issue will be closed (we can always reopen an issue if we need!). + Hello 👋 Looks like there was no activity on this issue for the last 3 months. **Do you mind updating us on the status?** Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗 #magic___^_^___line If there will be no activity in the next 4 weeks, this issue will be closed (we can always reopen an issue if we need!). # unmarkComment: No need for unmark comment. closeComment: > Closing for now as promised, let us know if you need this to be reopened! 🤗 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8ade528ba..7963db46c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - cron: '31 21 * * 6' @@ -40,39 +40,39 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'go' ] + language: ['go'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 - 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. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 + 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. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, 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@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 + # Autobuild attempts to build any compiled languages (C/C++, C#, 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@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 diff --git a/.github/workflows/container_description.yml b/.github/workflows/container_description.yml index c7c7ac776..74f72d245 100644 --- a/.github/workflows/container_description.yml +++ b/.github/workflows/container_description.yml @@ -1,4 +1,3 @@ ---- name: Push README to Docker Hub on: push: @@ -6,7 +5,7 @@ on: - "README.md" - "README-containers.md" - ".github/workflows/container_description.yml" - branches: [ main, master ] + branches: [main, master] permissions: contents: read @@ -22,7 +21,7 @@ jobs: with: persist-credentials: false - name: Set docker hub repo name - run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV + run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> "$GITHUB_ENV" - name: Push README to Dockerhub uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1 env: @@ -46,9 +45,9 @@ jobs: with: persist-credentials: false - name: Set quay.io org name - run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV + run: echo "DOCKER_REPO=$(echo "quay.io/${GITHUB_REPOSITORY_OWNER}" | tr -d '-')" >> "$GITHUB_ENV" - name: Set quay.io repo name - run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV + run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> "$GITHUB_ENV" - name: Push README to quay.io uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1 env: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index cde2b76f2..e3b828b02 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,4 +1,3 @@ ---- # This action is synced from https://github.com/prometheus/prometheus name: golangci-lint on: @@ -12,14 +11,14 @@ on: - ".golangci.yml" pull_request: -permissions: # added using https://github.com/step-security/secure-repo +permissions: # added using https://github.com/step-security/secure-repo contents: read jobs: golangci: permissions: - contents: read # for actions/checkout to fetch code - pull-requests: read # for golangci/golangci-lint-action to fetch pull requests + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests name: lint runs-on: ubuntu-latest steps: diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index a2dc3d2fb..241f7e44b 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -9,7 +9,7 @@ on: schedule: - cron: '22 1 * * 0' push: - branches: [ "main" ] + branches: ["main"] # Declare default permissions as read only. permissions: read-all diff --git a/.github/workflows/update-go-versions.yml b/.github/workflows/update-go-versions.yml index 3e2a05139..4685af2c2 100644 --- a/.github/workflows/update-go-versions.yml +++ b/.github/workflows/update-go-versions.yml @@ -1,4 +1,3 @@ ---- name: Generate Metric files for new Go version on: diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 6647ea346..c6f0493e1 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,4 +1,3 @@ ---- name: Validate on: pull_request: @@ -22,26 +21,26 @@ jobs: name: Fetch supported Go versions runs-on: ubuntu-latest outputs: - supported_versions: ${{ steps.matrix.outputs.supported_versions }} + supported_versions: ${{ steps.matrix.outputs.supported_versions }} steps: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Read supported_go_versions.txt id: matrix run: | - versions=$(cat supported_go_versions.txt) - matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]" - echo "supported_versions=$matrix" >> $GITHUB_OUTPUT + versions="$(cat supported_go_versions.txt)" + matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]" + echo "supported_versions=$matrix" >> "$GITHUB_OUTPUT" test: name: Tests (${{ matrix.go_version }}) runs-on: ubuntu-latest - needs: supportedVersions + needs: supported_versions # Set fail-fast to false to ensure all Go versions are tested regardless of failures strategy: fail-fast: false matrix: - go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }} + go_version: ${{ fromJSON(needs.supported_versions.outputs.supported_versions) }} # Define concurrency at the job level for matrix jobs concurrency: group: ${{ github.workflow }}-test-${{ matrix.go_version }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} diff --git a/exp/api/remote/genproto/buf.gen.yaml b/exp/api/remote/genproto/buf.gen.yaml index 63e34a0d7..64369538a 100644 --- a/exp/api/remote/genproto/buf.gen.yaml +++ b/exp/api/remote/genproto/buf.gen.yaml @@ -2,20 +2,20 @@ version: v2 plugins: -- remote: buf.build/protocolbuffers/go:v1.31.0 - out: . - opt: - - Mio/prometheus/write/v2/types.proto=./v2 + - remote: buf.build/protocolbuffers/go:v1.31.0 + out: . + opt: + - Mio/prometheus/write/v2/types.proto=./v2 -# vtproto for efficiency utilities like pooling etc. -# https://buf.build/community/planetscale-vtprotobuf?version=v0.6.0 -- remote: buf.build/community/planetscale-vtprotobuf:v0.6.0 - out: . - opt: - - Mio/prometheus/write/v2/types.proto=./v2 - - features=marshal+unmarshal+size + # vtproto for efficiency utilities like pooling etc. + # https://buf.build/community/planetscale-vtprotobuf?version=v0.6.0 + - remote: buf.build/community/planetscale-vtprotobuf:v0.6.0 + out: . + opt: + - Mio/prometheus/write/v2/types.proto=./v2 + - features=marshal+unmarshal+size inputs: -- module: buf.build/prometheus/prometheus:5b212ab78fb7460e831cf7ff2d83e385 - types: - - "io.prometheus.write.v2.Request" + - module: buf.build/prometheus/prometheus:5b212ab78fb7460e831cf7ff2d83e385 + types: + - "io.prometheus.write.v2.Request"