tree: 5bc3fff67abfb3d47ce1b2b9ca1213d2db6c992c [path history] [tgz]
  1. __tests__/
  2. dist/
  3. src/
  4. .editorconfig
  5. .eslintignore
  6. .eslintrc.json
  7. .gitattributes
  8. .gitignore
  9. .prettierignore
  10. .prettierrc.json
  11. babel.config.js
  12. build_and_commit.sh
  13. jest.config.js
  14. LICENSE
  15. package-lock.json
  16. package.json
  17. README.md
  18. test_install.sh
gh-actions-artifact-client/README.md

GitHub Actions Artifact client

Provides command line access to GitHub Actions Artifact upload / download.

The benefit is that any command can be used to produce the artifact and any command can be used to consume the artifact.

The upload is streamed from stdin and the download is streamed to stdout.

This makes it possible to use docker save and docker load to work efficiently with GitHub Actions Artifacts.

Usage

It is necessary to set up the required tokens and script once in a build job:

- uses: lhotari/gh-actions-artifact-client/dist@master

After this, gh-actions-artifact-client.js will be available in run scripts.

uploading - stores stdin input as multiple files under the given artifact name

some_command | gh-actions-artifact-client.js upload artifact_name

downloading - retries the given artifact and outputs to stdout. This is meant to be used only for artifacts that were uploaded in the same format.

gh-actions-artifact-client.js download artifact_name | some_command

Uploading and downloading requires about 600MB RAM with the default settings. In uploading, the stream is split into multiple file parts where each part is of the size of 256MB. The reason for this is the limitation of GitHub Actions Artifacts where the uploaded files must have a predefined size. The streaming will buffer into memory so that parts are fully contained before they are uploaded.

Development testing

There are a few unit tests with limited assertions

npm test

Unit tests use nock HTTP server mocking.

Manual development testing

Commands that were used to do manual verification on GitHub Actions runner VM. action-upterm was used to open a ssh session to the runner VM for testing.

git clone https://github.com/lhotari/gh-actions-artifact-client
cd gh-actions-artifact-client/
sudo chown $USER /mnt
dd if=/dev/random of=/mnt/testfile2 bs=1M count=600
sudo apt install pv
pv /mnt/testfile2 |node dist/index.js upload testfile2
node dist/index.js download testfile2 |pv > /mnt/testfile2_downloaded
md5sum /mnt/testfile2
md5sum /mnt/testfile2_downloaded