Use Argos with GitHub Actions
Configure GitHub Actions to send screenshots to Argos visual testing platform.
1. Install Argos CLI
- npm
- yarn
- pnpm
npm i --save-dev @argos-ci/cli
yarn add --dev @argos-ci/cli
pnpm add --save-dev @argos-ci/cli
Read the CLI documentation if you need information about advanced usages.
2. Upload the screenshots
Add the following command to your CI workflow to upload screenshots to Argos:
- npm
- yarn
- pnpm
npx @argos-ci/cli upload ./screenshots
yarn run @argos-ci/cli upload ./screenshots
pnpm exec @argos-ci/cli upload ./screenshots
Complete example
.github/workflows/ci.yml
name: Argos
on:
push:
# Argos has to run on your reference branch to creates reference builds
branches: [main]
pull_request:
branches: [main]
jobs:
argos:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: current
- name: Install dependencies
run: npm ci
# -----
# 👉 Insert the steps required to take screenshots
# -----
- name: Upload screenshots to argos-ci.com
continue-on-error: true
# 👇 change "./screenshots" by your screenshots folder path
run: npx @argos-ci/cli upload ./screenshots
For a repository examples, check out our GitHub repository.
What's next?
Congratulations on installing Argos! 🎉
The next step is to integrate visual review into your development workflow. Visit our review changes section to learn how to.
Troubleshooting
Force repository detection with ARGOS_TOKEN
To ensure seamless integration with GitHub Actions, the ARGOS_TOKEN is usually not required. However, if the automatic repository detection doesn't work, you may need to specify the token. If that's the case, follow these steps:- Log in to Argos, navigate to your repository settings and copy your
ARGOS_TOKEN
. - Navigate to your repository settings on GitHub and set a new repository secret called
ARGOS_TOKEN
with the value you have copied. - Expose the
ARGOS_TOKEN
when you call the argos' upload command.
.github/workflows/ci.yml
- name: Upload screenshots to argos-ci.com
continue-on-error: true
env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
run: npx @argos-ci/cli upload ./screenshots