ci: testing

This commit is contained in:
Michael Kriese 2023-12-07 14:38:39 +01:00
parent 15ff8f9d1a
commit 59e114acd0
No known key found for this signature in database
GPG key ID: B83F553A0724D44E

View file

@ -20,28 +20,30 @@ env:
KUBECTL_VERSION: v1.21.0 # renovate: datasource=github-releases depName=kubectl packageName=kubernetes/kubernetes KUBECTL_VERSION: v1.21.0 # renovate: datasource=github-releases depName=kubectl packageName=kubernetes/kubernetes
jobs: jobs:
lint-node: # lint-node:
runs-on: self-hosted # runs-on: self-hosted
steps: # steps:
- run: cat /etc/os-release # - run: cat /etc/os-release
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
with: # with:
show-progress: false # show-progress: false
- uses: ./.forgejo/actions/setup # - uses: ./.forgejo/actions/setup
- uses: ./.forgejo/actions/setup-node # - uses: ./.forgejo/actions/setup-node
- run: npm run prettier # - run: npm run prettier
- run: npx markdownlint-cli . # - run: npx markdownlint-cli .
- run: make readme # - run: make readme
- run: git diff --exit-code --name-only README.md # - run: git diff --exit-code --name-only README.md
lint-helm: lint-helm:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- run: cat /etc/os-release - run: cat /etc/os-release
- run: ps axf
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
show-progress: false show-progress: false
@ -49,18 +51,18 @@ jobs:
- uses: ./.forgejo/actions/setup - uses: ./.forgejo/actions/setup
- name: install helm ${{ env.HELM_VERSION }} - 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 uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with: with:
version: ${{ env.HELM_VERSION }} version: ${{ env.HELM_VERSION }}
- run: helm plugin install --version ${{ env.HELM_UNITTEST_VERSION }} https://github.com/helm-unittest/helm-unittest - run: helm plugin install --version ${{ env.HELM_UNITTEST_VERSION }} https://github.com/helm-unittest/helm-unittest
- name: install chart-testing ${{ env.HELM_CHART_TESTING_VERSION }}
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
with:
version: ${{ env.HELM_CHART_TESTING_VERSION }}
- run: helm dependency build - run: helm dependency build
- run: yamllint -f colored . - run: yamllint -f colored .
@ -69,131 +71,131 @@ jobs:
- run: make unittests - run: make unittests
- run: ct lint --config tools/ct.yml --charts . - run: ct lint --config tools/ct.yml --charts .
e2e: # e2e:
runs-on: self-hosted # runs-on: self-hosted
strategy: # strategy:
matrix: # matrix:
k8s: # k8s:
# from https://hub.docker.com/r/kindest/node/tags # # from https://hub.docker.com/r/kindest/node/tags
# - v1.25.3 # renovate: kindest # # - v1.25.3 # renovate: kindest
- v1.28.0 # renovate: kindest # - v1.28.0 # renovate: kindest
steps: # steps:
- run: cat /etc/os-release # - run: cat /etc/os-release
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
with: # with:
show-progress: false # show-progress: false
fetch-depth: 0 # fetch-depth: 0
- uses: ./.forgejo/actions/setup # - uses: ./.forgejo/actions/setup
- uses: ./.forgejo/actions/setup-node # - uses: ./.forgejo/actions/setup-node
- name: install docker # - name: install docker
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 \
docker-ce \
docker-ce-cli \
containerd.io \
;
# - run: pip3 install yamllint yamale
# - name: install kind ${{ env.KIND_VERSION }}
# run: | # run: |
# curl -Lo /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" # install -m 0755 -d /etc/apt/keyrings
# chmod +x /usr/local/bin/kind # curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# kind --version # 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 \
# docker-ce \
# docker-ce-cli \
# containerd.io \
# ;
# - name: install chart-testing ${{ env.HELM_CHART_TESTING_VERSION }} # # - run: pip3 install yamllint yamale
# run: |
# curl -LO "https://github.com/helm/chart-testing/releases/download/${HELM_CHART_TESTING_VERSION}/chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz"
# tar -C "/usr/local/bin" -xf "chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz" ct
# mkdir /etc/ct
# tar --strip 1 -C "/etc/ct" -xf "chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz" etc
# rm "chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz"
# ct --version
- run: docker info # # - name: install kind ${{ env.KIND_VERSION }}
# # run: |
# # curl -Lo /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64"
# # chmod +x /usr/local/bin/kind
# # kind --version
- name: Create ${{ matrix.k8s }} cluster with kind ${{ env.KIND_VERSION }} # # - name: install chart-testing ${{ env.HELM_CHART_TESTING_VERSION }}
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0 # # run: |
with: # # curl -LO "https://github.com/helm/chart-testing/releases/download/${HELM_CHART_TESTING_VERSION}/chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz"
node_image: kindest/node:${{ matrix.k8s }} # # tar -C "/usr/local/bin" -xf "chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz" ct
version: ${{ env.KIND_VERSION }} # # mkdir /etc/ct
# # tar --strip 1 -C "/etc/ct" -xf "chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz" etc
# # rm "chart-testing_${HELM_CHART_TESTING_VERSION#v}_linux_amd64.tar.gz"
# # ct --version
- run: kubectl get no -o wide # - run: docker info
- name: Install chart-testing ${{ env.HELM_CHART_TESTING_VERSION }} # - name: Create kind cluster
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 # uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
with: # with:
version: ${{ env.HELM_CHART_TESTING_VERSION }} # node_image: kindest/node:${{ matrix.k8s }}
# version: ${{ env.KIND_VERSION }}
# Catch-all required check for test matrix # - run: kubectl get no -o wide
test-success:
needs:
- lint-node
- lint-helm
- e2e
runs-on: self-hosted
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: # - name: Install chart-testing
runs-on: self-hosted # uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
needs: # with:
- test-success # version: ${{ env.HELM_CHART_TESTING_VERSION }}
if: ${{ github.ref_type == 'tag' }} # # Catch-all required check for test matrix
# test-success:
# needs:
# - lint-node
# - lint-helm
# - e2e
# runs-on: self-hosted
# 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
steps: # publish:
- uses: actions/checkout@v4 # runs-on: self-hosted
with: # needs:
show-progress: false # - test-success
- uses: ./.forgejo/actions/setup # if: ${{ github.ref_type == 'tag' }}
- uses: ./.forgejo/actions/setup-node
- name: install helm # steps:
uses: https://github.com/azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 # - uses: actions/checkout@v4
with: # with:
version: v3.13.2 # renovate: datasource=github-releases depName=helm packageName=helm/helm # show-progress: false
- run: helm dependency build # - uses: ./.forgejo/actions/setup
- run: helm package --version "${GITHUB_REF_NAME#v}" -d tmp/ ./ # - uses: ./.forgejo/actions/setup-node
- name: login to codeberg packages # - name: install helm
run: echo ${TOKEN} | helm registry login -u viceice --password-stdin codeberg.org/forgejo-contrib # uses: https://github.com/azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
env: # with:
TOKEN: ${{secrets.token}} # version: v3.13.2 # renovate: datasource=github-releases depName=helm packageName=helm/helm
- name: publish forgejo helm chart # - run: helm dependency build
run: helm push tmp/forgejo-${GITHUB_REF_NAME#v}.tgz oci://codeberg.org/forgejo-contrib # - run: helm package --version "${GITHUB_REF_NAME#v}" -d tmp/ ./
- name: publish forgejo release # - name: login to codeberg packages
run: npm run forgejo:release # 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