Skip to content

Commit

Permalink
ci: add release and PR workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
SOF3 committed Nov 26, 2024
1 parent cde4f0b commit 2e3b837
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 3 deletions.
34 changes: 33 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
directory: /tools
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /apis
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /client
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /util
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /generator
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /aggregator
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /webhook
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /tests
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /allinone
schedule:
interval: weekly
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on:
pull_request:
push:
workflow_dispatch:

jobs:
test:
name: Run unit tests
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
version: 'v0.8.0'
- name: Run unit tests
run: ssh-agent earthly +test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
files: output/coverage.out

e2e:
name: Run e2e tests
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
version: 'v0.8.0'
- name: Run e2e tests
run: ssh-agent earthly -P +e2e
- name: Upload logs
uses: actions/upload-artifact@v4
with:
name: output
path: output

lint:
name: golangci-lint
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
version: 'v0.8.0'
- name: Run linters
run: ssh-agent earthly +lint

typos:
name: Check typos
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
with:
config: typos.toml
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
tags: ["v*"]

jobs:
build:
name: Build docker images
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
version: 'v0.8.0'
- name: Docker login for ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build Docker images
run: ssh-agent earthly --push +build --output_tag=${{github.ref_name}}
chart:
name: Build helm chart
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
version: 'v0.8.0'
- name: Docker login for ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build helm chart
run: |
ssh-agent earthly --ci --secret docker_config="$(cat ~/.docker/config.json)" \
+chart-push --chart_version=${{github.ref_name}} --app_version=${{github.ref_name}}
15 changes: 14 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,27 @@ chart:
RUN apk add --no-cache helm kubectl

ARG app_version='v0.0.0-dev'
ARG chart_version='0.0.0'

COPY chart chart
COPY +crd-gen/crds chart/crds
RUN helm package --app-version $app_version chart
RUN helm package --version="$chart_version" --app-version="$app_version" chart
RUN mv *.tgz chart.tgz

SAVE ARTIFACT chart.tgz AS LOCAL output/chart.tgz

chart-push:
FROM +golang-base

RUN apk add --no-cache helm

ARG registry='ghcr.io'
ARG path_prefix='kubewharf'

COPY +chart/chart.tgz chart.tgz
RUN --mount type=secret,target=/root/.docker/config.json,id=docker_config \
helm push chart.tgz oci://${registry}/${path_prefix}

build-kwok:
FROM +golang-base

Expand Down
2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: podseidon
name: podseidon-chart
description: Integrated setup configuration for podseidon
type: application
version: 0.0.0
Expand Down

0 comments on commit 2e3b837

Please sign in to comment.