mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-28 01:18:27 +02:00
ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows
This commit is contained in:
parent
3be87be14a
commit
62a50d2239
1 changed files with 78 additions and 80 deletions
158
.github/workflows/test.yml
vendored
158
.github/workflows/test.yml
vendored
|
@ -2,13 +2,12 @@ name: Test
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- "**.md"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- "**.md"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
|
@ -20,93 +19,92 @@ jobs:
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set Node.js 12.x
|
- name: Set Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
- name: Compile
|
- name: Compile
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
- name: Format
|
- name: Format
|
||||||
run: npm run format-check
|
run: npm run format-check
|
||||||
|
|
||||||
# Test end-to-end by uploading two artifacts and then downloading them
|
# Test end-to-end by uploading two artifacts and then downloading them
|
||||||
# Once upload-artifact v2 is out of preview, switch over
|
# Once upload-artifact v2 is out of preview, switch over
|
||||||
- name: Create artifacts
|
- name: Create artifacts
|
||||||
run: |
|
run: |
|
||||||
mkdir -p path/to/artifact-A
|
mkdir -p path/to/artifact-A
|
||||||
mkdir -p path/to/artifact-B
|
mkdir -p path/to/artifact-B
|
||||||
echo "Lorem ipsum dolor sit amet" > path/to/artifact-A/file-A.txt
|
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
|
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
|
- name: Upload artifact A
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: 'Artifact-B'
|
name: "Artifact-A"
|
||||||
path: path/to/artifact-B
|
path: path/to/artifact-A
|
||||||
|
|
||||||
# Test downloading a single artifact
|
- name: Upload artifact B
|
||||||
- name: Download artifact A
|
uses: actions/upload-artifact@v1
|
||||||
uses: ./
|
with:
|
||||||
with:
|
name: "Artifact-B"
|
||||||
name: 'Artifact-A'
|
path: path/to/artifact-B
|
||||||
path: some/new/path
|
|
||||||
|
|
||||||
# Test downloading an artifact using tilde expansion
|
# Test downloading a single artifact
|
||||||
- name: Download artifact A
|
- name: Download artifact A
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
name: 'Artifact-A'
|
name: "Artifact-A"
|
||||||
path: ~/some/path/with/a/tilde
|
path: some/new/path
|
||||||
|
|
||||||
- name: Verify successful download
|
# Test downloading an artifact using tilde expansion
|
||||||
run: |
|
- name: Download artifact A
|
||||||
$file1 = "some/new/path/file-A.txt"
|
uses: ./
|
||||||
$file2 = "~/some/path/with/a/tilde/file-A.txt"
|
with:
|
||||||
if(!(Test-Path -path $file1) -or !(Test-Path -path $file2))
|
name: "Artifact-A"
|
||||||
{
|
path: ~/some/path/with/a/tilde
|
||||||
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 both artifacts at once
|
- name: Verify successful download
|
||||||
- name: Download all Artifacts
|
run: |
|
||||||
uses: ./
|
$file1 = "some/new/path/file-A.txt"
|
||||||
with:
|
$file2 = "~/some/path/with/a/tilde/file-A.txt"
|
||||||
path: some/other/path
|
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
|
||||||
|
|
||||||
- name: Verify successful download
|
# Test downloading both artifacts at once
|
||||||
run: |
|
- name: Download all Artifacts
|
||||||
$fileA = "some/other/path/Artifact-A/file-A.txt"
|
uses: ./
|
||||||
$fileB = "some/other/path/Artifact-B/file-B.txt"
|
with:
|
||||||
if(!(Test-Path -path $fileA) -or !(Test-Path -path $fileB))
|
path: some/other/path
|
||||||
{
|
|
||||||
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
|
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue