pytorch
154 строки · 5.0 Кб
1name: Upload test artifacts2
3description: Upload various artifacts produced by our testing process4
5inputs:6use-gha:7description: If set to any value, upload GHA. Otherwise upload to S3.8required: false9file-suffix:10description: |11Suffix to add to the filename of the artifacts. This should include the
12workflow job id, see [Job id in artifacts].
13required: true14
15runs:16using: composite17steps:18# Mac/Linux zip19- name: Zip JSONs for upload20if: runner.os != 'Windows' && !inputs.use-gha21shell: bash22env:23FILE_SUFFIX: ${{ inputs.file-suffix }}24run: |25# Remove any previous test jsons if they exist
26rm -f test-jsons-*.zip
27zip -r "test-jsons-${FILE_SUFFIX}.zip" test -i '*.json'
28
29- name: Zip test reports for upload30if: runner.os != 'Windows' && !inputs.use-gha31shell: bash32env:33FILE_SUFFIX: ${{ inputs.file-suffix }}34run: |35# Remove any previous test reports if they exist
36rm -f test-reports-*.zip
37zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml' -i '*.csv'
38
39- name: Zip usage log for upload40if: runner.os != 'Windows' && !inputs.use-gha41shell: bash42env:43FILE_SUFFIX: ${{ inputs.file-suffix }}44run: |45# Remove any previous test reports if they exist
46rm -f logs-*.zip
47# this workflow is also run in bazel build test, but we dont generate usage reports for it
48# so check to see if the file exists first
49if [ -f 'usage_log.txt' ]; then
50zip "logs-${FILE_SUFFIX}.zip" 'usage_log.txt'
51fi
52if ls test/**/*.log 1> /dev/null 2>&1; then
53zip -r "logs-${FILE_SUFFIX}.zip" test -i '*.log'
54fi
55
56# Windows zip57- name: Zip JSONs for upload58if: runner.os == 'Windows' && !inputs.use-gha59shell: powershell60env:61FILE_SUFFIX: ${{ inputs.file-suffix }}62run: |63# -ir => recursive include all files in pattern
647z a "test-jsons-$Env:FILE_SUFFIX.zip" -ir'!test\*.json'
65
66- name: Zip test reports for upload67if: runner.os == 'Windows' && !inputs.use-gha68shell: powershell69env:70FILE_SUFFIX: ${{ inputs.file-suffix }}71run: |72# -ir => recursive include all files in pattern
737z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml' -ir'!test\*.csv'
74
75- name: Zip usage log for upload76if: runner.os == 'Windows' && !inputs.use-gha77continue-on-error: true78shell: powershell79env:80FILE_SUFFIX: ${{ inputs.file-suffix }}81run: |82# -ir => recursive include all files in pattern
837z a "logs-$Env:FILE_SUFFIX.zip" 'usage_log.txt' -ir'!test\*.log'
84
85# S3 upload86- name: Store Test Downloaded JSONs on S387uses: seemethere/upload-artifact-s3@v588if: ${{ !inputs.use-gha }}89with:90s3-prefix: |91${{ github.repository }}/${{ github.run_id }}/${{ github.run_attempt }}/artifact
92retention-days: 1493if-no-files-found: warn94path: test-jsons-*.zip95
96- name: Store Test Reports on S397uses: seemethere/upload-artifact-s3@v598if: ${{ !inputs.use-gha }}99with:100s3-prefix: |101${{ github.repository }}/${{ github.run_id }}/${{ github.run_attempt }}/artifact
102retention-days: 14103if-no-files-found: error104path: test-reports-*.zip105
106- name: Store Usage Logs on S3107uses: seemethere/upload-artifact-s3@v5108if: ${{ !inputs.use-gha }}109continue-on-error: true110with:111s3-prefix: |112${{ github.repository }}/${{ github.run_id }}/${{ github.run_attempt }}/artifact
113retention-days: 14114if-no-files-found: ignore115path: logs-*.zip116
117# GHA upload118- name: Store Test Downloaded JSONs on Github119uses: actions/upload-artifact@v3120if: inputs.use-gha121continue-on-error: true122with:123# Add the run attempt, see [Artifact run attempt]124name: test-jsons-runattempt${{ github.run_attempt }}-${{ inputs.file-suffix }}.zip125retention-days: 14126if-no-files-found: warn127path: test/**/*.json128
129- name: Store Test Reports on Github130uses: actions/upload-artifact@v3131if: inputs.use-gha132continue-on-error: true133with:134# Add the run attempt, see [Artifact run attempt]135name: test-reports-runattempt${{ github.run_attempt }}-${{ inputs.file-suffix }}.zip136retention-days: 14137# Don't want to fail the workflow here because not all workflows have csv files138if-no-files-found: ignore139path: |140test/**/*.xml
141test/**/*.csv
142
143- name: Store Usage Logs on Github144uses: actions/upload-artifact@v3145if: inputs.use-gha146continue-on-error: true147with:148# Add the run attempt, see [Artifact run attempt]149name: logs-runattempt${{ github.run_attempt }}-${{ inputs.file-suffix }}.zip150retention-days: 14151if-no-files-found: ignore152path: |153usage_log.txt
154test/**/*.log
155