Test Core Modules #294
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Core Modules | |
on: | |
pull_request: | |
types: | |
- "labeled" | |
workflow_dispatch: | |
env: | |
NS8_CORE_MODULES: "core traefik loki ldapproxy" | |
jobs: | |
ns8: | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
github.event.label.name == 'testing' | |
name: Find NS8 cluster informations | |
runs-on: ubuntu-latest | |
outputs: | |
modules: ${{ steps.modules.outputs.list }} | |
steps: | |
- id: tag | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ] | |
then | |
tag=${{ github.head_ref }} | |
else | |
tag="${{ github.ref_name }}" | |
fi | |
if [ "$tag" = "main" ] | |
then | |
tag="latest" | |
fi | |
echo "::set-output name=name::${tag}" | |
- id: modules | |
run: | | |
modules_list='[]' | |
for module in ${NS8_CORE_MODULES} | |
do | |
res=$(podman search --limit 150 --list-tags --format json ghcr.io/nethserver/${module} | jq 'any(.[].Tags[]; . == "${{ steps.tag.outputs.name }}")') | |
if [ "$res" = "true" ] | |
then | |
modules_list=$(echo "${modules_list}" | jq -c --arg m ghcr.io/nethserver/${module}:${{ steps.tag.outputs.name }} ' . + [$m]') | |
fi | |
done | |
echo "::set-output name=list::${modules_list}" | |
run_tests: | |
needs: ns8 | |
uses: NethServer/ns8-github-actions/.github/workflows/test-on-digitalocean-infra.yml@main | |
with: | |
setup_cluster: false | |
path: core/ | |
coremodules: ${{ join(fromJSON(needs.ns8.outputs.modules), ' ' ) }} | |
secrets: | |
do_token: ${{ secrets.do_token }} | |
remove_label: | |
name: "Cleaup PR label" | |
runs-on: ubuntu-latest | |
needs: run_tests | |
if: | | |
github.event.label.name == 'testing' && | |
needs.infra_destroy.result == 'success' && | |
always() | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-ecosystem/action-remove-labels@v1 | |
with: | |
labels: testing |