Skip to content

test

test #1656

Workflow file for this run

name: test
on:
push:
branches:
- master
- '2.*.x'
pull_request:
workflow_dispatch:
inputs:
rose_ref:
description: The Rose branch to test against
required: true
fcm_ref:
description: The FCM branch to test against
required: false
fcm_repo:
description: The FCM repo to test against
required: false
cylc_flow_tag:
description: The cylc-flow branch to test against
required: false
cylc_flow_repo:
description: The cylc-flow repo to test against
required: false
cylc_rose_tag:
description: The cylc-rose branch to test against
required: false
cylc_rose_repo:
description: The cylc-rose repo to test against
required: false
schedule:
- cron: '37 04 * * 1-5' # 03:37, Monday-Friday
defaults:
run:
shell: bash # macos default shell is zsh
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.rose_ref || github.sha }}
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Apt-Get Install
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Install Rose
run: |
pip install ."[lint]"
yarn install
- name: Flake8
run: flake8
- name: Shellchecker
run: etc/bin/shellchecker
- name: ESLint
run: yarn run lint
- name: MyPy
run: |
mypy
test:
needs: lint
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.7', '3.8', '3.9']
include:
- os: 'macos-latest'
python-version: '3.8'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.rose_ref || github.sha }}
path: rose
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Patch DNS
uses: cylc/release-actions/patch-dns@v1
- name: Brew Install
if: startsWith(matrix.os, 'macos')
run: |
# install system deps
brew install \
bash \
coreutils \
gnu-sed \
sqlite3 \
subversion
# add GNU coreutils and sed to the user PATH (for actions steps)
# (see instructions in brew install output)
echo "$(brew --prefix)/opt/coreutils/libexec/gnubin" >> "${GITHUB_PATH}"
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> "${GITHUB_PATH}"
# add GNU coreutils and sed to the user PATH (for Cylc jobs)
cat >> "$HOME/.bashrc" <<__HERE__
PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH"
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
PATH="$pythonLocation:\$PATH"
export PATH
# see NOTE in t/rosie-lookup/00-basic.t
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
__HERE__
cat "$HOME/.bashrc"
- name: Configure git # Configure Git for Git dependent tests.
uses: cylc/release-actions/configure-git@v1
- name: Apt-Get Install
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y shellcheck sqlite3 at graphviz graphviz-dev
- name: Install Rose
working-directory: rose
run: |
pip install ."[tests,docs${{ (startsWith(matrix.os, 'ubuntu') && ',graph,rosa') || '' }}]"
yarn install
- name: Install Cylc
uses: cylc/release-actions/install-cylc-components@v1
with:
cylc_flow: true
cylc_flow_opts: ''
cylc_flow_repo: ${{ inputs.cylc_flow_repo || 'cylc/cylc-flow' }}
cylc_flow_tag: ${{ inputs.cylc_flow_tag }}
cylc_rose: true
cylc_rose_opts: ''
cylc_rose_repo: ${{ inputs.cylc_rose_repo || 'cylc/cylc-rose' }}
cylc_rose_tag: ${{ inputs.cylc_rose_tag }}
- name: Checkout FCM
if: startsWith(matrix.os, 'ubuntu')
uses: actions/checkout@v4
with:
repository: ${{ inputs.fcm_repo || 'metomi/fcm' }}
ref: ${{ inputs.fcm_ref || 'master' }}
path: 'fcm'
- name: Install FCM
if: startsWith(matrix.os, 'ubuntu')
run: |
# install FCM deps
sudo apt-get install -y \
subversion \
build-essential \
gfortran \
libxml-parser-perl \
libconfig-inifiles-perl \
libdbi-perl \
libdbd-sqlite3-perl
# install wandisco
sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu \
`lsb_release -cs` svn19" \
>> /etc/apt/sources.list.d/subversion19.list'
sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- \
| sudo apt-key add -
# prepend FCM bin to $PATH
FCM_PATH="$GITHUB_WORKSPACE/fcm/bin"
# the github actions way (needed for cylc jobs)
echo "$FCM_PATH" >> "${GITHUB_PATH}"
# the bashrc wat (needed for subsequent gh action steps)
echo "export PATH=\"$FCM_PATH:\$PATH\"" >> "$HOME/.bashrc"
- name: Unit Tests
working-directory: rose
run: |
pytest
- name: Functional Tests
timeout-minutes: 30
id: functest
working-directory: rose
env:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: YES
run: |
# rose tests should pass first time around
etc/bin/rose-test-battery -j 4 --state=save
- name: Re-Run Fails
if: failure() && steps.functest.outcome == 'failure'
working-directory: rose
env:
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: YES
run: |
# so we only re-run for debug purposes
cylc scan --state=all --color=never
etc/bin/rose-test-battery -j 1 -v --state=save,failed
- name: Upload cylc-run artifact
if: failure() && steps.functest.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: cylc-run ${{ matrix.os }} py-${{ matrix.python-version }}
path: ~/cylc-run/
docs:
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.rose_ref || github.sha }}
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: install graphviz
run: |
sudo apt-get update
sudo apt-get install -y graphviz pkg-config libgraphviz-dev
- name: Install Rose
run: |
pip install -e .[docs,graph]
- name: Install Cylc
uses: cylc/release-actions/install-cylc-components@v1
with:
cylc_flow: true
cylc_flow_opts: ''
cylc_flow_repo: ${{ inputs.cylc_flow_repo || 'cylc/cylc-flow' }}
cylc_flow_tag: ${{ inputs.cylc_flow_tag }}
cylc_rose: true
cylc_rose_opts: ''
cylc_rose_repo: ${{ inputs.cylc_rose_repo || 'cylc/cylc-rose' }}
cylc_rose_tag: ${{ inputs.cylc_rose_tag }}
- name: build (html)
run: |
make -C sphinx/ html SPHINXOPTS='-Wn'
# - name: build (slides)
# run: |
# make -C sphinx/ slides SPHINXOPTS='-Wn'
- name: build (linkcheck)
run: |
make -C sphinx/ linkcheck SPHINXOPTS='-Wn'
- name: debug
if: failure()
run: |
cat /tmp/sphinx-err* >&2 || true