Nightly PR checks #201
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: Nightly PR checks | |
on: # yamllint disable-line rule:truthy | |
schedule: | |
- cron: '0 0 * * *' # run at midnight daily | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
GO111MODULE: "on" | |
GO_VERSION: "^1.20" | |
# quote this, since yaml will otherwise treat this as a float | |
PYTHON_VERSION: "3.10" | |
TEST_ACCEPTANCE_CLI: "kubectl" | |
TEST_RESULTS: "out/acceptance-tests" | |
jobs: | |
lint: | |
name: Code Quality | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: "x64" | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Lint Go | |
if: success() || failure() | |
run: make lint-go | |
env: | |
GO_LINT_CONCURRENCY: 2 | |
GO_LINT_OUTPUT: github-actions | |
- name: Lint YAML files | |
if: success() || failure() | |
run: make lint-yaml | |
- name: Lint Python | |
if: success() || failure() | |
run: make lint-python | |
- name: Lint Gherkin (feature) files | |
if: success() || failure() | |
run: make lint-feature-files | |
- name: Lint conflicts in source files | |
if: success() || failure() | |
run: make lint-conflicts | |
- name: Lint shell scripts | |
if: success() || failure() | |
run: make lint-shell | |
- name: Check manifests up to date | |
if: success() || failure() | |
run: | | |
set -e | |
make manifests | |
make primaza go-generate | |
git update-index -q --refresh | |
if ! git diff-index --quiet HEAD -- config/ ; then | |
echo "the following manifests are not up-to-date" | |
git diff config | |
exit 1 | |
fi | |
unit: | |
name: Unit Tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout Git Repository | |
uses: actions/checkout@v3 | |
- name: Unit Tests with Code Coverage | |
run: | | |
make test | |
features: | |
name: Acceptance Tests Features | |
runs-on: ubuntu-20.04 | |
outputs: | |
features: ${{ steps.features.outputs.features }} | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v3 | |
- id: features | |
run: | | |
cd test/acceptance/features | |
FEATURES=$(ls *.feature | jq -R -s -c 'split("\n")[:-1]') | |
echo "features=$FEATURES" >> $GITHUB_OUTPUT | |
build: | |
name: Build images | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- make: primaza | |
image-name: primaza-controller | |
- make: agentapp | |
image-name: agentapp | |
- make: agentsvc | |
image-name: agentsvc | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v3 | |
- name: Build images | |
run: | | |
make ${{ matrix.make }} docker-build IMG=${{ matrix.image-name }}:testing | |
docker save ${{ matrix.image-name }}:testing -o ${{ matrix.image-name }}.tar | |
- name: Upload image artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: images | |
path: ${{ matrix.image-name }}.tar | |
acceptance: | |
name: Acceptance Tests | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 90 | |
needs: ["features", "build"] | |
strategy: | |
fail-fast: false | |
matrix: | |
feature: ${{ fromJSON(needs.features.outputs.features) }} | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
architecture: "x64" | |
- name: Download pre-built images | |
uses: actions/download-artifact@v3 | |
with: | |
name: images | |
path: images/ | |
- name: Acceptance tests | |
timeout-minutes: 60 | |
run: | | |
docker load -i images/primaza-controller.tar | |
docker load -i images/agentapp.tar | |
docker load -i images/agentsvc.tar | |
make kustomize test-acceptance | |
env: | |
EXTRA_BEHAVE_ARGS: -i test/acceptance/features/${{ matrix.feature }} --tags=~@disable-github-actions | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PRIMAZA_CONTROLLER_IMAGE_REF: primaza-controller:testing | |
PRIMAZA_AGENTAPP_IMAGE_REF: agentapp:testing | |
PRIMAZA_AGENTSVC_IMAGE_REF: agentsvc:testing | |
CLUSTER_PROVIDER: kind | |
- uses: actions/upload-artifact@v3 | |
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }} | |
with: | |
name: acceptance-test-results | |
path: ${{ env.TEST_RESULTS }} | |
wait-acceptance: | |
needs: acceptance | |
name: Wait for Acceptance Tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Trigger nightly release | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.MM_TOKEN }} | |
repository: mmulholla/primaza | |
event-type: primaza-release | |
client-payload: '{"version": "nightly"}' | |
- name: None | |
if: always() | |
run: exit 0 |