[DevDependency] Bump eslint from 8.41.0 to 8.54.0 in /site #2142
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: Submitty CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
env: | |
PGPASSWORD: submitty_dbuser | |
PHP_USER: submitty_php | |
PHP_GROUP: submitty_php | |
CGI_USER: submitty_cgi | |
SUBMITTY_DATA_DIR: /var/local/submitty | |
SUBMITTY_INSTALL_DIR: /usr/local/submitty | |
SUBMITTY_REPOSITORY: /usr/local/submitty/GIT_CHECKOUT/Submitty | |
POSTGRES_HOST: localhost | |
PHP_VER: 8.1 | |
NODE_VERSION: 20 | |
PYTHON_VERSION: "3.10" | |
concurrency: | |
# If this is a PR, cancel all previously running jobs on source branch | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
css-lint: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: site | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-cache-node-modules- | |
- run: npm install | |
- name: Run stylelint | |
run: npm run css-stylelint | |
js-lint: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: site | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-cache-node-modules- | |
- run: npm install | |
- name: Run eslint | |
run: npm run eslint | |
- name: Run npm build (tsc and esbuild) | |
run: npm run build | |
js-unit: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: site | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-cache-node-modules- | |
- run: npm install | |
- run: npm run test | |
- name: Upload Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: site/tests/report/jest/clover.xml | |
flags: js | |
php-lint: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: site | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: shivammathur/[email protected] | |
with: | |
php-version: ${{ env.PHP_VER }} | |
- name: Cache Composer | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Install Composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --prefer-dist --dev | |
- name: Check syntax | |
run: find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l | |
- name: Lint PHP code | |
run: | | |
php vendor/bin/phpcs --version | |
php vendor/bin/phpcs | |
- name: Static analysis | |
run: | | |
php vendor/bin/phpstan --version | |
php vendor/bin/phpstan analyze app public/index.php socket/index.php | |
php-unit: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: site | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: shivammathur/[email protected] | |
with: | |
php-version: ${{ env.PHP_VER }} | |
extensions: imagick | |
coverage: pcov | |
- name: Cache Composer | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Install Composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --prefer-dist --dev | |
- name: Run php unit tests | |
run: php vendor/bin/phpunit | |
- name: Upload Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: site/tests/report/clover.xml | |
flags: php | |
python-lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ github.job }}-pip-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-pip- | |
- name: Install python libraries | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install flake8 flake8-bugbear | |
- name: Run python linting | |
run: python3 -m flake8 | |
python-unit: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ github.job }}-pip-${{ hashFiles('**/system_requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-pip- | |
- name: Install python libraries | |
run: | | |
python3 -m pip install -r .setup/pip/system_requirements.txt | |
python3 -m pip install coverage # Testing util. | |
# Submitty utils install & unit testing, must be put before auto grader | |
# testing as auto grader depends on submitty utils to function. | |
- name: Run python_submitty_utils python unit tests | |
working-directory: python_submitty_utils | |
run: | | |
pip3 install . | |
coverage run -m unittest discover | |
coverage xml | |
- name: Upload submitty python utils Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: python_submitty_utils/coverage.xml | |
flags: python_submitty_utils | |
# Migrator unit test | |
- name: Run migrator python unit tests | |
working-directory: migration | |
run: | | |
coverage run -m unittest discover | |
coverage xml | |
- name: Upload migrator Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: migration/coverage.xml | |
flags: migrator | |
# Auto grader unit test | |
- name: Run autograder python unit tests | |
working-directory: autograder | |
run: | | |
coverage run -m unittest discover | |
coverage xml | |
- name: Upload autograder Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: autograder/coverage.xml | |
flags: autograder | |
# submitty_daemon_jobs unit tests | |
- name: Install bulk upload dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y poppler-utils | |
sudo apt-get install -y libzbar0 | |
- name: Run bulk upload unit tests | |
working-directory: sbin/submitty_daemon_jobs | |
run: | | |
coverage run -m unittest discover tests -t . | |
coverage xml -i | |
- name: Upload submitty_daemon_jobs Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: sbin/submitty_daemon_jobs/coverage.xml | |
flags: submitty_daemon_jobs | |
yaml-lint: | |
name: yaml-lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install yamllint | |
run: sudo apt-get install -y yamllint | |
- name: Run yamllint | |
run: yamllint . | |
shellcheck: | |
name: ShellCheck | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install ShellCheck | |
run: sudo apt-get install -y shellcheck | |
- name: Run ShellCheck | |
run: python3 run_shellcheck.py # Uses the default Python installed with Ubuntu | |
Cypress-System: | |
runs-on: ubuntu-22.04 | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: submitty_dbuser | |
POSTGRES_USER: postgres | |
TZ: America/New_York | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: ./.github/actions/e2e-Setup-Composite | |
# TODO: Remove this block after upgrading jsPDF | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-cache-node-modules-dev-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-cache-node-modules-dev | |
- name: Install node dependencies | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
run: | | |
npm install file-saver --save | |
npm install --production=false | |
- name: Run accessibility test | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost | |
spec: cypress/e2e/cypress-system/accessibility.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
- name: Run API tests | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
run: npm run test:api | |
env: | |
BASE_URL: http://localhost | |
- name: Stop autograding services | |
run: | | |
sudo systemctl stop submitty_autograding_worker | |
sudo systemctl stop submitty_autograding_shipper | |
- name: Run autograding status test | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost | |
spec: cypress/e2e/cypress-system/autograding_status_1.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
env: autograding_shipper_off=True | |
- name: Restart autograding shipper | |
run: | | |
sudo systemctl restart submitty_autograding_shipper | |
- name: Run autograding status test | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost | |
spec: cypress/e2e/cypress-system/autograding_status_2.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
env: autograding_shipper_off=True | |
- name: Restart autograding worker | |
run: | | |
sudo systemctl restart submitty_autograding_worker | |
- name: Run cypress e2e login tests with PAM auth | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost,chromeWebSecurity=false | |
spec: cypress/e2e/cypress-system/login.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
- name: Switch to database auth | |
run: sudo sed -ie "s/Pam/Database/g" ${SUBMITTY_INSTALL_DIR}/config/authentication.json | |
- name: Run cypress e2e login tests with database auth | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost | |
spec: cypress/e2e/cypress-system/login.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
- name: Switch to LDAP auth | |
run: sudo sed -ie "s/Database/Ldap/g" ${SUBMITTY_INSTALL_DIR}/config/authentication.json | |
- name: Run cypress e2e login tests with LDAP auth | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost | |
spec: cypress/e2e/cypress-system/login.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
- name: Setup SAML | |
run: | | |
cd $SUBMITTY_REPOSITORY | |
sudo -E env "PATH=$PATH" bash .setup/testing/setup_saml.sh | |
- name: Switch to SAML auth | |
run: sudo sed -ie "s/Ldap/Saml/g" ${SUBMITTY_INSTALL_DIR}/config/authentication.json | |
- name: Run cypress e2e login tests with SAML auth | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost,chromeWebSecurity=false | |
spec: cypress/e2e/cypress-system/login.spec.js | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
browser: chrome | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ${{env.SUBMITTY_REPOSITORY}}/site/cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-videos | |
path: ${{env.SUBMITTY_REPOSITORY}}/site/cypress/videos | |
- name: Check for site errors | |
working-directory: ${{ env.SUBMITTY_REPOSITORY }} | |
run: sudo bash tests/test_site_error_log.sh | |
Cypress: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: ["Gradeable", "Admin", "UI", "Feature"] | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: submitty_dbuser | |
POSTGRES_USER: postgres | |
TZ: America/New_York | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: ./.github/actions/e2e-Setup-Composite | |
# TODO: Remove this block after upgrading jsPDF | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-cache-node-modules-dev-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-cache-node-modules-dev | |
- name: Install node dependencies | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
run: | | |
npm install file-saver --save | |
npm install --production=false | |
- name: Run cypress e2e tests with pam auth | |
uses: cypress-io/github-action@v6 | |
with: | |
config: baseUrl=http://localhost | |
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site | |
spec: cypress/e2e/Cypress-${{matrix.containers}}/* | |
browser: chrome | |
env: run_area=CI | |
- name: Check for site errors | |
working-directory: ${{ env.SUBMITTY_REPOSITORY }} | |
run: sudo bash tests/test_site_error_log.sh | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ${{env.SUBMITTY_REPOSITORY}}/site/cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-videos | |
path: ${{env.SUBMITTY_REPOSITORY}}/site/cypress/videos | |
Integration: | |
runs-on: ubuntu-22.04 | |
# Postgres should not be needed for the integration tests. | |
# But unfortunately Configure test suite seems to use it at the moment, and | |
# Configure test suite seems to be necessary for the Integration tests | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: submitty_dbuser | |
POSTGRES_USER: postgres | |
TZ: America/New_York | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: ./.github/actions/e2e-Setup-Composite | |
- name: Run integration tests | |
run: sudo -E env "PATH=$PATH" python3 /usr/local/submitty/test_suite/integrationTests/run.py |