Merge pull request #149 from tjhop/chore/adopt-slog #531
This file contains 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
--- | |
name: CI | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
push: | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
# Whenever the Go version is updated here, .promu.yml | |
# should also be updated. | |
container: | |
image: quay.io/prometheus/golang-builder:1.23-base | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: prometheus/[email protected] | |
- uses: ./.github/promci/actions/setup_environment | |
- run: make | |
build: | |
name: Build PromLens for common architectures | |
runs-on: ubuntu-latest | |
if: | | |
!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) | |
&& | |
!(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-')) | |
&& | |
!(github.event_name == 'push' && github.event.ref == 'refs/heads/main') | |
strategy: | |
matrix: | |
thread: [ 0, 1, 2 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: prometheus/[email protected] | |
- uses: ./.github/promci/actions/build | |
with: | |
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386" | |
parallelism: 3 | |
thread: ${{ matrix.thread }} | |
build_all: | |
name: Build PromLens for all architectures | |
runs-on: ubuntu-latest | |
if: | | |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) | |
|| | |
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-')) | |
|| | |
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') | |
strategy: | |
matrix: | |
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ] | |
# Whenever the Go version is updated here, .promu.yml | |
# should also be updated. | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: prometheus/[email protected] | |
- uses: ./.github/promci/actions/build | |
with: | |
parallelism: 12 | |
thread: ${{ matrix.thread }} | |
golangci: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Install Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: 1.23.x | |
- name: Build embed assets | |
run: ./scripts/compress_assets.sh | |
- name: Lint | |
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 | |
with: | |
args: --verbose | |
version: v1.61.0 | |
publish_main: | |
name: Publish main branch artifacts | |
runs-on: ubuntu-latest | |
needs: [test, build_all] | |
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: prometheus/[email protected] | |
- uses: ./.github/promci/actions/publish_main | |
with: | |
docker_hub_login: ${{ secrets.docker_hub_login }} | |
docker_hub_password: ${{ secrets.docker_hub_password }} | |
quay_io_login: ${{ secrets.quay_io_login }} | |
quay_io_password: ${{ secrets.quay_io_password }} | |
publish_release: | |
name: Publish release arfefacts | |
runs-on: ubuntu-latest | |
needs: [test, build_all] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: prometheus/[email protected] | |
- uses: ./.github/promci/actions/publish_release | |
with: | |
docker_hub_login: ${{ secrets.docker_hub_login }} | |
docker_hub_password: ${{ secrets.docker_hub_password }} | |
quay_io_login: ${{ secrets.quay_io_login }} | |
quay_io_password: ${{ secrets.quay_io_password }} | |
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }} |