Begin preparing v0.1.4 #241
Workflow file for this run
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: Build / Test | |
on: | |
push: | |
paths-ignore: | |
- 'k8s/**' | |
- '.github/workflows/chart-testing.yaml' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: mshade/kronic | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
releaseTag: ${{ steps.meta.outputs.version }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Deps | |
run: docker build --target dev -t ${IMAGE_NAME}:test . | |
- name: Run Unit Tests | |
run: docker run -i --rm -v $PWD:/app ${IMAGE_NAME}:test pytest | |
- name: Log into GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
tags: | | |
# Release tag as container tag | |
type=ref,event=tag | |
# latest for main builds | |
type=raw,value=latest,enable={{is_default_branch}} | |
# always tag with sha for reference | |
type=sha,priority=500 | |
# tag PRs | |
type=ref,event=pr | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}' | |
format: 'table' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
test-deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
check-latest: true | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Run chart-testing (lint) | |
run: | | |
ct lint --charts chart/kronic --target-branch ${{ github.event.repository.default_branch }} | |
- name: Create kind cluster | |
uses: helm/[email protected] | |
- name: Run chart-testing (install) | |
run: | | |
ct install --charts chart/kronic \ | |
--helm-extra-args '--timeout 60s' \ | |
--helm-extra-set-args '--set=image.tag=${{ needs.build.outputs.releaseTag }}' \ | |
--target-branch ${{ github.event.repository.default_branch }} |