Skip to content

ci: Simplify shell configuration by setting defaults #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ permissions:
jobs:
unit-test:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -32,7 +35,6 @@ jobs:
enable-cache: true

- name: Run unit tests
shell: bash
run: devbox run -- make test

- name: Annotate tests
Expand All @@ -43,6 +45,9 @@ jobs:

e2e-test:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -61,25 +66,25 @@ jobs:

- if: steps.check_e2e_tests_exist.outputs.files_exists == 'true'
name: Build and install on KinD
shell: bash
run: devbox run -- make dev.run-on-kind
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- if: steps.check_e2e_tests_exist.outputs.files_exists == 'true'
name: Run e2e tests
shell: bash
run: devbox run -- make e2e-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- if: steps.check_e2e_tests_exist.outputs.files_exists == 'true' && always()
name: Cleanup KinD cluster
shell: bash
run: devbox run -- make kind.delete

lint-go:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -91,7 +96,6 @@ jobs:

- name: Export golang and golangci-lint versions
id: versions
shell: bash
run: |
echo "golangci-lint=$(devbox run -- golangci-lint version --format short)" >>"${GITHUB_OUTPUT}"
echo "golang=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>"${GITHUB_OUTPUT}"
Expand Down Expand Up @@ -130,6 +134,9 @@ jobs:

pre-commit:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -148,13 +155,15 @@ jobs:
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
shell: bash
run: devbox run -- make pre-commit
env:
SKIP: no-commit-to-branch,golangci-lint,actionlint-system

lint-test-helm:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -168,7 +177,6 @@ jobs:

- name: Run chart-testing (list-changed)
id: list-changed
shell: bash
run: |
changed="$(devbox run -- \
ct list-changed --config charts/ct-config.yaml \
Expand All @@ -179,14 +187,12 @@ jobs:

- if: steps.list-changed.outputs.changed == 'true'
name: Run chart-testing (lint)
shell: bash
run: |
devbox run -- \
ct lint --config charts/ct-config.yaml

- if: steps.list-changed.outputs.changed == 'true'
name: Create kind cluster
shell: bash
run: |
devbox run -- \
kind create cluster \
Expand All @@ -197,14 +203,12 @@ jobs:

- if: steps.list-changed.outputs.changed == 'true'
name: Build Docker images
shell: bash
run: |
devbox run -- \
make release-snapshot

- if: steps.list-changed.outputs.changed == 'true'
name: Sideload docker image
shell: bash
run: |
devbox run -- \
kind load docker-image \
Expand All @@ -213,7 +217,6 @@ jobs:

- if: steps.list-changed.outputs.changed == 'true'
name: Setup Cluster API and cert-manager
shell: bash
run: |
devbox run -- \
make clusterctl.init
Expand All @@ -222,7 +225,6 @@ jobs:

- if: steps.list-changed.outputs.changed == 'true'
name: Run chart-testing (install)
shell: bash
run: |
devbox run -- \
ct install \
Expand All @@ -233,7 +235,6 @@ jobs:

- if: steps.list-changed.outputs.changed == 'true' && always()
name: Delete chart-testing KinD cluster
shell: bash
run: |
devbox run -- \
kind delete cluster --name chart-testing || true
4 changes: 3 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
permissions:
actions: read
contents: read
Expand All @@ -36,7 +39,6 @@ jobs:
enable-cache: true

- name: Build
shell: bash
run: devbox run -- make build-snapshot

- name: Perform CodeQL Analysis
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/dependabot-automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ permissions:

jobs:
auto-approve:
runs-on: ubuntu-22.04
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
- uses: actions/checkout@v4
- name: Approve a PR if not already approved
shell: bash
run: |
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
Expand All @@ -35,14 +37,16 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

enable-automerge:
runs-on: ubuntu-22.04
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]'}}
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1
- name: Enable auto-merge for Dependabot PRs
shell: bash
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
jobs:
deploy:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
permissions:
contents: write
concurrency:
Expand All @@ -36,12 +39,10 @@ jobs:
cache-dependency-path: '**/package-lock.json'

- name: Install necessary packages
shell: bash
run: npm ci
working-directory: ./docs/

- name: Build
shell: bash
run: hugo --minify
working-directory: ./docs/

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ permissions:
jobs:
release-tag:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -35,7 +38,6 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Release
shell: bash
run: devbox run -- make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down