pytorch

Форк
0
154 строки · 5.0 Кб
1
name: Upload test artifacts
2

3
description: Upload various artifacts produced by our testing process
4

5
inputs:
6
  use-gha:
7
    description: If set to any value, upload GHA. Otherwise upload to S3.
8
    required: false
9
  file-suffix:
10
    description: |
11
      Suffix to add to the filename of the artifacts. This should include the
12
      workflow job id, see [Job id in artifacts].
13
    required: true
14

15
runs:
16
  using: composite
17
  steps:
18
    # Mac/Linux zip
19
    - name: Zip JSONs for upload
20
      if: runner.os != 'Windows' && !inputs.use-gha
21
      shell: bash
22
      env:
23
        FILE_SUFFIX: ${{ inputs.file-suffix }}
24
      run: |
25
        # Remove any previous test jsons if they exist
26
        rm -f test-jsons-*.zip
27
        zip -r "test-jsons-${FILE_SUFFIX}.zip" test -i '*.json'
28

29
    - name: Zip test reports for upload
30
      if: runner.os != 'Windows' && !inputs.use-gha
31
      shell: bash
32
      env:
33
        FILE_SUFFIX: ${{ inputs.file-suffix }}
34
      run: |
35
        # Remove any previous test reports if they exist
36
        rm -f test-reports-*.zip
37
        zip -r "test-reports-${FILE_SUFFIX}.zip" test -i '*.xml' -i '*.csv'
38

39
    - name: Zip usage log for upload
40
      if: runner.os != 'Windows' && !inputs.use-gha
41
      shell: bash
42
      env:
43
        FILE_SUFFIX: ${{ inputs.file-suffix }}
44
      run: |
45
        # Remove any previous test reports if they exist
46
        rm -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
49
        if [ -f 'usage_log.txt' ]; then
50
            zip "logs-${FILE_SUFFIX}.zip" 'usage_log.txt'
51
        fi
52
        if ls test/**/*.log 1> /dev/null 2>&1; then
53
            zip -r "logs-${FILE_SUFFIX}.zip" test -i '*.log'
54
        fi
55

56
    # Windows zip
57
    - name: Zip JSONs for upload
58
      if: runner.os == 'Windows' && !inputs.use-gha
59
      shell: powershell
60
      env:
61
        FILE_SUFFIX: ${{ inputs.file-suffix }}
62
      run: |
63
        # -ir => recursive include all files in pattern
64
        7z a "test-jsons-$Env:FILE_SUFFIX.zip" -ir'!test\*.json'
65

66
    - name: Zip test reports for upload
67
      if: runner.os == 'Windows' && !inputs.use-gha
68
      shell: powershell
69
      env:
70
        FILE_SUFFIX: ${{ inputs.file-suffix }}
71
      run: |
72
        # -ir => recursive include all files in pattern
73
        7z a "test-reports-$Env:FILE_SUFFIX.zip" -ir'!test\*.xml' -ir'!test\*.csv'
74

75
    - name: Zip usage log for upload
76
      if: runner.os == 'Windows' && !inputs.use-gha
77
      continue-on-error: true
78
      shell: powershell
79
      env:
80
        FILE_SUFFIX: ${{ inputs.file-suffix }}
81
      run: |
82
        # -ir => recursive include all files in pattern
83
        7z a "logs-$Env:FILE_SUFFIX.zip" 'usage_log.txt' -ir'!test\*.log'
84

85
    # S3 upload
86
    - name: Store Test Downloaded JSONs on S3
87
      uses: seemethere/upload-artifact-s3@v5
88
      if: ${{ !inputs.use-gha }}
89
      with:
90
        s3-prefix: |
91
          ${{ github.repository }}/${{ github.run_id }}/${{ github.run_attempt }}/artifact
92
        retention-days: 14
93
        if-no-files-found: warn
94
        path: test-jsons-*.zip
95

96
    - name: Store Test Reports on S3
97
      uses: seemethere/upload-artifact-s3@v5
98
      if: ${{ !inputs.use-gha }}
99
      with:
100
        s3-prefix: |
101
          ${{ github.repository }}/${{ github.run_id }}/${{ github.run_attempt }}/artifact
102
        retention-days: 14
103
        if-no-files-found: error
104
        path: test-reports-*.zip
105

106
    - name: Store Usage Logs on S3
107
      uses: seemethere/upload-artifact-s3@v5
108
      if: ${{ !inputs.use-gha }}
109
      continue-on-error: true
110
      with:
111
        s3-prefix: |
112
          ${{ github.repository }}/${{ github.run_id }}/${{ github.run_attempt }}/artifact
113
        retention-days: 14
114
        if-no-files-found: ignore
115
        path: logs-*.zip
116

117
    # GHA upload
118
    - name: Store Test Downloaded JSONs on Github
119
      uses: actions/upload-artifact@v3
120
      if: inputs.use-gha
121
      continue-on-error: true
122
      with:
123
        # Add the run attempt, see [Artifact run attempt]
124
        name: test-jsons-runattempt${{ github.run_attempt }}-${{ inputs.file-suffix }}.zip
125
        retention-days: 14
126
        if-no-files-found: warn
127
        path: test/**/*.json
128

129
    - name: Store Test Reports on Github
130
      uses: actions/upload-artifact@v3
131
      if: inputs.use-gha
132
      continue-on-error: true
133
      with:
134
        # Add the run attempt, see [Artifact run attempt]
135
        name: test-reports-runattempt${{ github.run_attempt }}-${{ inputs.file-suffix }}.zip
136
        retention-days: 14
137
        # Don't want to fail the workflow here because not all workflows have csv files
138
        if-no-files-found: ignore
139
        path: |
140
          test/**/*.xml
141
          test/**/*.csv
142

143
    - name: Store Usage Logs on Github
144
      uses: actions/upload-artifact@v3
145
      if: inputs.use-gha
146
      continue-on-error: true
147
      with:
148
        # Add the run attempt, see [Artifact run attempt]
149
        name: logs-runattempt${{ github.run_attempt }}-${{ inputs.file-suffix }}.zip
150
        retention-days: 14
151
        if-no-files-found: ignore
152
        path: |
153
          usage_log.txt
154
          test/**/*.log
155

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.