From 5b83c511c4abf44a1a4f3239e197dd64ea209e60 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Sun, 5 Jan 2025 15:39:20 +0200 Subject: [PATCH] Start using Node.js v22 inside container upgrade from v16 Note: fixes indentation in YAML files --- .github/workflows/coverity_scan.yml | 5 ++ .github/workflows/lint.yml | 6 ++ .github/workflows/sanity.yml | 73 ++++++++++++++---------- .github/workflows/security.yml | 6 ++ .github/workflows/testing.yml | 88 +++++++++++++++++++---------- Dockerfile.buildroot | 3 +- 6 files changed, 120 insertions(+), 61 deletions(-) diff --git a/.github/workflows/coverity_scan.yml b/.github/workflows/coverity_scan.yml index c608314f24..58f1b66952 100644 --- a/.github/workflows/coverity_scan.yml +++ b/.github/workflows/coverity_scan.yml @@ -21,6 +21,11 @@ jobs: with: python-version: 3.11 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Install depenencies run: | sudo apt-get update diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 934dbfaa6e..091de5b5ff 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -140,6 +140,12 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Run eslint run: | cd tcms/ diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 61122bc1fa..db355056fc 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -33,18 +33,25 @@ jobs: python-version: [3.11] steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: test-for-missing-migrations - run: | - pip install -r requirements/devel.txt - pushd tcms/ && ./npm-install && popd + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 - export LANG=en-us - make test_for_missing_migrations + - name: test-for-missing-migrations + run: | + pip install -r requirements/devel.txt + pushd tcms/ && ./npm-install && popd + + export LANG=en-us + make test_for_missing_migrations test-migrations-rollback: runs-on: ubuntu-latest @@ -53,24 +60,30 @@ jobs: python-version: [3.11] steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v4 - - name: Create database - run: | - docker compose -f docker-compose.postgres pull db - docker compose -f docker-compose.postgres run -d -p 5432:5432 --name kiwi_db db + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: migrations rollback - run: | - pip install -r requirements/devel.txt - pip install -r requirements/postgres.txt - pushd tcms/ && ./npm-install && popd - - export LANG=en-us - # Postgres b/c it has best support for schema altering operations - export DJANGO_SETTINGS_MODULE=tcms.settings.test.postgresql - ./tests/migrations-rollback + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Create database + run: | + docker compose -f docker-compose.postgres pull db + docker compose -f docker-compose.postgres run -d -p 5432:5432 --name kiwi_db db + + - name: migrations rollback + run: | + pip install -r requirements/devel.txt + pip install -r requirements/postgres.txt + pushd tcms/ && ./npm-install && popd + + export LANG=en-us + # Postgres b/c it has best support for schema altering operations + export DJANGO_SETTINGS_MODULE=tcms.settings.test.postgresql + ./tests/migrations-rollback diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 0db244816e..ddf37ecf29 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -71,6 +71,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: npm audit run: | pushd tcms/ diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index fcc32af2ff..73cbc6684b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -18,11 +18,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Configure ~/.tcms.conf for ${{ matrix.kiwitcms-url }} run: | echo "[tcms]" > ~/.tcms.conf @@ -79,36 +85,41 @@ jobs: python-version: [3.11] steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Python dependencies - run: | - sudo apt-get update - sudo apt-get install gettext - pip install -r requirements/devel.txt - pushd tcms/ && npm install --dev && ./node_modules/.bin/webpack && popd - pushd tcms/ && ./npm-install && popd - - - name: Run test - run: | - export LANG=en-us - export TEST_DASHBOARD_CHECK_UNAPPLIED_MIGRATIONS=1 - coverage run --source='.' ./manage.py test -v2 --noinput --settings=tcms.settings.test tcms.core.tests.test_views.TestDashboardCheckMigrations - coverage report -m - - - name: Send coverage to codecov.io - if: env.CODECOV_TOKEN - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - fail_ci_if_error: false - verbose: true + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install Python dependencies + run: | + sudo apt-get update + sudo apt-get install gettext + pip install -r requirements/devel.txt + pushd tcms/ && npm install --dev && ./node_modules/.bin/webpack && popd + pushd tcms/ && ./npm-install && popd + + - name: Run test + run: | + export LANG=en-us + export TEST_DASHBOARD_CHECK_UNAPPLIED_MIGRATIONS=1 + coverage run --source='.' ./manage.py test -v2 --noinput --settings=tcms.settings.test tcms.core.tests.test_views.TestDashboardCheckMigrations + coverage report -m + + - name: Send coverage to codecov.io + if: env.CODECOV_TOKEN + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + fail_ci_if_error: false + verbose: true without_internal_bugtracker: name: without internal bugtracker @@ -124,6 +135,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Execute tests run: | sudo apt-get update @@ -159,11 +175,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Create database run: | docker compose pull db @@ -207,11 +229,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Create database run: | docker compose -f docker-compose.postgres pull db diff --git a/Dockerfile.buildroot b/Dockerfile.buildroot index cedc3e863b..163f6f969e 100644 --- a/Dockerfile.buildroot +++ b/Dockerfile.buildroot @@ -3,7 +3,8 @@ # checkov:skip=CKV_DOCKER_7:Ensure the base image uses a non latest version tag FROM registry.access.redhat.com/ubi9-minimal -RUN microdnf -y --nodocs install python3.11-devel mariadb-connector-c-devel tar gzip make \ +RUN microdnf -y module enable nodejs:22 && \ + microdnf -y --nodocs install python3.11-devel mariadb-connector-c-devel tar gzip make \ postgresql-devel libffi-devel gcc gettext npm unzip which rust cargo findutils \ libjpeg-turbo-devel && \ microdnf -y --nodocs update && \