Skip to content

Commit

Permalink
chore: upgrade ci
Browse files Browse the repository at this point in the history
  • Loading branch information
JossWhittle committed May 2, 2024
1 parent bfc6c81 commit ef7b3e5
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 197 deletions.
8 changes: 8 additions & 0 deletions .github/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
per-file-ignores =
# imported but unused
__init__.py: F401

max-complexity = 10

extend-ignore = E501,C901
16 changes: 16 additions & 0 deletions .github/commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RuleConfigSeverity } from '@commitlint/types';

export default {
extends: ['@commitlint/config-conventional'],
parserPreset: 'conventional-changelog-conventionalcommits',
rules: {
'scope-enum': [RuleConfigSeverity.Error, 'always', [
'',
'deps',
'canary-container',
'canary-chart',
'canary-crds-chart'
]],
'subject-case': [RuleConfigSeverity.Error, 'never', []],
}
};
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## :construction: Suggest a change

A clear and concise description of what you are changing.

## :memo: Pre-merge checklist

Ready to merge? Do not merge until all checks are satisfied.
- [ ] :chart: Have all `required` CI checks passed on the most recent commit?
- [ ] :black_nib: Is the PR title a valid and meaningful conventional-commit message? ie. `type(scope): summary`
- [ ] :boom: Are `breaking changes` declared in the PR title in conventional-commit style? ie. `type!(scope): summary`
- [ ] :art: Does new code follow the code style of this project?
- [ ] :mag: Has new code been spellchecked and linted?
- [ ] :book: Have docs been updated where necessary?
- [ ] :poop: Have commits been checked for accidental file inclusions?
67 changes: 67 additions & 0 deletions .github/workflows/build-canary-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build Canary Chart

on:
pull_request:
# Ignore PRs on branches specifically intended for other assets
branches-ignore:
- '*/canary-container*'
- '*/canary-crds-chart*'
# Only consider PRs that change files for this asset, including ci scripts
paths:
- '.github/workflows/build-canary-chart.yaml'
- 'charts/canary/**'
# Make sure all workflows that are "required checks" for a given
# branch protection rule have the same paths: and branches-ignore:
# filters. Otherwise, you can end up in a deadlock waiting on a
# required check that will never be executed.
push:
# Only release off of release and maintenance branches for this asset
branches:
- 'maintenance/canary-chart/[0-9]+.x.x'
- 'maintenance/canary-chart/[0-9]+.[0-9]+.x'
- 'main'
# Only consider pushes that change files for this asset, including ci scripts
paths:
- '.github/workflows/build-canary-chart.yaml'
- 'charts/canary/**'

permissions:
contents: write
pull-requests: write
actions: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel early on pull requests if new commits are added,
# Don't cancel on release pushes
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
# Job name must be unique across repo to target
# branch protection rules "required checks" properly!
canary-chart:
uses: SwanseaUniversityMedical/workflows/.github/workflows/pr-and-release-chart.yaml@v2.0.0-charts
with:
job-name: canary-chart
comment-pr: "true"
comment-release: "true"
registry: ${{ vars.HARBOR_REGISTRY }}
registry-user: ${{ vars.HARBOR_USER }}
registry-project: ${{ vars.HARBOR_PROJECT }}
registry-repo: canary
release-tag-format: 'canary-chart-${version}'
cosign-public-key: ${{ vars.COSIGN_PUBLIC_KEY }}
chart: charts/canary
test-command: |
helm template $CHART \
--values charts/canary/values.yaml \
--include-crds \
--name-template canary \
--namespace canary \
--create-namespace \
--debug
secrets:
cosign-private-key: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosign-password: ${{ secrets.COSIGN_PASSWORD }}
registry-token: ${{ secrets.HARBOR_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/build-canary-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Canary Container

on:
pull_request:
# Ignore PRs on branches specifically intended for other assets
branches-ignore:
- '*/canary-chart*'
- '*/canary-crds-chart*'
# Only consider PRs that change files for this asset, including ci scripts
paths:
- '.github/workflows/lint-canary-flake8.yaml'
- '.github/workflows/build-canary-container.yaml'
- 'containers/canary/**'
- 'src/**'
# Make sure all workflows that are "required checks" for a given
# branch protection rule have the same paths: and branches-ignore:
# filters. Otherwise, you can end up in a deadlock waiting on a
# required check that will never be executed.
push:
# Only release off of release and maintenance branches for this asset
branches:
- 'maintenance/canary-container/[0-9]+.x.x'
- 'maintenance/canary-container/[0-9]+.[0-9]+.x'
- 'main'
# Only consider pushes that change files for this asset, including ci scripts
paths:
- '.github/workflows/lint-canary-flake8.yaml'
- '.github/workflows/build-canary-container.yaml'
- 'containers/canary/**'
- 'src/**'

permissions:
contents: write
pull-requests: write
actions: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel early on pull requests if new commits are added,
# Don't cancel on release pushes
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
# Job name must be unique across repo to target
# branch protection rules "required checks" properly!
canary-container:
uses: SwanseaUniversityMedical/workflows/.github/workflows/pr-and-release-container.yaml@v2.0.0-containers
with:
job-name: canary-container
comment-pr: "true"
comment-release: "true"
registry: ${{ vars.HARBOR_REGISTRY }}
registry-user: ${{ vars.HARBOR_USER }}
registry-repo: ${{ vars.HARBOR_PROJECT }}/canary
release-tag-format: 'canary-container-${version}'
cosign-public-key: ${{ vars.COSIGN_PUBLIC_KEY }}
build-file: containers/canary/Dockerfile
build-context: '.'
secrets:
cosign-private-key: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosign-password: ${{ secrets.COSIGN_PASSWORD }}
registry-token: ${{ secrets.HARBOR_TOKEN }}
38 changes: 0 additions & 38 deletions .github/workflows/flake8.yaml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/lint-canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint Canary

on:
pull_request:
# Ignore PRs on branches specifically intended for other assets
branches-ignore:
- '*/canary-chart*'
- '*/canary-crds-chart*'
# Only consider PRs that change files for this asset, including ci scripts
paths:
- '.github/workflows/lint-canary-flake8.yaml'
- '.github/workflows/build-canary-container.yaml'
- 'containers/canary/**'
- 'src/**'
# Make sure all workflows that are "required checks" for a given
# branch protection rule have the same paths: and branches-ignore:
# filters. Otherwise, you can end up in a deadlock waiting on a
# required check that will never be executed.

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# This linting can be cancelled if there is a newer commit to lint
cancel-in-progress: true

jobs:
controller-flake8:
runs-on:
labels: [self-hosted, linux, x64]
group: light

steps:
- name: clone repo
uses: actions/checkout@v4

- name: install flake8
run: pip install flake8

- name: install flake8 annotations
uses: rbialon/flake8-annotations@v1

- name: run flake8
run: |
flake8 --config=".github/.flake8" src
19 changes: 19 additions & 0 deletions .github/workflows/lint-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint PR Title

on:
pull_request:
# Run on all PRs whenever the title could have changed
types:
- opened
- reopened
- edited
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# This linting can be cancelled if there is a newer commit to lint
cancel-in-progress: true

jobs:
pr-title-commitlint:
uses: SwanseaUniversityMedical/workflows/.github/workflows/pr-title-commitlint.yaml@v1.2.0-pr-title-commitlint
79 changes: 0 additions & 79 deletions .github/workflows/on-pr-update.yaml

This file was deleted.

Loading

0 comments on commit ef7b3e5

Please sign in to comment.