mirror of https://github.com/actions/toolkit
69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
# Temporarily disabled while v2.0.0 of @actions/artifact is under development
|
|
|
|
name: artifact-unit-tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**.md'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
|
|
strategy:
|
|
matrix:
|
|
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
|
fail-fast: false
|
|
|
|
runs-on: ${{ matrix.runs-on }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set Node.js 16.x
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16.x
|
|
|
|
# In order to upload & download artifacts from a shell script, certain env variables need to be set that are only available in the
|
|
# node context. This runs a local action that gets and sets the necessary env variables that are needed
|
|
- name: Set env variables
|
|
uses: ./packages/artifact/__tests__/ci-test-action/
|
|
|
|
# Need root node_modules because certain npm packages like jest are configured for the entire repository and it won't be possible
|
|
# without these to just compile the artifacts package
|
|
- name: Install root npm packages
|
|
run: npm ci
|
|
|
|
- name: Compile artifact package
|
|
run: |
|
|
npm ci
|
|
npm run tsc
|
|
working-directory: packages/artifact
|
|
|
|
- name: Set artifact file contents
|
|
shell: bash
|
|
run: |
|
|
echo "file1=hello from file 1" >> $GITHUB_ENV
|
|
echo "file2=hello from file 2" >> $GITHUB_ENV
|
|
|
|
- name: Create files that will be uploaded
|
|
run: |
|
|
mkdir artifact-path
|
|
echo '${{ env.file1 }}' > artifact-path/first.txt
|
|
echo '${{ env.file2 }}' > artifact-path/second.txt
|
|
|
|
# We're using node -e to call the functions directly available in the @actions/artifact package
|
|
- name: Upload artifacts using uploadArtifact()
|
|
run: |
|
|
node -e "Promise.resolve(require('./packages/artifact/lib/artifact').create().uploadArtifact('my-artifact-${{ matrix.node-version }}',['artifact-path/first.txt','artifact-path/second.txt'], process.argv[1]))" "${{ github.workspace }}"
|
|
|
|
|
|
|