Skip to content

Weekly Regression Tests #328

Weekly Regression Tests

Weekly Regression Tests #328

name: Weekly Regression Tests
on:
schedule:
# 5am UTC = 12am EST (Saturday)
- cron: '0 5 * * 6'
# Allows you to run this workflow manually from the Actions tab and change the
# testing environment, OSF service, and browser.
workflow_dispatch:
inputs:
domain:
description: 'Testing Environment'
required: true
default: 'test'
type: choice
options:
- test
- stage1
- stage2
- stage3
service:
description: 'OSF Service'
required: true
default: 'All'
type: choice
options:
- All
- Preprints
- Registries
- Meetings
- Institutions
- Projects
- Collections
- Users
- Other
browser:
description: 'Browser'
required: true
default: 'All'
type: choice
options:
- All
- chrome
- firefox
- edge
env:
DRIVER: "Remote"
DEFAULT_DOMAIN: test
DEFAULT_SERVICE: All
DEFAULT_BROWSER: All
DEFAULT_MATRIX: "['chrome','firefox','edge']"
DOMAIN: ${{ github.event.inputs.domain }}
NEW_USER_EMAIL: ${{ secrets.NEW_USER_EMAIL }}
BSTACK_USER: ${{ secrets.BROWSERSTACK_USERNAME }}
BSTACK_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
CHROME_USER: ${{ secrets.CHROME_USER }}
CHROME_USER_TOKEN: ${{ secrets.CHROME_USER_TOKEN }}
EDGE_USER: ${{ secrets.EDGE_USER }}
EDGE_USER_TOKEN: ${{ secrets.EDGE_USER_TOKEN }}
FIREFOX_USER: ${{ secrets.FIREFOX_USER }}
FIREFOX_USER_TOKEN: ${{ secrets.FIREFOX_USER_TOKEN }}
USER_ONE: ${{ secrets.USER_ONE }}
USER_ONE_PASSWORD: ${{ secrets.USER_ONE_PASSWORD }}
USER_TWO: ${{ secrets.USER_TWO }}
USER_TWO_PASSWORD: ${{ secrets.USER_TWO_PASSWORD }}
DEACTIVATED_USER: ${{ secrets.DEACTIVATED_USER }}
DEACTIVATED_USER_PASSWORD: ${{ secrets.DEACTIVATED_USER_PASSWORD }}
UNCONFIRMED_USER: ${{ secrets.UNCONFIRMED_USER }}
UNCONFIRMED_USER_PASSWORD: ${{ secrets.UNCONFIRMED_USER_PASSWORD }}
CAS_2FA_USER: ${{ secrets.CAS_2FA_USER }}
CAS_2FA_USER_PASSWORD: ${{ secrets.CAS_2FA_USER_PASSWORD }}
CAS_TOS_USER: ${{ secrets.CAS_TOS_USER }}
CAS_TOS_USER_PASSWORD: ${{ secrets.CAS_TOS_USER_PASSWORD }}
DEVAPP_CLIENT_ID: ${{ secrets.DEVAPP_CLIENT_ID }}
DEVAPP_CLIENT_SECRET: ${{ secrets.DEVAPP_CLIENT_SECRET }}
IMAP_EMAIL: ${{ secrets.IMAP_EMAIL }}
IMAP_EMAIL_PASSWORD: ${{ secrets.IMAP_EMAIL_PASSWORD }}
IMAP_HOST: ${{ secrets.IMAP_HOST }}
REGISTRATIONS_USER: ${{ secrets.REGISTRATIONS_USER }}
REGISTRATIONS_USER_PASSWORD: ${{ secrets.REGISTRATIONS_USER_PASSWORD }}
jobs:
build:
runs-on: ubuntu-20.04
env:
GHA_DISTRO: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
matrix:
python-version: [3.9]
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Build Requirements
id: pip-cache-step
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.GHA_DISTRO }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
- name: install dependencies
if: steps.pip-cache-step.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
invoke requirements
# Need to set the Domain, Service, and Browser values in this job first so
# that when the workflow is run from the scheduler the correct default values
# will be used since the scheduler does not have inputs.
set_variables:
name: Set the Domain, Service, and Browser for Regression Tests
runs-on: ubuntu-20.04
outputs:
domain: ${{ github.event.inputs.domain || env.DEFAULT_DOMAIN }}
service: ${{ github.event.inputs.service || env.DEFAULT_SERVICE }}
browser: ${{ github.event.inputs.browser || env.DEFAULT_BROWSER }}
steps:
- run: echo "Set Domain, Service, and Browser Values"
# This job sets the browser(s) that will be used in the regression_test job below.
# When run from the scheduler all of the available browsers will be used, and when
# run manually from the Actions tab the user can select which browser to use.
set_matrix:
name: Set Matrix of Browser Values
needs: [set_variables]
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set_browser_2.outputs.matrix }}
steps:
- uses: haya14busa/action-cond@v1
id: set_browser_1
with:
cond: ${{ needs.set_variables.outputs.browser == 'All' }}
if_true: "${{ env.DEFAULT_MATRIX }}"
if_false: "['${{ github.event.inputs.browser }}']"
- id: set_browser_2
run: |
echo "matrix=${{ steps.set_browser_1.outputs.value }}" >> $GITHUB_OUTPUT
regression_test:
name: Regression tests (${{ matrix.browser }})
needs: [build, set_variables, set_matrix]
runs-on: ubuntu-20.04
env:
GHA_DISTRO: ubuntu-20.04
strategy:
fail-fast: false
max-parallel: 1 # run in series
matrix:
browser: ${{ fromJson(needs.set_matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.GHA_DISTRO }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
- if: ${{ needs.set_variables.outputs.service == 'All' }}
name: run all regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
DOMAIN: ${{ needs.set_variables.outputs.domain }}
run: |
invoke test_all_selenium_part_one
invoke test_all_selenium_part_two
- if: ${{ github.event.inputs.service == 'Preprints' }}
name: run preprints regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_preprints_regression
- if: ${{ github.event.inputs.service == 'Registries' }}
name: run registries regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_registries_regression
- if: ${{ github.event.inputs.service == 'Meetings' }}
name: run meetings regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_meetings_regression
- if: ${{ github.event.inputs.service == 'Institutions' }}
name: run institutions regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_institutions_regression
- if: ${{ github.event.inputs.service == 'Projects' }}
name: run projects regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_projects_regression
- if: ${{ github.event.inputs.service == 'Collections' }}
name: run collections regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_collections_regression
- if: ${{ github.event.inputs.service == 'Users' }}
name: run users regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_users_regression
- if: ${{ github.event.inputs.service == 'Other' }}
name: run other regression tests in ${{ env.DOMAIN }}
env:
TEST_BUILD: ${{ matrix.browser }}
run: |
invoke test_other_regression