diff --git a/.github/workflows/nf-test.yml b/.github/workflows/nf-test.yml index 97e55ba5c666..2726a47ebf37 100644 --- a/.github/workflows/nf-test.yml +++ b/.github/workflows/nf-test.yml @@ -171,6 +171,40 @@ jobs: total_shards: ${{ env.TOTAL_SHARDS }} paths: "${{ join(fromJson(steps.filter.outputs.filtered_paths), ' ') }}" + - name: Configure AWS credentials for CO2 reports + if: always() && steps.filter.outputs.filtered_paths != '[]' + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.CO2_REPORTS_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.CO2_REPORTS_AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.CO2_REPORTS_AWS_REGION }} + + - name: Upload CO2 footprint reports to S3 + if: always() && steps.filter.outputs.filtered_paths != '[]' + shell: bash + run: | + # Find all CO2 footprint trace files + CO2_FILES=$(find . -name "co2footprint_trace*.txt" -type f) + + if [ -n "$CO2_FILES" ]; then + # Get current date and sanitize branch name + DATE=$(date +%Y-%m-%d) + BRANCH_NAME=$(echo "${{ github.head_ref || github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/_/g') + + # S3 destination path + S3_BASE="s3://nf-core-co2-reports/modules/${DATE}/${BRANCH_NAME}/${{ matrix.profile }}/${{ matrix.shard }}" + + # Upload each CO2 trace file + for file in $CO2_FILES; do + filename=$(basename "$file") + aws s3 cp "$file" "${S3_BASE}/${filename}" --no-progress + echo "Uploaded: $file -> ${S3_BASE}/${filename}" + done + else + echo "ERROR: No CO2 footprint trace files found" + exit 1 + fi + confirm-pass-nf-test: runs-on: - runs-on=${{ github.run_id }}-confirm-pass-nf-test diff --git a/modules/nf-core/shasta/tests/main.nf.test b/modules/nf-core/shasta/tests/main.nf.test index ee6654930a7e..1d5c8760bb1a 100644 --- a/modules/nf-core/shasta/tests/main.nf.test +++ b/modules/nf-core/shasta/tests/main.nf.test @@ -1,4 +1,4 @@ - +// Trigger CI to test CO2 footprint tracking nextflow_process { name "Test Process SHASTA" diff --git a/tests/config/nf-test.config b/tests/config/nf-test.config index 336f2e178917..2e5af5e2c499 100644 --- a/tests/config/nf-test.config +++ b/tests/config/nf-test.config @@ -1,3 +1,7 @@ +plugins { + id 'nf-co2footprint@1.0.0' +} + params { publish_dir_mode = "copy" singularity_pull_docker_container = false