Skip to content

test 3

test 3 #198

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 }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.7']
test-base: ['tests/f']
env:
# Use non-UTC time zone
TZ: XXX-05:30
# these vars are used by etc/bin/run-functional-tests
CYLC_COVERAGE: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- 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 \
"/usr/local/opt/gnu-sed/libexec/gnubin" \
>> "${GITHUB_PATH}"
echo \
"/usr/local/opt/grep/libexec/gnubin" \
>> "${GITHUB_PATH}"
# add coreutils to the bashrc too (for jobs)
cat >> "${HOME}/.bashrc" <<__HERE__
PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:/usr/local/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: Configure Atrun
run: |
PTH="$HOME/.cylc/flow/"
mkdir -p "${PTH}"
cat > "${PTH}/global.cylc" << __HERE__
[platforms]
[[_local_background_indep_tcp]]
hosts = localhost
install target = localhost
job runner = background
[[_local_at_indep_tcp]]
hosts = localhost
install target = localhost
job runner = at
__HERE__
cp "${PTH}/global.cylc" "${PTH}/global-tests.cylc"
- name: Test
id: test
timeout-minutes: 15
run: |
etc/bin/run-functional-tests \
-v \
-j 1 \
-p _local_background_indep_tcp \
tests/f/spawn-on-demand/19-submitted-compat.t \
tests/f/optional-outputs/01-stall-on-incomplete.t
- name: Debug
if: failure() && steps.test.outcome == 'failure'
timeout-minutes: 1
run: |
find "$HOME/cylc-run" -name '*.err' -type f \
-exec echo '====== {} ======' \; -exec cat '{}' \;
find "$HOME/cylc-run" -name '*.log' -type f \
-exec echo '====== {} ======' \; -exec cat '{}' \;
find "${TMPDIR:-/tmp}/${USER}/cylctb-"* -type f \
-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 }}")"
echo "uploadname=$CID" >> $GITHUB_OUTPUT
- name: Upload failed tests artifact
if: failure() && steps.test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: cylc-run (${{ steps.uploadname.outputs.uploadname }})
path: ~/cylc-run/
- name: Shutdown
if: always()
run: |
etc/bin/swarm kill
- name: Combine coverage & report
run: |
coverage combine -a
coverage xml
coverage report
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage_${{ steps.uploadname.outputs.uploadname }}
path: coverage.xml
retention-days: 7
codecov:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download coverage artifacts
uses: actions/download-artifact@v4
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
flags: functional-tests
fail_ci_if_error: true
verbose: true
# Token not required for public repos, but avoids upload failure due
# to rate-limiting (but not for PRs opened from forks)
token: ${{ secrets.CODECOV_TOKEN }}