Skip to content

Tests

Tests #5806

Workflow file for this run

name: Tests
on:
push:
branches: [master]
pull_request:
schedule:
- cron: '0 2 * * *'
jobs:
unit-tests:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
ruby: ["2.7.1"]
bundler: ["2.1.4"]
include:
# Test versions from Ubuntu 22.04
- os: ubuntu-latest
ruby: "3.0.2"
bundler: "2.3.5"
# Test versions from RHEL8 & RHEL9
- os: ubuntu-latest
ruby: "3.1.2"
bundler: "2.3.7"
# Test versions from Amazon Linux 2023
- os: ubuntu-latest
ruby: "3.2.2"
bundler: "2.4.10"
runs-on: ${{ matrix.os }}
name: Unit tests
steps:
- name: Checkout ${{ github.sha }}
uses: actions/checkout@v3
- name: Setup Ruby ${{ matrix.ruby }} using Bundler ${{ matrix.bundler }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ matrix.bundler }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-unit-gems-${{ hashFiles('apps/*/Gemfile.lock', 'Gemfile.lock') }}-1
- name: Setup Bundler
run: |
bundle config path ~/vendor/bundle
bundle install
gem install rake
- name: Setup rclone
run: sudo apt-get update && sudo apt-get install rclone
- name: Run unit tests
run: bundle exec rake test:unit
- name: Run ShellCheck
run: bundle exec rake test:shellcheck
- name: Check file encodings
run: bundle exec rake test:unix
- name: Run Zeitwerk check
run: |
cd apps/dashboard
bundle install
bundle exec rake zeitwerk:check
- name: Run lint tests
run: bundle exec rake lint || true
- name: Run System Dashboard tests
run: cd apps/dashboard; bin/rake test:system
- name: Upload system test failures.
if: failure()
uses: actions/upload-artifact@v3
with:
name: system-test-failures-${{ matrix.ruby }}
path: |
apps/dashboard/tmp/screenshots/*.png
apps/dashboard/log/test.log
k8s-tests:
runs-on: ubuntu-latest
name: Kubernetes tests
steps:
- name: Checkout ${{ github.sha }}
uses: actions/checkout@v3
- name: Create kind cluster
uses: container-tools/kind-action@v2
- name: Apply ondemand RBAC
run: kubectl apply -f hooks/k8s-bootstrap/ondemand.yaml
- name: Get ondemand token
id: token
run: |
TOKEN=$(kubectl create token ondemand --namespace=ondemand)
echo "ondemand=${TOKEN}" >> $GITHUB_OUTPUT
- name: Setup kubectl
run: |
kubectl config set-credentials ondemand --token="${{ steps.token.outputs.ondemand }}"
kubectl config set-context kind-kind --user=ondemand
kubectl config use-context kind-kind
kubectl cluster-info
- name: Test k8s-bootstrap
run: /bin/bash hooks/k8s-bootstrap/k8s-bootstrap-ondemand.sh test hooks/hook.env.example
e2e-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
dist:
- el8
- el9
- amzn2023
- ubuntu-20.04
- ubuntu-22.04
- debian-12
arch:
- x86_64
- aarch64
- ppc64le
version: ["3.1"]
exclude:
# Amazon 2023 on aarch64 is very slow and will time out
- dist: amzn2023
arch: aarch64
# Amazon 2023 doesn't have ppc64le containers
- dist: amzn2023
arch: ppc64le
# Ubuntu doesn't have way to get NodeJS 14+ on ppc64le
- dist: ubuntu-20.04
arch: ppc64le
# Ubuntu doesn't have way to get NodeJS 14+ on ppc64le
- dist: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.os }}
name: E2E test ${{ matrix.dist }}-${{ matrix.arch }}
steps:
- name: Checkout ${{ github.sha }}
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Ruby using Bundler
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7.1"
bundler: "2.1.4"
bundler-cache: true
- name: Build package
if: matrix.arch == 'x86_64'
run: bundle exec rake package:build[${{ matrix.dist }},${{ matrix.arch }}]
env:
VERSION: "${{ matrix.version }}.0"
OOD_PACKAGING_DEBUG: 'true'
- name: Run package tests
if: matrix.arch == 'x86_64'
run: bundle exec rake test:e2e
env:
BEAKER_set: ${{ matrix.dist }}
OOD_BUILD_REPO: ${{ matrix.version }}
- name: arch distro
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
run: |
DISTRO=$(echo "${{ matrix.os }}" | sed 's|\-||g')
echo "DISTRO=${DISTRO}" >> $GITHUB_ENV
if [ "${{ matrix.arch }}" == "aarch64" ]; then
echo "PLATFORM=linux/arm64" >> $GITHUB_ENV
fi
if [ "${{ matrix.arch }}" == "ppc64le" ]; then
echo "PLATFORM=linux/ppc64le" >> $GITHUB_ENV
fi
- name: Test OnDemand
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
distro: ${{ env.DISTRO }}
githubToken: ${{ github.token }}
install: |
apt update -y
apt install -y ruby-bundler ruby-dev build-essential git \
apt-transport-https ca-certificates curl software-properties-common
# Not available for ppc64le
# apt install -y chromium-chromedriver
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update -y
apt install -y docker-ce
dockerRunArgs: |
--platform ${{ env.PLATFORM }}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
bundle install
bundle exec rake package:build[${{ matrix.dist }},${{ matrix.arch }}]
# e2e tests fail with issues accessing chorium
# bundle exec rake test:e2e
env: |
VERSION: "${{ matrix.version }}.0"
OOD_PACKAGING_DEBUG: 'true'
BEAKER_set: ${{ matrix.dist }}-${{ matrix.arch }}
OOD_BUILD_REPO: ${{ matrix.version }}
DOCKER_IN_DOCKER: 'true'
- name: Debug failure
if: failure()
run: |
find tmp/e2e_ctr/ -type f -name *.log -exec cat {} +