Skip to content

Functional-Tests

Functional-Tests #301

---
name: Functional-Tests
on:
schedule:
- cron: "25 6 * * *"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 1
env:
CI_JOB: 'ansible-test-collection-opnsense'
CI_DOMAIN: 'ci.oss.oxl.app'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Install dependencies
run: sudo apt install curl jq > /dev/null
shell: bash
- name: Pulling logs
run: curl --fail-with-body 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: Extracting Results
run: |
grep 'FINISHED TESTS' -A 1 -B 5 < /tmp/test.log > /tmp/results.txt
cat /tmp/results.txt
shell: bash
- uses: actions/upload-artifact@v4
with:
name: test-results
path: /tmp/results.txt
retention-days: 14
- name: Checking job-state
run: curl --fail-with-body 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