ci: switch to actions (#234)
- closes #89 Reviewed-on: https://codeberg.org/forgejo-contrib/forgejo-helm/pulls/234 Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
parent
a8c4af66f5
commit
3a1928c788
16 changed files with 456 additions and 168 deletions
26
.forgejo/actions/setup-docker/action.yml
Normal file
26
.forgejo/actions/setup-docker/action.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
# action.yml
|
||||
name: setup-docker
|
||||
description: 'setup docker'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- shell: bash
|
||||
name: create cache
|
||||
run: |
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt-get update -qq
|
||||
apt-get -q install -qq \
|
||||
containerd.io \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
;
|
||||
|
||||
- shell: bash
|
||||
run: docker info
|
13
.forgejo/actions/setup-node/action.yml
Normal file
13
.forgejo/actions/setup-node/action.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# action.yml
|
||||
name: setup-node
|
||||
description: 'setup node'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: 'npm'
|
||||
- shell: bash
|
||||
run: npm ci
|
26
.forgejo/actions/setup/action.yml
Normal file
26
.forgejo/actions/setup/action.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
# action.yml
|
||||
name: setup
|
||||
description: 'setup system'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- shell: bash
|
||||
name: create cache
|
||||
run: |
|
||||
mkdir -p /opt/hostedtoolcache
|
||||
mkdir -p /srv/forgejo-renovate/.cache/act/tool_cache
|
||||
- shell: bash
|
||||
name: install deps
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get -q install -qq \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
make \
|
||||
python3 \
|
||||
python3-wheel \
|
||||
python3-venv \
|
||||
unzip \
|
||||
;
|
178
.forgejo/workflows/build.yml
Normal file
178
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,178 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
tags:
|
||||
- v*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
HELM_VERSION: v3.11.2 # renovate: datasource=github-releases depName=helm packageName=helm/helm
|
||||
HELM_UNITTEST_VERSION: v0.3.6 # renovate: datasource=github-releases depName=helm-unittest packageName=helm-unittest/helm-unittest
|
||||
HELM_CHART_TESTING_VERSION: v3.10.1 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing
|
||||
KIND_VERSION: v0.20.0 # renovate: datasource=github-releases depName=kind packageName=kubernetes-sigs/kind
|
||||
KUBECTL_VERSION: v1.28.0 # renovate: datasource=github-releases depName=kubectl packageName=kubernetes/kubernetes
|
||||
|
||||
jobs:
|
||||
lint-node:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: cat /etc/os-release
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- uses: ./.forgejo/actions/setup
|
||||
- uses: ./.forgejo/actions/setup-node
|
||||
|
||||
- run: npm run prettier
|
||||
- run: npx markdownlint-cli .
|
||||
- run: make readme
|
||||
- run: git diff --exit-code --name-only README.md
|
||||
|
||||
lint-helm:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: cat /etc/os-release
|
||||
|
||||
- run: ps axf
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: ./.forgejo/actions/setup
|
||||
|
||||
- name: install chart-testing
|
||||
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
||||
with:
|
||||
version: ${{ env.HELM_CHART_TESTING_VERSION }}
|
||||
|
||||
- name: install helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION }}
|
||||
|
||||
- name: install helm-unittest
|
||||
run: helm plugin install --version ${{ env.HELM_UNITTEST_VERSION }} https://github.com/helm-unittest/helm-unittest
|
||||
|
||||
- run: helm dependency build
|
||||
|
||||
- run: yamllint -f colored .
|
||||
- run: helm lint
|
||||
- run: helm template --debug gitea-helm .
|
||||
- run: make unittests
|
||||
- run: ct lint --config tools/ct.yml --charts .
|
||||
|
||||
e2e:
|
||||
runs-on: k8s
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
k8s:
|
||||
# from https://hub.docker.com/r/kindest/node/tags
|
||||
# - v1.25.3 # renovate: kindest
|
||||
- v1.28.0 # renovate: kindest
|
||||
|
||||
steps:
|
||||
- run: cat /etc/os-release
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: ./.forgejo/actions/setup
|
||||
|
||||
- name: install helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||
with:
|
||||
version: ${{ env.HELM_VERSION }}
|
||||
|
||||
- name: Install chart-testing
|
||||
# TODO: pin to version when this is released: https://github.com/helm/chart-testing-action/pull/137
|
||||
uses: helm/chart-testing-action@86b540ddcecb3cc009fa2bc0f44fa5b33e9751a2 # main
|
||||
with:
|
||||
version: ${{ env.HELM_CHART_TESTING_VERSION }}
|
||||
|
||||
- uses: ./.forgejo/actions/setup-docker
|
||||
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
|
||||
with:
|
||||
node_image: kindest/node:${{ matrix.k8s }}
|
||||
kubectl_version: ${{ env.KUBECTL_VERSION }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
|
||||
- run: kubectl get no -o wide
|
||||
|
||||
- name: install chart
|
||||
run: ct install --config tools/ct.yml --charts .
|
||||
|
||||
# # Catch-all required check for test matrix
|
||||
test-success:
|
||||
needs:
|
||||
- lint-node
|
||||
- lint-helm
|
||||
- e2e
|
||||
runs-on: docker
|
||||
timeout-minutes: 1
|
||||
if: always()
|
||||
steps:
|
||||
- name: Fail for failed or cancelled lint-node
|
||||
if: |
|
||||
needs.lint-node.result == 'failure' ||
|
||||
needs.lint-node.result == 'cancelled'
|
||||
run: exit 1
|
||||
- name: Fail for failed or cancelled lint-helm
|
||||
if: |
|
||||
needs.lint-helm.result == 'failure' ||
|
||||
needs.lint-helm.result == 'cancelled'
|
||||
run: exit 1
|
||||
- name: Fail for failed or cancelled e2e
|
||||
if: |
|
||||
needs.e2e.result == 'failure' ||
|
||||
needs.e2e.result == 'cancelled'
|
||||
run: exit 1
|
||||
|
||||
publish:
|
||||
runs-on: docker
|
||||
needs:
|
||||
- test-success
|
||||
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
|
||||
- uses: ./.forgejo/actions/setup
|
||||
- uses: ./.forgejo/actions/setup-node
|
||||
|
||||
- name: install helm
|
||||
uses: https://github.com/azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
|
||||
with:
|
||||
version: v3.13.2 # renovate: datasource=github-releases depName=helm packageName=helm/helm
|
||||
|
||||
- run: helm dependency build
|
||||
- run: helm package --version "${GITHUB_REF_NAME#v}" -d tmp/ ./
|
||||
|
||||
- name: login to codeberg packages
|
||||
run: echo ${TOKEN} | helm registry login -u viceice --password-stdin codeberg.org/forgejo-contrib
|
||||
env:
|
||||
TOKEN: ${{secrets.token}}
|
||||
|
||||
- name: publish forgejo helm chart
|
||||
run: helm push tmp/forgejo-${GITHUB_REF_NAME#v}.tgz oci://codeberg.org/forgejo-contrib
|
||||
|
||||
- name: publish forgejo release
|
||||
run: npm run forgejo:release
|
Loading…
Add table
Add a link
Reference in a new issue