mirror of
https://code.forgejo.org/actions/download-artifact
synced 2025-07-13 21:53:52 +02:00
Update tests
This commit is contained in:
parent
6543ed44d3
commit
a3a977a1d6
1 changed files with 9 additions and 12 deletions
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
|
@ -59,7 +59,7 @@ jobs:
|
||||||
- name: Create artifact B
|
- name: Create artifact B
|
||||||
run: |
|
run: |
|
||||||
mkdir -p path/to/artifact-B
|
mkdir -p path/to/artifact-B
|
||||||
echo hello!! > path/to/artifact-B/world-B.txt
|
echo Hello!! > path/to/artifact-B/world-B.txt
|
||||||
|
|
||||||
- name: Upload artifact B
|
- name: Upload artifact B
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
|
@ -74,21 +74,20 @@ jobs:
|
||||||
name: 'Artifact-A'
|
name: 'Artifact-A'
|
||||||
path: some/new/path
|
path: some/new/path
|
||||||
|
|
||||||
- name: Verify successful download - Windows
|
- name: Verify successful download
|
||||||
run: |
|
run: |
|
||||||
$file = "some/new/path/world-A.txt"
|
$file = "some/new/path/world-A.txt"
|
||||||
if(!(Test-Path -path $file))
|
if(!(Test-Path -path $file))
|
||||||
{
|
{
|
||||||
Write-Error "Expected file does not exist"
|
Write-Error "Expected file does not exist"
|
||||||
}
|
}
|
||||||
$containsWord = $file | %{$_ -match "hello?"}
|
if(!((Get-Content $file) -ceq "hello?"))
|
||||||
if(!($containsWord -contains $true))
|
|
||||||
{
|
{
|
||||||
Write-Error "File contents of downloaded artifact are incorrect"
|
Write-Error "File contents of downloaded artifact are incorrect"
|
||||||
}
|
}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
# Test downloading both artifacts
|
# Test downloading both artifacts at once
|
||||||
- name: Download all Artifacts
|
- name: Download all Artifacts
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -96,15 +95,13 @@ jobs:
|
||||||
|
|
||||||
- name: Verify successful download
|
- name: Verify successful download
|
||||||
run: |
|
run: |
|
||||||
$file1 = "some/other/path/Artifact-A/world-A.txt"
|
$fileA = "some/other/path/Artifact-A/world-A.txt"
|
||||||
$file2 = "some/other/path/Artifact-B/world-B.txt"
|
$fileB = "some/other/path/Artifact-B/world-B.txt"
|
||||||
if(!(Test-Path -path $file1) || !(Test-Path -path $file2))
|
if(!(Test-Path -path $fileA) || !(Test-Path -path $fileB))
|
||||||
{
|
{
|
||||||
Write-Error "Expected file does not exist"
|
Write-Error "Expected files do not exist"
|
||||||
}
|
}
|
||||||
$containsWordA = $file1 | %{$_ -match "hello?"}
|
if(!((Get-Content $fileA) -ceq "hello?") || !((Get-Content $fileB) -ceq "Hello!!"))
|
||||||
$containsWordB = $file2 | %{$_ -match "hello!!"}
|
|
||||||
if(!($containsWordA -contains $true) || !($containsWordB -contains $true))
|
|
||||||
{
|
{
|
||||||
Write-Error "File contents of downloaded artifacts are incorrect"
|
Write-Error "File contents of downloaded artifacts are incorrect"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue