diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebe24b3..ca537aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ main ] +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: formatting: name: Formatting (Isort & Black) diff --git a/Jenkinsfile b/Jenkinsfile index be81475..c83685e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,8 @@ pipeline { // Local virtual environment within the Jenkins workspace for portability VENV_PATH = "${WORKSPACE}/.venv" VENV_BIN = "${VENV_PATH}/bin" + // Opt into Node.js 24 for GitHub Actions if used via plugins + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 = 'true' } stages { @@ -75,9 +77,19 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } stage('Flake8') { steps { - sh "rm -f flake8.txt flake8-report.xml" - sh "${VENV_BIN}/flake8 logflow tests examples --tee --output-file=flake8.txt || true" - sh "if [ -f flake8.txt ]; then ${VENV_BIN}/flake8_junit flake8.txt flake8-report.xml; fi" + script { + def rc = sh(script: "${VENV_BIN}/flake8 logflow tests examples > flake8-output.txt 2>&1", returnStatus: true) + sh """${VENV_BIN}/python3 -c " +import xml.etree.ElementTree as ET +rc = ${rc} +root = ET.Element('testsuite', name='flake8', tests='1', failures=str(min(rc, 1))) +tc = ET.SubElement(root, 'testcase', classname='flake8', name='lint-check') +if rc != 0: + with open('flake8-output.txt') as f: + ET.SubElement(tc, 'failure', message='Flake8 linting issues found').text = f.read() +ET.ElementTree(root).write('flake8-report.xml', xml_declaration=True, encoding='unicode') +" """ + } } post { always { @@ -91,7 +103,9 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u } stage('Mypy') { steps { - sh "${VENV_BIN}/mypy logflow tests examples --junit-xml=mypy-report.xml || true" + script { + sh "${VENV_BIN}/mypy logflow tests examples --junit-xml=mypy-report.xml || true" + } } post { always { @@ -115,8 +129,17 @@ ET.ElementTree(root).write('isort-report.xml', xml_declaration=True, encoding='u // Archive and display JUnit test results junit allowEmptyResults: true, testResults: 'test-report.xml' - // Display Coverage in Jenkins UI using Code Coverage API Plugin - recordCoverage tools: [[parser: 'COBERTURA', pattern: 'coverage.xml']] + // Display Coverage and Test Results as separate graphs using unique IDs + recordCoverage( + id: 'unit-tests', + name: 'Unit Tests', + tools: [[parser: 'JUNIT', pattern: 'test-report.xml']] + ) + recordCoverage( + id: 'coverage', + name: 'Code Coverage', + tools: [[parser: 'COBERTURA', pattern: 'coverage.xml']] + ) } } }