functional tests #117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: functional tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- '.github/workflows/*.ya?ml' | |
- '!.github/workflows/test_functional.yml' | |
- 'cylc/flow/etc/syntax/**' | |
- 'etc/syntax/**' | |
- 'tests/unit/**' | |
- 'tests/integration/**' | |
- '**.md' | |
- '**/README*/**' | |
push: | |
branches: | |
- master | |
- '8.*.x' | |
paths-ignore: | |
- '.github/workflows/*.ya?ml' | |
- '!.github/workflows/test_functional.yml' | |
- 'cylc/flow/etc/syntax/**' | |
- 'etc/syntax/**' | |
- 'tests/unit/**' | |
- 'tests/integration/**' | |
- '**.md' | |
- '**/README*/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.name || matrix.chunk }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest'] | |
python-version: ['3.9'] | |
chunk: ['1/5'] | |
platform: ['_local_background*'] | |
# NOTE: includes must define ALL of the matrix values | |
include: | |
# macos | |
- name: 'macos-14' | |
os: 'macos-latest' | |
python-version: '3.9' | |
chunk: '1/5' | |
platform: '_local_background*' | |
env: | |
# Use non-UTC time zone | |
TZ: XXX-05:30 | |
# these vars are used by etc/bin/run-functional-tests | |
CYLC_TEST_PLATFORMS: ${{ matrix.platform }} | |
CYLC_COVERAGE: 1 | |
REMOTE_PLATFORM: ${{ contains(matrix.platform, '_remote') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Create global config | |
run: | | |
CONF_PATH="$HOME/.cylc/flow/8" | |
mkdir -p "$CONF_PATH" | |
touch "$CONF_PATH/global.cylc" | |
ln -s "$CONF_PATH/global.cylc" "$CONF_PATH/global-tests.cylc" | |
echo "GLOBAL_CFG_PATH=${CONF_PATH}/global.cylc" >> "$GITHUB_ENV" | |
- name: Patch DNS | |
uses: cylc/release-actions/patch-dns@v1 | |
- name: Add localhost entries to global config | |
if: startsWith(runner.os, 'macos') | |
run: | | |
cat >> "$GLOBAL_CFG_PATH" <<__HERE__ | |
[platforms] | |
[[localhost, $(hostname -f), $(hostname -s)]] | |
hosts = localhost | |
install target = localhost | |
ssh command = ssh -oBatchMode=yes -oConnectTimeout=8 -oStrictHostKeyChecking=no | |
__HERE__ | |
cat "$GLOBAL_CFG_PATH" | |
- name: Brew Install | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
# install system deps | |
brew update | |
brew install bash coreutils gnu-sed grep | |
# add GNU coreutils and sed to the user PATH | |
# (see instructions in brew install output) | |
echo "$(brew --prefix)/opt/coreutils/libexec/gnubin" >> "${GITHUB_PATH}" | |
echo "$(brew --prefix)/opt/grep/libexec/gnubin" >> "${GITHUB_PATH}" | |
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> "${GITHUB_PATH}" | |
# add coreutils to the bashrc too (for jobs) | |
cat >> "${HOME}/.bashrc" <<__HERE__ | |
PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH" | |
PATH="$(brew --prefix)/opt/grep/libexec/gnubin:$PATH" | |
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH" | |
export PATH | |
__HERE__ | |
- name: Apt-Get Install | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y sqlite3 tree at | |
- name: Add .github/bin/ to PATH | |
# Sets up mocked mail command & any other custom executables | |
run: echo "${{ github.workspace }}/.github/bin" >> $GITHUB_PATH | |
- name: Install | |
run: | | |
pip install -e ."[all]" | |
mkdir "$HOME/cylc-run" | |
- name: Start monitoring CPU | |
run: | | |
python ./monitor.py & | |
echo "MONITOR_PID=$!" >> $GITHUB_ENV | |
- name: Configure platforms | |
run: | | |
cat >> "$GLOBAL_CFG_PATH" << __HERE__ | |
[platforms] | |
[[_local_background_indep_tcp]] | |
hosts = localhost | |
install target = localhost | |
job runner = background | |
__HERE__ | |
- name: Configure git # Needed by the odd test | |
uses: cylc/release-actions/configure-git@v1 | |
- name: Test | |
id: test | |
timeout-minutes: 10 | |
continue-on-error: true | |
run: | | |
echo "finished=false" >> $GITHUB_OUTPUT | |
# NOTE: test base is purposefully un-quoted | |
etc/bin/run-functional-tests \ | |
-j 1 \ | |
--state=save \ | |
tests/functional/flow-triggers/11-wait-merge.t \ | |
|| (echo "finished=true" >> $GITHUB_OUTPUT && false) | |
- name: Time Out | |
if: steps.test.outcome == 'failure' && steps.test.outputs.finished != 'true' | |
run: | | |
echo '::error:: tests timed-out' | |
# help to identify the tests that were running at the time | |
cylc scan --state=all --format=rich --color-blind | |
# fail the workflow | |
false | |
- name: Debug | |
if: always() | |
timeout-minutes: 1 | |
run: | | |
find "$HOME/cylc-run" -name '*.err' -type f \ | |
-exec echo \; -exec echo '====== {} ======' \; -exec cat '{}' \; | |
find "$HOME/cylc-run" -name '*.log' -type f \ | |
-exec echo \; -exec echo '====== {} ======' \; -exec cat '{}' \; | |
find "${TMPDIR:-/tmp}/${USER}/cylctb-"* -type f \ | |
-exec echo \; -exec echo '====== {} ======' \; -exec cat '{}' \; | |
- name: Set artifact upload name | |
if: always() | |
id: uploadname | |
run: | | |
# artifact name cannot contain '/' characters | |
CID="$(sed 's|/|-|g' <<< "${{ matrix.name || matrix.chunk }}")" | |
echo "uploadname=$CID" >> $GITHUB_OUTPUT | |
- name: Upload tests artifact | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cylc-run (${{ steps.uploadname.outputs.uploadname }}) | |
path: ~/cylc-run/ | |
- name: Stop monitoring CPU | |
if: always() | |
run: | | |
kill $MONITOR_PID | |
cat ./cpu.txt |