Merge pull request #34 from gtt-project/feature/print-sync-download #33
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: Test with PostGIS | |
env: | |
PLUGIN_NAME: ${{ github.event.repository.name }} | |
on: | |
push: | |
branches: | |
# - main | |
- 1.1-stable | |
pull_request: | |
branches: | |
# - main | |
- 1.1-stable | |
jobs: | |
test: | |
name: redmine:${{ matrix.redmine_version }} ruby:${{ matrix.ruby_version }} postgis:${{ matrix.db_version }} | |
runs-on: ubuntu-22.04 | |
# container: | |
# image: ruby:${{ matrix.ruby_version }}-bullseye | |
strategy: | |
fail-fast: false | |
matrix: | |
redmine_version: [4.2-stable] | |
gtt_version: [2.1-stable] | |
ruby_version: ['2.7'] | |
db_version: [11-2.5, 15-3.3] | |
services: | |
postgres: | |
image: postgis/postgis:${{ matrix.db_version }} | |
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 GTT Plugin | |
uses: actions/checkout@v4 | |
with: | |
repository: gtt-project/redmine_gtt | |
ref: ${{ matrix.gtt_version }} | |
path: redmine/plugins/redmine_gtt | |
- name: Checkout Plugin | |
uses: actions/checkout@v4 | |
with: | |
path: redmine/plugins/${{ env.PLUGIN_NAME }} | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
# bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Update package archives | |
run: sudo apt-get update --yes --quiet | |
- name: Install package dependencies | |
run: | | |
sudo apt-get install --yes --quiet \ | |
postgresql-client \ | |
gcc libpq-dev make patch libgeos-dev curl | |
# - name: Install Node/Yarn packages | |
# run: | | |
# curl -sL https://deb.nodesource.com/setup_20.x | bash - | |
# curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | |
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | |
# sudo apt-get update --yes --quiet | |
# sudo apt-get install --yes --quiet --no-install-recommends nodejs yarn | |
- name: Start MapFish Print | |
working-directory: redmine/plugins/redmine_gtt_print/server-example | |
run: docker compose up -d | |
# - name: Prepare Plugin | |
# working-directory: redmine/plugins/redmine_gtt | |
# run: | | |
# yarn | |
# npx webpack | |
- name: Prepare Redmine source | |
working-directory: redmine | |
run: | | |
cat <<EOF > config/database.yml | |
test: | |
adapter: postgis | |
database: redmine | |
host: localhost | |
username: postgres | |
password: postgres | |
encoding: utf8 | |
EOF | |
- name: Adjust Gem environment | |
run: | | |
case "${{ matrix.redmine_version }}" in | |
4.2-stable) | |
echo "GEM_RGEO_ACTIVERECORD_VERSION=6.2.2" >> ${GITHUB_ENV} | |
echo "GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION=5.2.3" >> ${GITHUB_ENV} | |
;; | |
# master) | |
# echo "GEM_PG_VERSION=1.4.5" >> ${GITHUB_ENV} | |
# ;; | |
esac | |
shell: bash | |
- name: Adjust Gemfile | |
working-directory: redmine | |
run: | | |
# Ref: https://github.com/agileware-jp/redmine-plugin-orb/pull/70 | |
# https://www.redmine.org/issues/40802 | |
if grep -q "require 'blankslate'" lib/redmine/views/builders/structure.rb | |
then | |
echo 'gem "blankslate"' >> Gemfile | |
fi | |
shell: bash | |
- name: Install Ruby dependencies | |
working-directory: redmine | |
run: | | |
bundle config set --local without 'development' | |
bundle install --jobs=4 --retry=3 | |
- name: Set up environment | |
run: | | |
echo "RAILS_ENV=test" >> $GITHUB_ENV | |
- name: Run Redmine rake tasks | |
working-directory: redmine | |
run: | | |
bundle exec rake generate_secret_token | |
bundle exec rake db:create db:migrate redmine:plugins:migrate | |
- name: Zeitwerk check | |
working-directory: redmine | |
run: | | |
if grep -q zeitwerk config/application.rb ; then | |
bundle exec rake zeitwerk:check | |
fi | |
shell: bash | |
- name: Run tests | |
working-directory: redmine | |
run: bundle exec rake redmine:plugins:test NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" | |
- name: Run uninstall test | |
working-directory: redmine | |
run: bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0 | |
- name: Stop MapFish Print | |
working-directory: redmine/plugins/redmine_gtt_print/server-example | |
run: docker compose down |