Skip to content
Snippets Groups Projects
action.yml 6.23 KiB
name: 'Set environment'
description: 'Top level to set environment'
runs:
  using: "composite"
  steps:
    - run: |
        echo VARDIR=/tmp/t | tee -a $GITHUB_ENV
        echo TEST_RUN_RETRIES=3 | tee -a $GITHUB_ENV
        echo SERVER_START_TIMEOUT=290 | tee -a $GITHUB_ENV
        echo REPLICATION_SYNC_TIMEOUT=300 | tee -a $GITHUB_ENV
        echo TEST_TIMEOUT=310 | tee -a $GITHUB_ENV
        echo NO_OUTPUT_TIMEOUT=320 | tee -a $GITHUB_ENV
        echo PRESERVE_ENVVARS=VARDIR,TEST_RUN_RETRIES,SERVER_START_TIMEOUT,REPLICATION_SYNC_TIMEOUT,TEST_TIMEOUT,NO_OUTPUT_TIMEOUT,GC64 | tee -a $GITHUB_ENV
        # Configure AWS Region to avoid of issue:
        #   https://github.com/tarantool/tarantool-qa/issues/111
        echo AWS_DEFAULT_REGION=MS | tee -a $GITHUB_ENV
        # For self-hosted runners run w/o restart may need to kill
        # hanged processes that could be leaved from the previous
        # workflows runs.
        ps aux | grep " tarantool " | awk '{system("kill -9 "$2)}' || true
        ps aux | grep "test-run.py " | awk '{system("kill -9 "$2)}' || true
        # This switching off swap command will not work as github step
        # run from inside github 'container' tag. Also it will fail to
        # run from it. So running it only outside of docker container.
        # Also on local hosts, like that we use for 'freebsd' workflow
        # testing, 'sudo' not acceptable outside of 'freebsd' virtual
        # machine and to avoid of hangs let's run it with '-n' flag.
        # NOTE: To switch off swap from inside github 'container' tag
        # additional memory flags should be added to its 'options' tag:
        #   options: '--memory=<some value, like 7G> --memory-swap=<the same value as for memory option>'
        if which free ; then
            echo "Check initial swap memory values:"
            free
        fi
        if sudo -n ls /sbin/swapoff ; then
            echo "Verified that 'sudo' enabled, switching off swap ..."
            sudo /sbin/swapoff -a || echo "'swapoff' command failed, but failure is acceptable from inside the container"
            if [ -e /proc/meminfo ] ; then
                if [ "$(grep SwapTotal: /proc/meminfo | awk '{ print $2; }')" = "0" ] ; then
                    echo "Swap disabled"
                else
                    echo "WARNING: swap still exists on the host, limits in container options can resolve it"
                fi
            else
                echo "File '/proc/meminfo' not exists - couldn't check the swap size"
            fi
            if which free ; then
                echo "Check updated swap memory values if 'swapoff' succeded:"
                free
            fi
        fi
        # Found that Github checkout Actions pulls all the tags, but
        # right it deannotates the testing tag, check:
        #   https://github.com/actions/checkout/issues/290
        # But we use 'git describe ..' calls w/o '--tags' flag and it
        # prevents us from getting the needed tag for packages version
        # setup. To avoid of it, let's fetch it manually, to be sure
        # that all tags will exists always.
        # To check it, were used commands to create dump commit and tag
        # the new version. Also made twice push with extra flag for
        # tags:
        #
        #   git commit -m"Dump commit" --allow-empty
        #   git tag -a 2.4.8 -m ''
        #   git push && git push --tags
        #
        # In this way would be run 2 jobs for each package:
        #
        # 1. Build package on testing branch. It will produce package
        #    with name 2.4.7.x (because of the exception mentioned