Skip to content

Smoke Tests

Smoke Tests #8196

Workflow file for this run

name: Smoke Tests
on:
push:
branches: [feat/smoke-test, smoke/**]
release:
types: [published]
schedule:
- cron: '0 * * * *'
jobs:
smoke_test:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false # we care about other platforms and channels building
matrix:
os: [ubuntu, macos, windows]
snyk_install_method: [binary, npm, yarn]
node_version: [10, 12, 14, 15]
exclude:
# Skip yarn for Windows, as it's a bit crazy to get it working in CI environment. Unless we see evidence we need it, I'd avoid it
- snyk_install_method: yarn
os: windows
# For binary, use only the Node 14
- snyk_install_method: binary
node_version: 10
- snyk_install_method: binary
node_version: 12
- snyk_install_method: binary
node_version: 15
- snyk_install_method: yarn # yarn doesn't support Node v10 anymore
node_version: 10
include:
- snyk_install_method: binary
os: ubuntu
snyk_cli_dl_file: snyk-linux
- snyk_install_method: binary
os: macos
snyk_cli_dl_file: snyk-macos
# Homebrew installation
- snyk_install_method: brew
os: macos
- snyk_install_method: alpine-binary
os: ubuntu
snyk_cli_dl_file: snyk-alpine
- snyk_install_method: npm-root-user
os: ubuntu
- snyk_install_method: docker-bundle
os: macos
snyk_cli_dl_file: docker-mac-signed-bundle.tar.gz
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1 # Needed for fixtures installation
with:
node-version: ${{ matrix.node_version }}
- name: Install Snyk with npm
if: ${{ matrix.snyk_install_method == 'npm' }}
run: |
echo "node_version: ${{ matrix.node_version }}"
node -v
echo "install snyk with npm"
npm install -g snyk
- name: Install Snyk with Yarn globally
if: ${{ matrix.snyk_install_method == 'yarn' }}
run: |
npm install yarn -g
echo "Yarn global path"
yarn global bin
echo 'export PATH="$PATH:$(yarn global bin)"' >> ~/.bash_profile
yarn global add snyk
- name: npm install for fixture project
working-directory: test/fixtures/basic-npm
run: |
npm install
- name: Run alpine test
if: ${{ matrix.snyk_install_method == 'alpine-binary' }}
env:
SMOKE_TESTS_SNYK_TOKEN: ${{ secrets.SMOKE_TESTS_SNYK_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t snyk-cli-alpine -f ./test/smoke/alpine/Dockerfile ./test
docker run -eCI=1 -eSMOKE_TESTS_SNYK_TOKEN -eGITHUB_TOKEN snyk-cli-alpine
- name: Install snyk from Docker bundle
if: ${{ matrix.snyk_install_method == 'docker-bundle' }}
run: |
curl -Lo ./snyk-cli.tar.gz 'https://static.snyk.io/cli/latest/${{ matrix.snyk_cli_dl_file }}'
sudo mkdir -p /usr/local/bin/snyk-mac
sudo mv ./snyk-cli.tar.gz /usr/local/bin/snyk-mac
sudo tar -xf /usr/local/bin/snyk-mac/snyk-cli.tar.gz -C /usr/local/bin/snyk-mac # makes a folder called docker
sudo ln -s /usr/local/bin/snyk-mac/docker/snyk-mac.sh /usr/local/bin/snyk-mac/docker/snyk
ls -la /usr/local/bin/snyk-mac/docker
export PATH="/usr/local/bin/snyk-mac/docker:$PATH"
which snyk
snyk version
- name: Run npm test with Root user
if: ${{ matrix.snyk_install_method == 'npm-root-user' }}
env:
SMOKE_TESTS_SNYK_TOKEN: ${{ secrets.SMOKE_TESTS_SNYK_TOKEN }}
run: |
docker build -t snyk-docker-root -f ./test/smoke/docker-root/Dockerfile ./test
docker run -eCI=1 -eSMOKE_TESTS_SNYK_TOKEN snyk-docker-root
- name: Install Snyk with binary - Non-Windows
if: ${{ matrix.snyk_install_method == 'binary' && matrix.os != 'windows' }}
run: |
curl -Lo ./snyk-cli 'https://static.snyk.io/cli/latest/${{ matrix.snyk_cli_dl_file }}'
chmod -R +x ./snyk-cli
sudo mv ./snyk-cli /usr/local/bin/snyk
snyk --version
- name: Install Snyk with binary - Windows
if: ${{ matrix.snyk_install_method == 'binary' && matrix.os == 'windows' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: powershell
run: |
echo "install snyk with binary"
echo $env:PATH
sh ./test/smoke/install-snyk-binary-win.sh
- name: Install Shellspec - non-windows
if: ${{ matrix.os != 'windows' && matrix.snyk_install_method != 'alpine-binary' }}
run: |
curl -fsSL https://git.io/shellspec | sh -s -- -y
sudo ln -s ${HOME}/.local/lib/shellspec/shellspec /usr/local/bin/shellspec
ls -la ${HOME}/.local/lib/shellspec
echo "shellspec symlink:"
ls -la /usr/local/bin/shellspec
/usr/local/bin/shellspec --version
which shellspec
shellspec --version
- name: Install test utilities with homebrew on macOS
if: ${{ matrix.os == 'macos' }}
# We need "timeout" and "jq" util and we'll use brew to check our brew package as well
run: |
brew install coreutils
brew install jq
- name: Install Snyk CLI with homebrew on macOS
if: ${{ matrix.snyk_install_method == 'brew' }}
run: |
brew tap snyk/tap
brew install snyk
- name: Install scoop on Windows
if: ${{ matrix.os == 'windows'}}
run: |
iwr -useb get.scoop.sh | iex
scoop install jq
- name: Install jq on Ubuntu
if: ${{ matrix.os == 'ubuntu' && matrix.snyk_install_method != 'alpine-binary' && matrix.snyk_install_method != 'npm-root-user' }}
run: |
sudo apt-get install jq
- name: Install Shellspec - Windows
shell: powershell
if: ${{ matrix.os == 'windows' }}
run: |
Get-Host | Select-Object Version
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
sh ./test/smoke/install-shellspec-win.sh
- name: Run shellspec tests - non-Windows
if: ${{ matrix.os != 'windows' && matrix.snyk_install_method != 'alpine-binary' && matrix.snyk_install_method != 'npm-root-user' }}
working-directory: test/smoke
shell: bash -l {0} # run bash with --login flag to load .bash_profile that's used by yarn install method
env:
SMOKE_TESTS_SNYK_TOKEN: ${{ secrets.SMOKE_TESTS_SNYK_TOKEN }}
run: |
export PATH="/usr/local/bin/snyk-mac/docker:$PATH"
which snyk
snyk version
shellspec -f d
- name: Run shellspec tests - Windows
if: ${{ matrix.os == 'windows' }}
working-directory: test/smoke
shell: powershell
env:
SMOKE_TESTS_SNYK_TOKEN: ${{ secrets.SMOKE_TESTS_SNYK_TOKEN }}
run: |
sh ./run-shellspec-win.sh