|
| 1 | +name: Tests 6.0.7 |
| 2 | + |
| 3 | +env: |
| 4 | + PLUGIN_NAME: redmine_drafts |
| 5 | + REDMINE_VERSION: 6.0.7 |
| 6 | + RAILS_ENV: test |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + pull_request: |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + name: ${{ github.workflow }} ${{ matrix.db }} ruby-${{ matrix.ruby }} |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + ruby: ['3.3'] |
| 20 | + db: ['postgres'] |
| 21 | + fail-fast: false |
| 22 | + |
| 23 | + services: |
| 24 | + postgres: |
| 25 | + image: postgres:13 |
| 26 | + env: |
| 27 | + POSTGRES_DB: redmine |
| 28 | + POSTGRES_USER: postgres |
| 29 | + POSTGRES_PASSWORD: postgres |
| 30 | + ports: |
| 31 | + - 5432:5432 |
| 32 | + options: >- |
| 33 | + --health-cmd pg_isready |
| 34 | + --health-interval 10s |
| 35 | + --health-timeout 5s |
| 36 | + --health-retries 5 |
| 37 | +
|
| 38 | + steps: |
| 39 | + - name: Checkout Redmine |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + repository: redmine/redmine |
| 43 | + ref: ${{ env.REDMINE_VERSION }} |
| 44 | + path: redmine |
| 45 | + |
| 46 | + - name: Update package archives |
| 47 | + run: sudo apt-get update --yes --quiet |
| 48 | + |
| 49 | + - name: Install package dependencies |
| 50 | + run: > |
| 51 | + sudo apt-get update && sudo apt-get install --yes --quiet |
| 52 | + build-essential |
| 53 | + cmake |
| 54 | + libicu-dev |
| 55 | + libpq-dev |
| 56 | + ghostscript |
| 57 | + gsfonts |
| 58 | +
|
| 59 | + - name: Set up chromedriver |
| 60 | + uses: nanasess/setup-chromedriver@master |
| 61 | + - run: | |
| 62 | + export DISPLAY=:99 |
| 63 | + chromedriver --url-base=/wd/hub & |
| 64 | + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional |
| 65 | +
|
| 66 | + - name: Allow imagemagick to read PDF files |
| 67 | + run: | |
| 68 | + echo '<policymap>' > policy.xml |
| 69 | + echo '<policy domain="coder" rights="read | write" pattern="PDF" />' >> policy.xml |
| 70 | + echo '</policymap>' >> policy.xml |
| 71 | + sudo rm /etc/ImageMagick-6/policy.xml |
| 72 | + sudo mv policy.xml /etc/ImageMagick-6/policy.xml |
| 73 | +
|
| 74 | + - name: Setup Ruby |
| 75 | + uses: ruby/setup-ruby@v1 |
| 76 | + with: |
| 77 | + ruby-version: ${{ matrix.ruby }} |
| 78 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 79 | + |
| 80 | + - name: Setup Bundler |
| 81 | + run: gem install bundler -v '~> 1.0' |
| 82 | + |
| 83 | + - name: Checkout dependencies - Base RSpec plugin |
| 84 | + uses: actions/checkout@v4 |
| 85 | + with: |
| 86 | + repository: jbbarth/redmine_base_rspec |
| 87 | + path: redmine/plugins/redmine_base_rspec |
| 88 | + |
| 89 | + - name: Prepare Redmine source |
| 90 | + working-directory: redmine |
| 91 | + run: | |
| 92 | + rm -f test/integration/routing/plugins_test.rb # Fix routing tests # TODO Remove this line when https://www.redmine.org/issues/38707 is fixed |
| 93 | + sed -i '/rubocop/d' Gemfile |
| 94 | + rm -f .rubocop* |
| 95 | + cp plugins/redmine_base_rspec/spec/support/database-${{ matrix.db }}.yml config/database.yml |
| 96 | +
|
| 97 | + - name: Install Ruby dependencies |
| 98 | + working-directory: redmine |
| 99 | + run: | |
| 100 | + bundle install --jobs=4 --retry=3 --without development |
| 101 | +
|
| 102 | + - name: Generate session store secret |
| 103 | + env: |
| 104 | + RAILS_ENV: test |
| 105 | + working-directory: redmine |
| 106 | + run: | |
| 107 | + bundle exec rake generate_secret_token |
| 108 | +
|
| 109 | + - name: Run Redmine DB and migration tasks |
| 110 | + env: |
| 111 | + RAILS_ENV: test |
| 112 | + working-directory: redmine |
| 113 | + run: | |
| 114 | + bundle exec rake db:create db:migrate |
| 115 | + bundle exec rails test:scm:setup:subversion |
| 116 | +
|
| 117 | + - name: Checkout dependencies - Base Deface plugin |
| 118 | + uses: actions/checkout@v4 |
| 119 | + with: |
| 120 | + repository: jbbarth/redmine_base_deface |
| 121 | + path: redmine/plugins/redmine_base_deface |
| 122 | + |
| 123 | + - name: Checkout dependencies - Base StimulusJS plugin |
| 124 | + uses: actions/checkout@v4 |
| 125 | + with: |
| 126 | + repository: nanego/redmine_base_stimulusjs |
| 127 | + path: redmine/plugins/redmine_base_stimulusjs |
| 128 | + |
| 129 | + - name: Checkout plugin |
| 130 | + uses: actions/checkout@v4 |
| 131 | + with: |
| 132 | + path: redmine/plugins/${{ env.PLUGIN_NAME }} |
| 133 | + |
| 134 | + - name: Install plugins dependencies and run plugins migrations |
| 135 | + env: |
| 136 | + RAILS_ENV: test |
| 137 | + working-directory: redmine |
| 138 | + run: | |
| 139 | + bundle install --jobs=4 --retry=3 --without development |
| 140 | + bundle exec rake redmine:plugins:migrate |
| 141 | + cp -i plugins/*/spec/fixtures/*yml test/fixtures/ |
| 142 | + bundle exec rails db:fixtures:load |
| 143 | +
|
| 144 | + - name: Run core tests |
| 145 | + env: |
| 146 | + RAILS_ENV: test |
| 147 | + working-directory: redmine |
| 148 | + run: bundle exec rails test |
| 149 | + |
| 150 | + - name: Run plugin tests |
| 151 | + env: |
| 152 | + RAILS_ENV: test |
| 153 | + working-directory: redmine |
| 154 | + run: bundle exec rails redmine:plugins:test NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" |
| 155 | + |
| 156 | + - name: Run uninstall test |
| 157 | + env: |
| 158 | + RAILS_ENV: test |
| 159 | + working-directory: redmine |
| 160 | + run: bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0 |
0 commit comments