Skip to content

Workflow file for this run

name: BATS on macOS on latest CI build
on:
workflow_dispatch:
inputs:
owner:
description: Override owner (e.g. rancher-sandbox)
type: string
repo:
description: Override repository (e.g. rancher-desktop)
type: string
branch:
description: Override branch (e.g. main)
type: string
tests:
description: 'Tests (e.g. tests/containers/*)'
default: 'tests/*'
type: string
results:
description: Number of runs to search for Package workflow
default: 30
type: number
env:
SCRIPT: install-latest-ci.sh
RD_LOCATION: user
GH_OWNER: ${{ github.repository_owner }}
GH_REPOSITORY: ${{ github.repository }}
GH_REF_NAME: ${{ github.ref_name }}
jobs:
bats:
runs-on: macos-12
strategy:
fail-fast: false
matrix:
engine:
- containerd
- moby
steps:
- name: Fetch install script
run: |
URL="https://raw.githubusercontent.com/$GH_REPOSITORY/$GH_REF_NAME/scripts/$SCRIPT"
curl --output-dir "$TMPDIR" -O "$URL"
chmod +x "$TMPDIR/$SCRIPT"
- name: Install latest CI build
run: |
: ${OWNER:=$GH_OWNER}
: ${REPO:=${GH_REPOSITORY#$GH_OWNER/}}
: ${BRANCH:=$GH_REF_NAME}
"$TMPDIR/$SCRIPT"
env:
GH_TOKEN: ${{ github.token }}
OWNER: ${{ inputs.owner }}
REPO: ${{ inputs.repo }}
BRANCH: ${{ inputs.branch }}
RESULTS: ${{ inputs.results }}
- name: Run BATS
run: |
DEFAULT_DIR=$PWD
cd "$TMPDIR/bats"
./bats-core/bin/bats \
--gather-test-outputs-in "$DEFAULT_DIR/logs" \
--report-formatter tap \
${{ inputs.tests }}
env:
RD_CONTAINER_ENGINE: ${{ matrix.engine }}
RD_CAPTURE_LOGS: "true"
RD_TAKE_SCREENSHOTS: "true"
RD_USE_IMAGE_ALLOW_LIST: "true"
- name: Consolidate logs
if: ${{ success() || failure() }}
run: |
cp -R "$TMPDIR/bats/logs/" logs
cp "$TMPDIR/bats/report.tap" logs
- name: Upload logs
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.engine }}.logs
path: logs/
if-no-files-found: error