Skip to content

Merge pull request #40 from gtt-project/fix/replace-removed-jquery-api #22

Merge pull request #40 from gtt-project/fix/replace-removed-jquery-api

Merge pull request #40 from gtt-project/fix/replace-removed-jquery-api #22

Workflow file for this run

name: Test
env:
PLUGIN_NAME: ${{ github.event.repository.name }}
on:
push:
branches:
- main
- next
pull_request:
branches:
- main
- next
jobs:
test:
name: redmine:${{ matrix.redmine_version }} ruby:${{ matrix.ruby_version }} db:${{ matrix.db }}
runs-on: ubuntu-22.04
container:
image: ruby:${{ matrix.ruby_version }}-bullseye
strategy:
fail-fast: false
matrix:
redmine_version: [4.2-stable, 5.0-stable, 5.1-stable, master]
ruby_version: ['2.7', '3.0', '3.1', '3.2']
db: [mysql, postgres, sqlite]
# # System test takes 2~3 times longer, so limit to specific matrix combinations
# # See: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
# include:
# - system_test: true
# redmine_version: master
# ruby_version: '3.1'
# db: mysql
exclude:
- redmine_version: 4.2-stable
ruby_version: '3.0'
- redmine_version: 4.2-stable
ruby_version: '3.1'
- redmine_version: 4.2-stable
ruby_version: '3.2'
- redmine_version: 5.0-stable
ruby_version: '3.2'
- redmine_version: master
ruby_version: '2.7'
services:
mysql:
image: mysql:5.7 # min
# image: mysql:8.0 # latest
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5
postgres:
image: postgres:10 # min
# image: postgres:15 # latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout Redmine
uses: actions/checkout@v4
with:
repository: redmine/redmine
ref: ${{ matrix.redmine_version }}
path: redmine
- name: Checkout Plugin
uses: actions/checkout@v4
with:
path: redmine/plugins/${{ env.PLUGIN_NAME }}
- name: Update package archives
run: apt-get update --yes --quiet
- name: Install package dependencies
run: |
if [ ${{ matrix.db }} = "mysql" ]; then
apt-get install --yes --quiet default-mysql-client-core
fi
if [ ${{ matrix.db }} = "postgres" ]; then
apt-get install --yes --quiet postgresql-client
fi
# For system test
if [ ${{ matrix.system_test }} = "true" ]; then
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get -y update
apt-get install -y google-chrome-stable
fi
- name: Verify MySQL connection from host
if: matrix.db == 'mysql'
run: |
mysql --host mysql --port 3306 -uroot -ppassword -e "SHOW DATABASES"
- name: Prepare Redmine source
working-directory: redmine
run: |
if [ ${{ matrix.db }} = "mysql" ]; then
cat <<EOF > config/database.yml
test:
adapter: mysql2
database: redmine
host: mysql
username: root
password: password
encoding: utf8mb4
EOF
fi
if [ ${{ matrix.db }} = "postgres" ]; then
cat <<EOF > config/database.yml
test:
adapter: postgresql
database: redmine
host: postgres
username: postgres
password: postgres
encoding: utf8
EOF
fi
if [ ${{ matrix.db }} = "sqlite" ]; then
cat <<EOF > config/database.yml
test:
adapter: sqlite3
database: db/redmine.sqlite3
EOF
fi
- name: Install Ruby dependencies
working-directory: redmine
run: |
bundle config set --local without 'development'
bundle install --jobs=4 --retry=3
- name: Run Redmine rake tasks
env:
RAILS_ENV: test
working-directory: redmine
run: |
bundle exec rake generate_secret_token
bundle exec rake db:create db:migrate redmine:plugins:migrate
- name: Zeitwerk check
env:
RAILS_ENV: test
working-directory: redmine
run: |
if grep -q zeitwerk config/application.rb ; then
bundle exec rake zeitwerk:check
fi
shell: bash
- name: Run plugin tests
env:
RAILS_ENV: test
# For system test in plugin
GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
working-directory: redmine
run: bundle exec rake redmine:plugins:test NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
# - name: Run core tests
# env:
# RAILS_ENV: test
# PARALLEL_WORKERS: 1
# working-directory: redmine
# run: bundle exec rake test
# - name: Run core system tests
# if: matrix.system_test == true
# env:
# RAILS_ENV: test
# GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
# working-directory: redmine
# run: bundle exec rake test:system
- name: Run uninstall test
env:
RAILS_ENV: test
working-directory: redmine
run: bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0