Add unit tests for reconciller #28
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: Default CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build-and-test-binary: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- name: Download go modules | |
run: go mod download | |
- name: Generate code | |
run: bash scripts/update-codegen.sh | |
- name: Validate there are no changes | |
run: | | |
git status --porcelain | |
export code=$(git status --porcelain | wc -l) | |
exit $code | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
build-and-test-helm-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
check-latest: true | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.1 | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2.6.0 | |
- name: Print chart-testing version information | |
run: ct version | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Run chart-testing (lint) | |
if: steps.list-changed.outputs.changed == 'true' | |
run: ct lint --target-branch ${{ github.event.repository.default_branch }} | |
- name: Create kind cluster | |
if: steps.list-changed.outputs.changed == 'true' | |
uses: helm/kind-action@v1.8.0 | |
with: | |
cluster_name: chart-testing | |
- name: Run chart-testing (install) | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
docker build -t ghcr.io/cdayz/k8s-image-pre-puller:local . | |
kind load --name chart-testing docker-image ghcr.io/cdayz/k8s-image-pre-puller:local | |
ct install --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "--set=image.tag=local --set=replicas=1" |