-
Couldn't load subscription status.
- Fork 1.2k
chore(ci): Add CRLF detection and fix targets to prevent CRLF contamination #1898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kakkoyun
wants to merge
1
commit into
prometheus:main
Choose a base branch
from
kakkoyun:feature/crlf-detection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
135 changes: 69 additions & 66 deletions
135
.github/workflows/go.yml → .github/workflows/validate.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep Go name (also in file)? Otherwise we need to change GH CI required checks and generally change the experience of contributing to client_golang. Is it worth the name change?