mirror of
https://github.com/actions/download-artifact.git
synced 2024-11-22 21:55:29 +00:00
569e039f2a
There is a few use cases where we want to download a few different artifacts but not all of them. This commit implements this support, without breaking backward compatibility. Two build test cases were also added to the pipeline.
160 lines
4.4 KiB
YAML
160 lines
4.4 KiB
YAML
name: Test
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**.md'
|
|
|
|
jobs:
|
|
|
|
build:
|
|
name: Build
|
|
|
|
strategy:
|
|
matrix:
|
|
runs-on: [ubuntu-latest, macos-latest, windows-latest]
|
|
fail-fast: false
|
|
|
|
runs-on: ${{ matrix.runs-on }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set Node.js 12.x
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 12.x
|
|
|
|
- name: npm install
|
|
run: npm install
|
|
|
|
- name: Compile
|
|
run: npm run build
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Format
|
|
run: npm run format-check
|
|
|
|
# Test end-to-end by uploading two artifacts and then downloading them
|
|
# Once upload-artifact v2 is out of preview, switch over
|
|
- name: Create artifacts
|
|
run: |
|
|
mkdir -p path/to/artifact-A
|
|
mkdir -p path/to/artifact-B
|
|
echo "Lorem ipsum dolor sit amet" > path/to/artifact-A/file-A.txt
|
|
echo "Hello world from file B" > path/to/artifact-B/file-B.txt
|
|
|
|
- name: Upload artifact A
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: 'Artifact-A'
|
|
path: path/to/artifact-A
|
|
|
|
- name: Upload artifact B
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: 'Artifact-B'
|
|
path: path/to/artifact-B
|
|
|
|
# Test downloading a single artifact
|
|
- name: Download artifact A
|
|
uses: ./
|
|
with:
|
|
name: 'Artifact-A'
|
|
path: some/new/path
|
|
|
|
# Test downloading an artifact using tilde expansion
|
|
- name: Download artifact A
|
|
uses: ./
|
|
with:
|
|
name: 'Artifact-A'
|
|
path: ~/some/path/with/a/tilde
|
|
|
|
- name: Verify successful download
|
|
run: |
|
|
$file1 = "some/new/path/file-A.txt"
|
|
$file2 = "~/some/path/with/a/tilde/file-A.txt"
|
|
if(!(Test-Path -path $file1) -or !(Test-Path -path $file2))
|
|
{
|
|
Write-Error "Expected files do not exist"
|
|
}
|
|
if(!((Get-Content $file1) -ceq "Lorem ipsum dolor sit amet") -or !((Get-Content $file2) -ceq "Lorem ipsum dolor sit amet"))
|
|
{
|
|
Write-Error "File contents of downloaded artifacts are incorrect"
|
|
}
|
|
shell: pwsh
|
|
|
|
# Test downloading multiple artifacts to the same path
|
|
- name: Download artifacts A and B to the same path
|
|
uses: ./
|
|
with:
|
|
name: |
|
|
Artifact-A
|
|
Artifact-B
|
|
path: some/path/for/multiple/files
|
|
|
|
- name: Verify successful download
|
|
run: |
|
|
$fileA = "some/path/for/multiple/files/file-A.txt"
|
|
$fileB = "some/path/for/multiple/files/file-B.txt"
|
|
if(!(Test-Path -path $fileA) -or !(Test-Path -path $fileB))
|
|
{
|
|
Write-Error "Expected files do not exist"
|
|
}
|
|
if(!((Get-Content $fileA) -ceq "Lorem ipsum dolor sit amet") -or !((Get-Content $fileB) -ceq "Hello world from file B"))
|
|
{
|
|
Write-Error "File contents of downloaded artifacts are incorrect"
|
|
}
|
|
shell: pwsh
|
|
|
|
# Test downloading multiple artifacts to different paths
|
|
- name: Download artifacts A and B to different paths
|
|
uses: ./
|
|
with:
|
|
name: |
|
|
Artifact-A
|
|
Artifact-B
|
|
path: |
|
|
some/path/for/a
|
|
some/path/for/b
|
|
|
|
|
|
- name: Verify successful download
|
|
run: |
|
|
$fileA = "some/path/for/a/file-A.txt"
|
|
$fileB = "some/path/for/b/file-B.txt"
|
|
if(!(Test-Path -path $fileA) -or !(Test-Path -path $fileB))
|
|
{
|
|
Write-Error "Expected files do not exist"
|
|
}
|
|
if(!((Get-Content $fileA) -ceq "Lorem ipsum dolor sit amet") -or !((Get-Content $fileB) -ceq "Hello world from file B"))
|
|
{
|
|
Write-Error "File contents of downloaded artifacts are incorrect"
|
|
}
|
|
shell: pwsh
|
|
|
|
# Test downloading all artifacts
|
|
- name: Download all Artifacts
|
|
uses: ./
|
|
with:
|
|
path: some/other/path
|
|
|
|
- name: Verify successful download
|
|
run: |
|
|
$fileA = "some/other/path/Artifact-A/file-A.txt"
|
|
$fileB = "some/other/path/Artifact-B/file-B.txt"
|
|
if(!(Test-Path -path $fileA) -or !(Test-Path -path $fileB))
|
|
{
|
|
Write-Error "Expected files do not exist"
|
|
}
|
|
if(!((Get-Content $fileA) -ceq "Lorem ipsum dolor sit amet") -or !((Get-Content $fileB) -ceq "Hello world from file B"))
|
|
{
|
|
Write-Error "File contents of downloaded artifacts are incorrect"
|
|
}
|
|
shell: pwsh
|