mirror of
https://github.com/actions/download-artifact.git
synced 2026-03-11 07:51:01 +01:00
Compare commits
2 Commits
danwkenned
...
danwkenned
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4f816ecbb | ||
|
|
1a19547ec8 |
144
.github/workflows/test.yml
vendored
144
.github/workflows/test.yml
vendored
@@ -155,35 +155,135 @@ jobs:
|
|||||||
Write-Host "Successfully downloaded artifact without decompressing: $rawFile (size: $($fileInfo.Length) bytes)"
|
Write-Host "Successfully downloaded artifact without decompressing: $rawFile (size: $($fileInfo.Length) bytes)"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
# Regression test for artifact filename vs content-type mismatch
|
# Test uploading and downloading artifacts with CJK (Chinese, Japanese, Korean) characters
|
||||||
# When an archived artifact has a name with a file extension that doesn't
|
# Regression test: certain non-ASCII chars (e.g. U+571F 土) caused 400 errors from
|
||||||
# match the blob type (e.g. "report.txt" but blob is zip), the server
|
# Azure Blob Storage due to encoding issues in the Content-Disposition / rscd parameter
|
||||||
# should append .zip to the content-disposition filename.
|
- name: Create artifacts with CJK names
|
||||||
- name: Create and upload archived artifact with misleading extension
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p path/to/extension-test
|
mkdir -p path/to/cjk-artifacts
|
||||||
echo '{"key": "value"}' > path/to/extension-test/data.json
|
# Chinese - 土 (U+571F) known to fail, 日 (U+65E5) known to work
|
||||||
- uses: actions/upload-artifact@v4 # V4 is important here to ensure we're supporting older versions correctly
|
echo "Content for 土" > "path/to/cjk-artifacts/file-土-${{ matrix.runs-on }}.txt"
|
||||||
with:
|
echo "Content for 中文测试" > "path/to/cjk-artifacts/file-中文测试-${{ matrix.runs-on }}.txt"
|
||||||
name: report.txt-${{ matrix.runs-on }}.json
|
# Japanese - katakana and kanji
|
||||||
path: path/to/extension-test/data.json
|
echo "Content for テスト" > "path/to/cjk-artifacts/file-テスト-${{ matrix.runs-on }}.txt"
|
||||||
|
echo "Content for 東京タワー" > "path/to/cjk-artifacts/file-東京タワー-${{ matrix.runs-on }}.txt"
|
||||||
|
# Korean - Hangul
|
||||||
|
echo "Content for 테스트" > "path/to/cjk-artifacts/file-테스트-${{ matrix.runs-on }}.txt"
|
||||||
|
echo "Content for 서울시" > "path/to/cjk-artifacts/file-서울시-${{ matrix.runs-on }}.txt"
|
||||||
|
|
||||||
- name: Download misleading-extension artifact without decompressing
|
- name: Upload CJK artifact - Chinese 土
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
path: path/to/cjk-artifacts/file-土-${{ matrix.runs-on }}.txt
|
||||||
|
archive: false
|
||||||
|
|
||||||
|
- name: Upload CJK artifact - Chinese 中文测试
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
path: path/to/cjk-artifacts/file-中文测试-${{ matrix.runs-on }}.txt
|
||||||
|
archive: false
|
||||||
|
|
||||||
|
- name: Upload CJK artifact - Japanese テスト
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
path: path/to/cjk-artifacts/file-テスト-${{ matrix.runs-on }}.txt
|
||||||
|
archive: false
|
||||||
|
|
||||||
|
- name: Upload CJK artifact - Japanese 東京タワー
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
path: path/to/cjk-artifacts/file-東京タワー-${{ matrix.runs-on }}.txt
|
||||||
|
archive: false
|
||||||
|
|
||||||
|
- name: Upload CJK artifact - Korean 테스트
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
path: path/to/cjk-artifacts/file-테스트-${{ matrix.runs-on }}.txt
|
||||||
|
archive: false
|
||||||
|
|
||||||
|
- name: Upload CJK artifact - Korean 서울시
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
path: path/to/cjk-artifacts/file-서울시-${{ matrix.runs-on }}.txt
|
||||||
|
archive: false
|
||||||
|
|
||||||
|
- name: Download CJK artifact - Chinese 土
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
name: report.txt-${{ matrix.runs-on }}.json
|
name: file-土-${{ matrix.runs-on }}.txt
|
||||||
path: ext-test/raw
|
path: cjk-download/土
|
||||||
skip-decompress: true
|
|
||||||
|
|
||||||
- name: Verify downloaded file has .zip extension appended
|
- name: Download CJK artifact - Chinese 中文测试
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
name: file-中文测试-${{ matrix.runs-on }}.txt
|
||||||
|
path: cjk-download/中文测试
|
||||||
|
|
||||||
|
- name: Download CJK artifact - Japanese テスト
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
name: file-テスト-${{ matrix.runs-on }}.txt
|
||||||
|
path: cjk-download/テスト
|
||||||
|
|
||||||
|
- name: Download CJK artifact - Japanese 東京タワー
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
name: file-東京タワー-${{ matrix.runs-on }}.txt
|
||||||
|
path: cjk-download/東京タワー
|
||||||
|
|
||||||
|
- name: Download CJK artifact - Korean 테스트
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
name: file-테스트-${{ matrix.runs-on }}.txt
|
||||||
|
path: cjk-download/테스트
|
||||||
|
|
||||||
|
- name: Download CJK artifact - Korean 서울시
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
name: file-서울시-${{ matrix.runs-on }}.txt
|
||||||
|
path: cjk-download/서울시
|
||||||
|
|
||||||
|
- name: Verify CJK artifact downloads
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
expected="ext-test/raw/report.txt-${{ matrix.runs-on }}.json.zip"
|
set -e
|
||||||
if [ -f "$expected" ]; then
|
fail=0
|
||||||
echo "PASS: Downloaded file has .zip appended: $expected"
|
|
||||||
else
|
check_file() {
|
||||||
echo "FAIL: Expected $expected but got:"
|
local file="$1"
|
||||||
ls -al ext-test/raw/
|
local expected="$2"
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
echo "FAIL: Missing file: $file"
|
||||||
|
fail=1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
actual=$(cat "$file")
|
||||||
|
if [ "$actual" != "$expected" ]; then
|
||||||
|
echo "FAIL: Content mismatch in $file"
|
||||||
|
echo " Expected: '$expected'"
|
||||||
|
echo " Got: '$actual'"
|
||||||
|
fail=1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo "PASS: $file"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "=== Chinese ==="
|
||||||
|
check_file "cjk-download/土/file-土-${{ matrix.runs-on }}.txt" "Content for 土"
|
||||||
|
check_file "cjk-download/中文测试/file-中文测试-${{ matrix.runs-on }}.txt" "Content for 中文测试"
|
||||||
|
|
||||||
|
echo "=== Japanese ==="
|
||||||
|
check_file "cjk-download/テスト/file-テスト-${{ matrix.runs-on }}.txt" "Content for テスト"
|
||||||
|
check_file "cjk-download/東京タワー/file-東京タワー-${{ matrix.runs-on }}.txt" "Content for 東京タワー"
|
||||||
|
|
||||||
|
echo "=== Korean ==="
|
||||||
|
check_file "cjk-download/테스트/file-테스트-${{ matrix.runs-on }}.txt" "Content for 테스트"
|
||||||
|
check_file "cjk-download/서울시/file-서울시-${{ matrix.runs-on }}.txt" "Content for 서울시"
|
||||||
|
|
||||||
|
if [ "$fail" -ne 0 ]; then
|
||||||
|
echo "Some CJK artifact checks failed"
|
||||||
|
ls -alR cjk-download/ || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "All CJK artifact downloads verified successfully"
|
||||||
|
|||||||
Reference in New Issue
Block a user