Merged r23792 and r23793 from trunk to 5.1-stable (#42688).

git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@23795 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2025-05-24 21:22:04 +00:00
parent 02ca3d86f2
commit fc0a1b7ff2
2 changed files with 90 additions and 51 deletions

View File

@@ -0,0 +1,68 @@
name: Setup Redmine Test Environment
description: Composite action for setting up Redmine test environment
inputs:
db-type:
description: 'Database type: postgresql, mysql2, or sqlite3. Note: postgresql and mysql2 require service containers to be defined in the workflow.'
required: true
ruby-version:
description: 'Ruby version to use'
required: true
runs:
using: composite
steps:
- name: Install dependencies and configure environment
shell: bash
run: |
sudo apt-get update
sudo apt-get install --yes --quiet ghostscript gsfonts locales bzr cvs
sudo locale-gen en_US # for bazaar non ascii test
- name: Allow imagemagick to read PDF files
shell: bash
run: |
echo '<policymap>' > policy.xml
echo '<policy domain="coder" rights="read | write" pattern="PDF" />' >> policy.xml
echo '</policymap>' >> policy.xml
sudo rm /etc/ImageMagick-6/policy.xml
sudo mv policy.xml /etc/ImageMagick-6/policy.xml
- if: ${{ inputs.db-type == 'sqlite3' }}
name: Prepare test database for sqlite3
shell: bash
run: |
cat > config/database.yml <<EOF
test:
adapter: sqlite3
database: db/test.sqlite3
EOF
- if: ${{ inputs.db-type == 'mysql2' || inputs.db-type == 'postgresql' }}
name: Prepare test database for mysql2 and postgresql
shell: bash
run: |
cat > config/database.yml <<EOF
test:
adapter: ${{ inputs.db-type }}
database: redmine_test
username: root
password: root
host: 127.0.0.1
EOF
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby-version }}
bundler-cache: true
- name: Run prepare test environment
shell: bash
env:
RAILS_ENV: test
SCMS: subversion,git,git_utf8,filesystem,bazaar,cvs
run: |
bundle exec rake ci:about
bundle exec rake ci:setup
bundle exec rake db:environment:set

View File

@@ -46,55 +46,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies and configure environment
run: |
sudo apt-get update
sudo apt-get install --yes --quiet ghostscript gsfonts locales bzr cvs
sudo locale-gen en_US # for bazaar non ascii test
- name: Allow imagemagick to read PDF files
run: |
echo '<policymap>' > policy.xml
echo '<policy domain="coder" rights="read | write" pattern="PDF" />' >> policy.xml
echo '</policymap>' >> policy.xml
sudo rm /etc/ImageMagick-6/policy.xml
sudo mv policy.xml /etc/ImageMagick-6/policy.xml
- if: ${{ matrix.db == 'sqlite3' }}
name: Prepare test database for sqlite3
run: |
cat > config/database.yml <<EOF
test:
adapter: sqlite3
database: db/test.sqlite3
EOF
- if: ${{ matrix.db == 'mysql2' || matrix.db == 'postgresql' }}
name: Prepare test database for mysql2 and postgresql
run: |
cat > config/database.yml <<EOF
test:
adapter: ${{ matrix.db }}
database: redmine_test
username: root
password: root
host: 127.0.0.1
EOF
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
- name: Setup Redmine test environment
uses: ./.github/actions/setup-redmine
with:
db-type: ${{ matrix.db }}
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run prepare test environment
env:
RAILS_ENV: test
SCMS: subversion,git,git_utf8,filesystem,bazaar,cvs
run: |
bundle exec rake ci:about
bundle exec rake ci:setup
bundle exec rake db:environment:set
- name: Run tests
run: |
@@ -107,12 +63,27 @@ jobs:
run: |
bin/rails test test/unit/repository_bazaar_test.rb
system-tests:
name: system test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Redmine test environment
uses: ./.github/actions/setup-redmine
with:
db-type: sqlite3
ruby-version: '3.4'
# System tests use Chrome and ChromeDriver installed on the GitHub Actions Ubuntu image.
# They are generally updated to the latest stable versions.
- name: Display Chrome version
run: google-chrome --version
- name: Run system tests
run: |
google-chrome --version
bin/rails test:system
run: bin/rails test:system
env:
GOOGLE_CHROME_OPTS_ARGS: headless,disable-gpu,no-sandbox,disable-dev-shm-usage
# System tests might still be a bit unstable, so for now, even if a system test fails,
@@ -123,6 +94,6 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: system-test-screenshots-ruby${{ matrix.ruby }}-${{ matrix.db }}
name: system-test-screenshots
path: tmp/screenshots
if-no-files-found: ignore