Skip to content

Sync upstream Prometheus to ff398062c #2559

Sync upstream Prometheus to ff398062c

Sync upstream Prometheus to ff398062c #2559

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
jobs:
test:
strategy:
matrix:
buildtags:
- slicelabels # there's no such tag when this is being written, but it makes the CI job name more obvious.
- stringlabels
- dedupelabels
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: actions/setup-go@v5.1.0
with:
go-version: '~1.23.0'
cache: false # We do this ourselves below to avoid conflicts between the different jobs.
- name: Get Go paths
id: gopaths
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@v4.1.2
with:
path: ${{ steps.gopaths.outputs.GOMODCACHE }}
# Use the same dependencies cache for all instances of this 'test' job, given each will use the same dependencies.
# We don't share this cache with the 'fuzz' job below because it only uses (and therefore downloads) a subset of dependencies.
key: ci-test-dependencies-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Cache build cache
uses: actions/cache@v4.1.2
with:
path: ${{ steps.gopaths.outputs.GOCACHE }}
# Use a unique build cache for each instance of this 'test' job, given each will be built with different build tags.
key: ci-test-build-cache-${{ runner.os }}-${{ matrix.buildtags }}-${{ hashFiles('**/go.sum') }}
- name: Run Tests
run: GOOPTS=-tags=${{ matrix.buildtags }} make common-test
fuzz:
strategy:
matrix:
include:
- package: ./model/labels
fuzz: FuzzFastRegexMatcher_WithStaticallyDefinedRegularExpressions
- package: ./model/labels
fuzz: FuzzFastRegexMatcher_WithFuzzyRegularExpressions
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: actions/setup-go@v5.1.0
with:
go-version: '~1.23.0'
cache: false # We do this ourselves below to avoid conflicts between the different jobs.
- name: Get Go paths
id: gopaths
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@v4.1.2
with:
path: ${{ steps.gopaths.outputs.GOMODCACHE }}
# Use the same dependencies cache for all instances of this 'fuzz' job, given each will use the same dependencies.
key: ci-fuzz-dependencies-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Cache build cache
uses: actions/cache@v4.1.2
with:
path: ${{ steps.gopaths.outputs.GOCACHE }}
# Use the same build cache for each instance of this 'fuzz' job, given each will build the same package (model/labels) with the same build tags.
key: ci-fuzz-build-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Set -fuzztime=10m for 'main' branch
if: github.ref == 'refs/heads/main'
run: echo "fuzztime=10m" >> $GITHUB_ENV
- name: Set -fuzztime=1m for non-'main' branches
if: github.ref != 'refs/heads/main'
run: echo "fuzztime=1m" >> $GITHUB_ENV
- name: Fuzz
run: go test -run=NOTHING -fuzz=${{ matrix.fuzz }} -fuzztime=$fuzztime ${{ matrix.package }}