mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-26 00:18:30 +02:00
104 lines
No EOL
2.9 KiB
YAML
104 lines
No EOL
2.9 KiB
YAML
name: Test
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
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: Set artifact file contents
|
|
run: |
|
|
echo "::set-env name=non-gzip-artifact-content::hello"
|
|
echo "::set-env name=gzip-artifact-content::Some large amount of text that has a compression ratio that is greater than 100%. If greater than 100%, gzip is used to upload the file"
|
|
|
|
- name: Create artifacts
|
|
run: |
|
|
mkdir -p path/to/artifact-A
|
|
mkdir -p path/to/artifact-B
|
|
echo ${{ env.non-gzip-artifact-content }} > path/to/artifact-A/file-A.txt
|
|
echo ${{ env.gzip-artifact-content }} > path/to/artifact-B/file-B.txt
|
|
|
|
- name: Upload artifact A
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: 'Artifact-A'
|
|
path: path/to/artifact-A
|
|
|
|
- name: Upload artifact B
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: 'Artifact-B'
|
|
path: path/to/artifact-B
|
|
|
|
- name: Download artifact A with no extra folder (default)
|
|
uses: ./
|
|
with:
|
|
name: 'Artifact-A'
|
|
path: download/with/artifact-folder/false
|
|
|
|
- name: Verify successful download with no extra folder
|
|
shell: bash
|
|
run: |
|
|
scripts/test-artifact-file.sh "download/with/artifact-folder/false/file-A.txt" "${{ env.non-gzip-artifact-content }}"
|
|
|
|
- name: Download artifact A with artifact-folder set to true
|
|
uses: ./
|
|
with:
|
|
name: 'Artifact-A'
|
|
path: download/with/artifact-folder/true
|
|
artifact-folder: true
|
|
|
|
- name: Verify successful download with an extra folder
|
|
shell: bash
|
|
run: |
|
|
scripts/test-artifact-file.sh "download/with/artifact-folder/true/Artifact-A/file-A.txt" "${{ env.non-gzip-artifact-content }}"
|
|
|
|
# Test downloading both artifacts at once
|
|
- name: Download all Artifacts
|
|
uses: ./
|
|
with:
|
|
path: some/other/path
|
|
|
|
- name: Verify downloadAllArtifacts()
|
|
shell: bash
|
|
run: |
|
|
scripts/test-artifact-file.sh "some/other/path/Artifact-A/file-A.txt" "${{ env.non-gzip-artifact-content }}"
|
|
scripts/test-artifact-file.sh "some/other/path/Artifact-B/file-B.txt" "${{ env.gzip-artifact-content }}" |