Skip to content

deps: pull in latest webmesh packages #468

deps: pull in latest webmesh packages

deps: pull in latest webmesh packages #468

Workflow file for this run

name: Build and Tests
on:
push:
branches: [main]
tags: [v*]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/webmeshproj/webmesh-cni
VERSION: ${{ startswith(github.ref, 'refs/tags/v') && github.ref_name || 'latest' }}
GO_VERSION: "1.21"
GOLANGCI_LINT_VERSION: v1.55.1
DOCKER_PLATFORMS: linux/amd64,linux/arm64,linux/arm,linux/386,linux/ppc64le,linux/s390x
CACHE_DEP_PATH: go.sum
LINT_TIMEOUT: 10m
BUNDLE_DIR: bundle
BUILD_PARALLELISM: 4
COSIGN_EXPERIMENTAL: 1
RICHGO_FORCE_COLOR: 1
jobs:
lint:
name: Static Analysis
runs-on: ${{ vars.E2E_PLATFORM == '' && 'ubuntu-latest' || vars.E2E_PLATFORM }}
permissions:
contents: "read"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Run Linting
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout ${{ env.LINT_TIMEOUT }}
skip-cache: ${{ startswith(vars.E2E_PLATFORM, 'self-hosted') }}
tests:
name: Unit Tests
runs-on: ${{ vars.E2E_PLATFORM == '' && 'ubuntu-latest' || vars.E2E_PLATFORM }}
permissions:
contents: "read"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Test Cache
uses: actions/cache@v3
if: ${{ !startswith(vars.E2E_PLATFORM, 'self-hosted') }}
with:
key: ${{ runner.os }}-ci-tests-go-${{ env.GO_VERSION }}-${{ hashFiles(env.CACHE_DEP_PATH) }}
restore-keys: ${{ runner.os }}-ci-tests-go-${{ env.GO_VERSION }}-
path: |
~/go/pkg
~/go/bin
~/.cache/go-build
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Run Unit Tests
run: make ci-test
e2e-tests:
name: E2E Tests
runs-on: ${{ vars.E2E_PLATFORM == '' && 'ubuntu-latest' || vars.E2E_PLATFORM }}
permissions:
contents: "read"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Build Cache
uses: actions/cache@v3
if: ${{ !startswith(vars.E2E_PLATFORM, 'self-hosted') }}
with:
key: ${{ runner.os }}-build-go-${{ env.GO_VERSION }}-${{ hashFiles(env.CACHE_DEP_PATH) }}
restore-keys: ${{ runner.os }}-build-go-${{ env.GO_VERSION }}-
path: |
~/go/pkg
~/.cache/go-build
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Generate Default Bundle Manifest
run: make bundle
- name: Run CNI Build
uses: goreleaser/goreleaser-action@v5
env:
SNAPSHOT: ${{ startsWith(github.ref, 'refs/tags/v') && '' || '--snapshot' }}
with:
version: latest
args: build --clean --single-target --parallelism=${{ env.BUILD_PARALLELISM }} ${{ env.SNAPSHOT }}
- name: Build Container Image
uses: docker/build-push-action@v5
id: build
with:
context: .
push: false
tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
# Assume we are running on a 64-bit platform
platforms: "${{ runner.os }}/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}"
load: true
- name: Run E2E Tests
shell: bash
env:
IMG: "${{ env.IMAGE_NAME }}:${{ env.VERSION }}"
run: make e2e
build:
name: Build Release Assets
runs-on: ${{ vars.BUILD_PLATFORM == '' && 'ubuntu-latest' || vars.BUILD_PLATFORM }}
needs: [lint, tests, e2e-tests]
permissions:
contents: "write"
id-token: "write"
packages: "write"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Build Cache
uses: actions/cache@v3
if: ${{ !startswith(vars.BUILD_PLATFORM, 'self-hosted') }}
with:
key: ${{ runner.os }}-build-go-${{ env.GO_VERSION }}-${{ hashFiles(env.CACHE_DEP_PATH) }}
restore-keys: ${{ runner.os }}-build-go-${{ env.GO_VERSION }}-
path: |
~/go/pkg
~/.cache/go-build
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Generate Bundle Manifests
run: make bundle
- name: Run CNI Build
uses: goreleaser/goreleaser-action@v5
env:
SNAPSHOT: ${{ startsWith(github.ref, 'refs/tags/v') && '' || '--snapshot' }}
with:
version: latest
args: build --clean --parallelism=${{ env.BUILD_PARALLELISM }} ${{ env.SNAPSHOT }}
- name: Login to GHCR
uses: docker/login-action@v3
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build Container Images
uses: docker/build-push-action@v5
id: build
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
platforms: ${{ env.DOCKER_PLATFORMS }}
- name: Sign Release Assets
if: ${{ github.event_name != 'pull_request' }}
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -ex
cosign sign --yes --recursive ${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
cosign sign-blob --yes \
--oidc-issuer=https://token.actions.githubusercontent.com \
--output-signature=${{ env.BUNDLE_DIR }}/bundle.yaml.sig \
--output-certificate=${{ env.BUNDLE_DIR }}/bundle.yaml.sig.cert \
${{ env.BUNDLE_DIR }}/bundle.yaml
- name: Run CNI Release
uses: goreleaser/goreleaser-action@v5
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
version: latest
args: release --clean --parallelism=${{ env.BUILD_PARALLELISM }}