chore(deps): update docker/metadata-action digest to 60a0d34 #158
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: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
env: | |
# Default minimum version of Go to support. | |
DEFAULT_GO_VERSION: 1.19 | |
# renovate: datasource=github-tags depName=kudobuilder/kuttl | |
KUTTL_VERSION: "v0.15.0" | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Module cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-mod-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
- name: Run linter | |
run: make lint | |
test: | |
name: Component Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Module cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-mod-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
- name: Run tests | |
run: make component-test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: component-tests | |
unit-test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
- name: Setup Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Module cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: go-mod-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Unit Test | |
run: make unit-test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: unit-tests | |
docker-local: | |
permissions: | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
outputs: type=docker,dest=${{ github.workspace }}/open-feature-operator-local.tar | |
tags: open-feature-operator-local:${{ github.sha }} | |
cache-from: type=gha,scope=${{ github.ref_name }}-ofo | |
cache-to: type=gha,scope=${{ github.ref_name }}-ofo | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
input: /github/workspace/open-feature-operator-local.tar | |
format: "template" | |
template: "@/contrib/sarif.tpl" | |
output: "trivy-results.sarif" | |
severity: "CRITICAL,HIGH" | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: "trivy-results.sarif" | |
- name: Upload image as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: open-feature-operator-local-${{ github.sha }} | |
path: ${{ github.workspace }}/open-feature-operator-local.tar | |
e2e-test: | |
runs-on: ubuntu-latest | |
needs: docker-local | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.DEFAULT_GO_VERSION }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download image | |
uses: actions/download-artifact@v3 | |
with: | |
name: open-feature-operator-local-${{ github.sha }} | |
path: ${{ github.workspace }} | |
- name: Load open-feature-operator image into docker | |
run: | | |
docker load --input ${{ github.workspace }}/open-feature-operator-local.tar | |
- name: Create k8s Kind Cluster | |
uses: helm/kind-action@v1.5.0 | |
with: | |
config: ./test/e2e/kind-cluster.yml | |
cluster_name: open-feature-operator-test | |
- name: Download KUTTL | |
run: | | |
curl -fL https://github.com/kudobuilder/kuttl/releases/download/${{ env.KUTTL_VERSION }}/kubectl-kuttl_${KUTTL_VERSION#v}_linux_x86_64 -o kubectl-kuttl | |
chmod +x kubectl-kuttl | |
mv kubectl-kuttl /usr/local/bin | |
- name: Load open-feature-operator image into Kind cluster | |
run: | | |
kind load docker-image open-feature-operator-local:${{ github.sha }} --name open-feature-operator-test | |
- name: Run e2e test | |
run: | | |
IMG=open-feature-operator-local:${{ github.sha }} make deploy-operator | |
IMG=open-feature-operator-local:${{ github.sha }} make e2e-test-kuttl | |
- name: Create reports | |
if: always() | |
working-directory: ./.github/scripts | |
run: ./create-reports.sh | |
- name: Upload cluster logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: e2e-tests | |
path: .github/scripts/logs |