GitHub Actions Test Infrastructure #13
This file contains hidden or 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 CCKP Toolkit Workflow | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Run nf-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Nextflow | |
| run: | | |
| curl -s https://get.nextflow.io | bash | |
| mv nextflow /usr/local/bin/ | |
| nextflow -version | |
| - name: Install nf-test | |
| run: | | |
| curl -fsSL https://get.nf-test.com | bash | |
| mv nf-test /usr/local/bin/ | |
| nf-test version | |
| - name: Set up Docker | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Initialize nf-test | |
| run: | | |
| nf-test init | |
| - name: Run tests | |
| run: | | |
| nf-test test main.nf.test | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: | | |
| work/ | |
| .nextflow/ | |
| .nextflow.log | |
| retention-days: 7 | |
| output-validation: | |
| name: Output Validation | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Download test results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: test-results | |
| path: work/ | |
| - name: Validate outputs | |
| run: | | |
| # Test 1: Check consolidated report | |
| if [ ! -f "work/consolidated_report.csv" ] || [ ! -s "work/consolidated_report.csv" ]; then | |
| echo "❌ Consolidated report is missing or empty" | |
| exit 1 | |
| fi | |
| echo "✓ Consolidated report exists and is not empty" | |
| # Test 2: Check Almanack results | |
| if [ ! -f "work/PythonOT_POT_almanack-results.json" ] || [ ! -s "work/PythonOT_POT_almanack-results.json" ]; then | |
| echo "❌ Almanack results are missing or empty" | |
| exit 1 | |
| fi | |
| echo "✓ Almanack results exist and are not empty" | |
| # Test 3: Validate CSV structure | |
| if ! head -n 1 "work/consolidated_report.csv" | grep -q "target"; then | |
| echo "❌ CSV header is missing or incorrect" | |
| exit 1 | |
| fi | |
| echo "✓ CSV header is valid" | |
| # Test 4: Check status values | |
| if ! grep -q "PASS\|FAIL" "work/consolidated_report.csv"; then | |
| echo "❌ No valid status values found in CSV" | |
| exit 1 | |
| fi | |
| echo "✓ Status values are present" | |
| # Test 5: Check status files | |
| if [ ! -f "work/status_repo.txt" ]; then | |
| echo "❌ Repository status file is missing" | |
| exit 1 | |
| fi | |
| echo "✓ Repository status file exists" | |
| if [ ! -f "work/status_almanack_POT.txt" ]; then | |
| echo "❌ Almanack status file is missing" | |
| exit 1 | |
| fi | |
| echo "✓ Almanack status file exists" |