Skip to content

[processor/ratelimit] Add new component ratelimitprocessor #742

[processor/ratelimit] Add new component ratelimitprocessor

[processor/ratelimit] Add new component ratelimitprocessor #742

Workflow file for this run

name: build-and-test
on:
push:
branches: [ main ]
tags:
merge_group:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
setup-environment:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.7"
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v4
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
lint-matrix:
strategy:
fail-fast: false
matrix:
test:
- windows
- linux
group:
- all
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.7"
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v4
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: Cache Lint Build
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: go-lint-build-${{ matrix.group }}-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Lint
run: GOOS=${{ matrix.os }} GOARCH=amd64 make -j2 golint GROUP=${{ matrix.group }}
lint:
if: always()
runs-on: ubuntu-latest
needs: [setup-environment, lint-matrix]
steps:
- name: Print result
run: echo ${{ needs.lint-matrix.result }}
- name: Interpret result
run: |
if [[ success == ${{ needs.lint-matrix.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi
govulncheck:
strategy:
fail-fast: false
matrix:
group:
- all
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.7"
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v4
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: Run `govulncheck`
run: make -j2 gogovulncheck GROUP=${{ matrix.group }}
checks:
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.7"
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v4
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: License
run: |
make -j2 golicense || (echo 'License headers are out of date, please run "make license-update" and commit the changes in this PR.' && exit 1)
- name: Porto
run: |
make -j2 goporto
git diff --exit-code || (echo 'Porto links are out of date, please run "make goporto" and commit the changes in this PR.' && exit 1)
- name: Check for go mod dependency changes
run: |
make gotidy
git diff --exit-code || (echo 'go.mod/go.sum deps changes detected, please run "make gotidy" and commit the changes in this PR.' && exit 1)
- name: CodeGen
run: |
make -j2 gogenerate && make -j2 license-update
if [[ -n $(git status -s) ]]; then
echo 'Generated code is out of date, please run "make generate" and commit the changes in this PR.'
exit 1
fi
unittest-matrix:
strategy:
fail-fast: false
matrix:
go-version: ["1.22.7", "1.23.1"] # 1.20 is interpreted as 1.2 without quotes
runner: [ubuntu-latest]
group:
- all
runs-on: ${{ matrix.runner }}
needs: [setup-environment]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v4
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: Cache Test Build
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: go-test-build-${{ runner.os }}-${{ matrix.go-version }}-${{ matrix.runner }}-${{ hashFiles('**/go.sum') }}
- name: Run Unit Tests
if: startsWith( matrix.go-version, '1.22' ) != true
run: make gotest GROUP=${{ matrix.group }}
unittest:
if: always()
runs-on: ubuntu-latest
needs: [setup-environment, unittest-matrix]
steps:
- name: Print result
run: echo ${{ needs.unittest-matrix.result }}
- name: Interpret result
run: |
if [[ success == ${{ needs.unittest-matrix.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi
build-components-collector:
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
- uses: actions/checkout@v4
- name: Build testing component's collector and validate example configuration
run: make elasticcol-validate