From a9bb6e482755d9c97ffbc6d00a8bff559c9e086e Mon Sep 17 00:00:00 2001 From: tligui_y Date: Mon, 21 Jul 2025 14:47:47 +0200 Subject: [PATCH] Delete .gitea/workflow/test.yml --- .gitea/workflow/test.yml | 266 --------------------------------------- 1 file changed, 266 deletions(-) delete mode 100644 .gitea/workflow/test.yml diff --git a/.gitea/workflow/test.yml b/.gitea/workflow/test.yml deleted file mode 100644 index fb33bcf..0000000 --- a/.gitea/workflow/test.yml +++ /dev/null @@ -1,266 +0,0 @@ -name: Pytest CI Workflow -description: Run pytest with coverage and report upload to Gitea -inputs: - ci-branch: - description: 'Target branch where test reports will be committed' - required: true - - module-dir: - description: 'Directory (folder) containing the Python module to test' - required: true - - report-dir: - description: 'Directory (folder) where all test and coverage reports will be saved' - required: true - - gitea-domain: - description: 'Domain name of your Gitea instance without protocol (e.g., gitea.psi.ch)' - required: true - - repo-path: - description: 'Relative path to the root of your repository' - required: true - - ci-token: - description: '๐Ÿ” CI authentication token (used for pushing to Gitea)' - required: true -runs: - using: "composite" - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Show checked out files - shell: bash - run: | - echo "๐Ÿ“‚ Files in repo root:" - ls -1 - - - name: Install Pixi & project dependencies - shell: bash - run: | - echo "๐Ÿ”ง Installing Pixi..." - curl -fsSL https://pixi.sh/install.sh | bash > pixi-download.log 2>&1 || { - echo "โŒ Pixi download failed" - cat pixi-download.log - exit 1 - } - - echo "$HOME/.pixi/bin" >> $GITHUB_PATH - export PATH="$HOME/.pixi/bin:$PATH" - - if [ ! -f "pixi.toml" ]; then - echo "โŒ Missing pixi.toml at repo root : please add one to use Pixi" - exit 1 - fi - - echo "๐Ÿ“ฆ Installing dependencies from pixi.toml..." - pixi install > pixi-install.log 2>&1 || { - echo "โŒ Pixi project dependencies failed" - cat pixi-install.log - exit 1 - } - - echo "โœ… Pixi installed and environment created" - pixi list - - - name: Install Python test/report tools - shell: bash - run: | - echo "๐Ÿ Setting up Python environment..." - python -m venv venv - source venv/bin/activate - - pip install -U pip > pip.log 2>&1 || { - echo "โŒ pip upgrade failed" - cat pip.log - exit 1 - } - - pip install pytest pytest-cov pytest-html pytest-md-report rich > pip.log 2>&1 || { - echo "โŒ Python testing tools install failed" - cat pip.log - exit 1 - } - - echo "โœ… Python tools installed" - pip list - - - name: Run tests and generate reports - shell: bash - run: | - echo "๐Ÿš€ Running tests and generating reports..." - source venv/bin/activate - mkdir -p ${{ inputs.report-dir }}/{allure,coverage,markdown} - - set +e - - echo "๐Ÿงช Running pytest with coverage and report generation..." - pixi run pytest . \ - --continue-on-collection-errors \ - --cov=${{ inputs.module-dir }} \ - --cov-report=xml:${{ inputs.report-dir }}/coverage/coverage.xml \ - --cov-report=html:${{ inputs.report-dir }}/coverage/ \ - --json-report \ - --json-report-file=${{ inputs.report-dir }}/markdown/pytest-report.json \ - --capture=no > ${{ inputs.report-dir }}/markdown/raw-test-output.log 2>&1 - - exit_code=$? - - echo "" - echo "๐Ÿ“‹ Short test summary:" - awk '/=+ short test summary info =+/,/=+.* in .*s =+/' ${{ inputs.report-dir }}/markdown/raw-test-output.log || true - - echo "๐Ÿ“ฆ Pytest exit code: $exit_code" - if [ "$exit_code" -eq 0 ] || [ "$exit_code" -eq 1 ]; then - echo "โœ… Pytest completed successfully (code $exit_code)" - else - echo "โŒ Pytest failed (code $exit_code)" - fi - - set -e - - - name: Commit and push reports - shell: bash - run: | - echo "๐Ÿ“ค Committing test reports..." - git config user.name "ci-bot" - git config user.email "ci-bot@example.com" - git add ${{ inputs.report-dir }}/ - git commit -m "CI: update test report and coverage files" || echo "โš ๏ธ Nothing to commit" - - echo "๐Ÿš€ Pushing to branch '${{ inputs.ci-branch }}'..." - git push https://ci-token:${{ inputs.ci-token }}@${{ inputs.gitea-domain }}/${{ inputs.repo-path }}.git HEAD:${{ inputs.ci-branch }} > push.log 2>&1 || { - echo "โŒ Push failed" - cat push.log - exit 1 - } - echo "โœ… Reports pushed" - - - name: Deploy Allure report to gitea-pages - shell: bash - run: | - echo "๐Ÿ“š Cloning gitea-pages branch..." - git clone --branch gitea-pages https://ci-token:${{ inputs.ci-token }}@${{ inputs.gitea-domain }}/${{ inputs.repo-path }}.git gitea-pages - - echo "๐Ÿ—‘ Cleaning old report files..." - rm -rf gitea-pages/* || true - - echo "๐Ÿ“‚ Copying new allure files..." - cp -r ${{ inputs.report-dir }}/allure/* gitea-pages/ - - cd gitea-pages - git config user.name "ci-bot" - git config user.email "ci-bot@example.com" - git add . - git commit -m "Update Allure report" || echo "โš ๏ธ Nothing to commit" - - echo "๐Ÿš€ Pushing to gitea-pages..." - git push origin gitea-pages - - - name: Get commit info - id: info - shell: bash - run: | - short_sha=$(git rev-parse --short HEAD) - commit_msg=$(git log -1 --pretty=%B) - - echo "๐Ÿ” Commit SHA: $short_sha" - echo "๐Ÿ” Commit message: $commit_msg" - - echo "short_sha=$short_sha" >> $GITHUB_OUTPUT - echo "commit_msg=$commit_msg" >> $GITHUB_OUTPUT - - - name: Clone Gitea Wiki - shell: bash - env: - CI_TOKEN: ${{ inputs.ci-token }} - run: | - REPO_NAME="${{ github.repository }}" - DOMAIN="${{ inputs.gitea-domain }}" - WIKI_REPO="https://ci-token:${CI_TOKEN}@${DOMAIN}/${REPO_NAME}.wiki.git" - - echo "๐Ÿ“š Cloning wiki repo: $WIKI_REPO" - git clone "$WIKI_REPO" wiki > wiki_clone.log 2>&1 || { - echo "โŒ Wiki clone failed" - cat wiki_clone.log - exit 1 - } - echo "โœ… Wiki cloned to ./wiki" - - - name: Copy reports into wiki - shell: bash - run: | - SHORT_SHA=$(git rev-parse --short HEAD) - REPO_URL="https://${{ inputs.gitea-domain }}/${{ github.repository }}" - RUN_LINK="${REPO_URL}/actions/runs/${GITHUB_RUN_NUMBER}" - - TEST_FILE="run-${GITHUB_RUN_NUMBER}-TEST-commit-${SHORT_SHA}.md" - COVERAGE_FILE="run-${GITHUB_RUN_NUMBER}-COVERAGE-commit-${SHORT_SHA}.md" - - echo "## Test Report" > "wiki/${TEST_FILE}" - echo "[View CI Run ${GITHUB_RUN_NUMBER}](${RUN_LINK}) | [Commit ${SHORT_SHA}](${REPO_URL}/commit/${SHORT_SHA})" >> "wiki/${TEST_FILE}" - cat ${{ inputs.report-dir }}/markdown/TEST-REPORT.md >> "wiki/${TEST_FILE}" - - echo "## Coverage Report" > "wiki/${COVERAGE_FILE}" - echo "[View CI Run ${GITHUB_RUN_NUMBER}](${RUN_LINK}) | [Commit ${SHORT_SHA}](${REPO_URL}/commit/${SHORT_SHA})" >> "wiki/${COVERAGE_FILE}" - cat ${{ inputs.report-dir }}/markdown/coverage-summary.md >> "wiki/${COVERAGE_FILE}" - - HOME_FILE="wiki/Home.md" - TEMP_CONTENT=$(mktemp) - REPORT_LOG="reports.log" - - { - echo "# Test Reports History" - echo "" - echo "## Latest Run" - echo "- [run ${GITHUB_RUN_NUMBER} TEST commit ${SHORT_SHA}](${TEST_FILE})" - echo "- [run ${GITHUB_RUN_NUMBER} COVERAGE commit ${SHORT_SHA}](${COVERAGE_FILE})" - echo "" - echo "## Previous Runs" - - if [[ -f "${HOME_FILE}" && -s "${HOME_FILE}" ]]; then - sed -n '/## Latest Run/{n;p;n;p}' "${HOME_FILE}" - sed -n '/## Previous Runs/,$p' "${HOME_FILE}" | tail -n +2 | grep -v "^#" || true - fi - } > "${TEMP_CONTENT}" 2> "${REPORT_LOG}" || { - echo "โŒ Report preparation failed" - cat "${REPORT_LOG}" - exit 1 - } - - mv "${TEMP_CONTENT}" "${HOME_FILE}" - - - name: Commit and push wiki - shell: bash - env: - CI_TOKEN: ${{ inputs.ci-token }} - run: | - echo "๐Ÿš€ Pushing wiki changes..." - cd wiki - - git config user.name "ci-bot" - git config user.email "ci-bot@example.com" - git add . - - if git commit -m "Update wiki with run ${GITHUB_RUN_NUMBER}"; then - REPO_NAME="${{ github.repository }}" - DOMAIN="${{ inputs.gitea-domain }}" - WIKI_REPO="https://ci-token:${CI_TOKEN}@${DOMAIN}/${REPO_NAME}.wiki.git" - git push "$WIKI_REPO" HEAD:main - echo "โœ… Wiki updated successfully" - else - echo "โš ๏ธ No changes to commit" - fi - - - name: Log wiki report URLs - shell: bash - run: | - REPO_URL="https://${{ inputs.gitea-domain }}/${{ github.repository }}" - SHORT_SHA=$(git rev-parse --short HEAD) - echo "๐Ÿ”— Wiki Test Report URL:" - echo " ${REPO_URL}/wiki/run-${GITHUB_RUN_NUMBER}-TEST-commit-${SHORT_SHA}.md" - echo "๐Ÿ”— Wiki Coverage Report URL:" - echo " ${REPO_URL}/wiki/run-${GITHUB_RUN_NUMBER}-COVERAGE-commit-${SHORT_SHA}.md"