From a0896b99b07a1b9b2fc7928938c47adfd18dcfd1 Mon Sep 17 00:00:00 2001 From: Rath Pascal Date: Sat, 8 Feb 2025 15:15:53 +0100 Subject: [PATCH] update ci --- .github/workflows/integration_test_result.yml | 41 +++++++++++++++++++ .github/workflows/integration_test_run.yml | 34 +++++++++++++++ .github/workflows/lint.yml | 2 +- README.md | 15 ++++--- 4 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/integration_test_result.yml create mode 100644 .github/workflows/integration_test_run.yml diff --git a/.github/workflows/integration_test_result.yml b/.github/workflows/integration_test_result.yml new file mode 100644 index 0000000..e1b0343 --- /dev/null +++ b/.github/workflows/integration_test_result.yml @@ -0,0 +1,41 @@ +--- + +name: Integration-Tests + +on: + schedule: + - cron: "30 6 * * *" + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 1 + env: + CI_JOB: 'ansible-test-molecule-${{ github.event.repository.name }}' + CI_DOMAIN: 'ci.ansibleguy.net' + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} + + - name: Install dependencies + run: sudo apt install curl jq + shell: bash + + - name: Pulling logs + run: curl https://${{ env.CI_DOMAIN }}/api/job/${{ env.CI_JOB }}/logs?token=${{ secrets.CI_TOKEN_RO }} | jq > /tmp/test.log + shell: bash + + - uses: actions/upload-artifact@v4 + with: + name: test-logs + path: /tmp/test.log + retention-days: 14 + + - name: Checking job-state + run: > + curl https://${{ env.CI_DOMAIN }}/api/job/${{ env.CI_JOB }}/state?token=${{ secrets.CI_TOKEN_RO }} | jq -r '.state' | grep -q 'failed' && exit 1 || exit 0 + shell: bash diff --git a/.github/workflows/integration_test_run.yml b/.github/workflows/integration_test_run.yml new file mode 100644 index 0000000..e2d4fec --- /dev/null +++ b/.github/workflows/integration_test_run.yml @@ -0,0 +1,34 @@ +--- + +name: Integration-Tests Execution + +on: workflow_dispatch + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 1 + env: + CI_JOB: 'ansible-test-molecule-${{ github.event.repository.name }}' + CI_DOMAIN: 'ci.ansibleguy.net' + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} + + - name: Install dependencies + run: sudo apt install curl + shell: bash + + - name: Starting Tests + run: curl -XPOST https://${{ env.CI_DOMAIN }}/api/job/${{ env.CI_JOB }}?token=${{ secrets.CI_TOKEN_RW }} + shell: bash + + - name: You can pull the current logs at this URL + run: > + echo "You can pull the current logs at this URL:" + echo " > https://${{ env.CI_DOMAIN }}/api/job/${{ env.CI_JOB }}/tail?token=${CI_TOKEN_RO}" + env: + CI_TOKEN_RO: "2b7bba30-9a37-4b57-be8a-99e23016ce70" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 20c35d6..8c3435d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ on: - 'requirements_lint.txt' jobs: - build: + lint: runs-on: ubuntu-latest timeout-minutes: 2 steps: diff --git a/README.md b/README.md index 587b4e4..70d249f 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,16 @@ Ansible Role to deploy one or multiple NGINX sites on a linux server. -[![Molecule Test Status](https://badges.ansibleguy.net/infra_nginx.molecule.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2) -[![YamlLint Test Status](https://badges.ansibleguy.net/infra_nginx.yamllint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/yamllint.sh.j2) -[![PyLint Test Status](https://badges.ansibleguy.net/infra_nginx.pylint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/pylint.sh.j2) -[![Ansible-Lint Test Status](https://badges.ansibleguy.net/infra_nginx.ansiblelint.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/ansiblelint.sh.j2) +[![Lint](https://github.com/ansibleguy/infra_nginx/actions/workflows/lint.yml/badge.svg)](https://github.com/ansibleguy/infra_nginx/actions/workflows/lint.yml) [![Ansible Galaxy](https://badges.ansibleguy.net/galaxy.badge.svg)](https://galaxy.ansible.com/ui/standalone/roles/ansibleguy/infra_nginx) -Molecule Logs: [Short](https://badges.ansibleguy.net/log/molecule_infra_nginx_test_short.log), [Full](https://badges.ansibleguy.net/log/molecule_infra_nginx_test.log) +**Molecule Integration-Tests**: + +* Status: [![Molecule Test Status](https://badges.ansibleguy.net/infra_nginx.molecule.svg)](https://github.com/ansibleguy/_meta_cicd/blob/latest/templates/usr/local/bin/cicd/molecule.sh.j2) | +[![Functional-Tests](https://github.com/ansibleguy/infra_nginx/actions/workflows/integration_test_result.yml/badge.svg)](https://github.com/ansibleguy/infra_nginx/actions/workflows/integration_test_result.yml) +* Logs: [API](https://ci.ansibleguy.net/api/job/ansible-test-molecule-infra_nginx/logs?token=2b7bba30-9a37-4b57-be8a-99e23016ce70&lines=1000) | [Short](https://badges.ansibleguy.net/log/molecule_infra_nginx_test_short.log) | [Full](https://badges.ansibleguy.net/log/molecule_infra_nginx_test.log) + +Internal CI: [Tester Role](https://github.com/ansibleguy/_meta_cicd) | [Jobs API](https://github.com/O-X-L/github-self-hosted-jobs-systemd) **Tested:** * Debian 11 @@ -189,7 +192,7 @@ ansible-playbook -K -D -i inventory/hosts.yml playbook.yml -e debug=yes * IPv6 support enabled - * **SSL modes** (_for more info see: [CERT ROLE](https://github.com/ansibleguy/infra_certs)_) + * **SSL modes** (_for more info see: [CERT ROLE](https://github.com/ansibleguy/infra_nginx)_) * **selfsigned** => Generate self-signed ones * **ca** => Generate a minimal Certificate Authority and certificate signed by it * **letsencrypt** => Uses the LetsEncrypt certbot