Update README and init.rb: specify licenses and bump Redmine version … #64
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: Redmine Plugin | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
mat_env: | |
- '3.3 redmica/redmica@v3.1.0' | |
- '3.3 redmica/redmica@v3.0.4' | |
- '3.2 redmica/redmica@v2.4.2' | |
- '3.2 redmica/redmica@v2.3.2' | |
- '3.1 redmica/redmica@v2.2.3' | |
- '3.0 redmica/redmica@v2.2.3' | |
- '2.7 redmica/redmica@v2.2.3' | |
- '3.3 redmine/redmine@6.0.1' | |
- '3.2 redmine/redmine@5.1.4' | |
- '3.1 redmine/redmine@5.0.10' | |
- '3.0 redmine/redmine@5.0.10' | |
- '2.7 redmine/redmine@4.2.11' | |
- '2.6 redmine/redmine@4.2.11' | |
experimental: [false] | |
include: | |
- mat_env: '3.3 redmica/redmica@master' | |
experimental: true | |
steps: | |
- run: | | |
echo PLUGIN_NAME=$PLUGIN_NAME >> $GITHUB_ENV | |
echo RUBY_VERSION=$(echo $MAT_ENV | cut -d' ' -f1) >> $GITHUB_ENV | |
echo REDMINE_REPOSITORY=$(echo $MAT_ENV | cut -d' ' -f2 | cut -d@ -f1) >> $GITHUB_ENV | |
echo REDMINE_REF=$(echo $MAT_ENV | cut -d' ' -f2 | cut -d@ -f2) >> $GITHUB_ENV | |
env: | |
PLUGIN_NAME: redmine_scheduling_poll | |
MAT_ENV: ${{ matrix.mat_env }} | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ./${{ env.PLUGIN_NAME }} | |
- name: Set up Redmine | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.REDMINE_REPOSITORY }} | |
ref: ${{ env.REDMINE_REF }} | |
path: ./redmine | |
- name: Copy the plugin files to plugin directory | |
run: cp -pr ./${{ env.PLUGIN_NAME }} ./redmine/plugins/${{ env.PLUGIN_NAME }} | |
- name: Create redmine/config/database.yml | |
uses: DamianReeves/write-file-action@v1.3 | |
with: | |
path: ./redmine/config/database.yml | |
contents: | | |
test: | |
adapter: sqlite3 | |
database: db/redmine_test.db | |
- uses: actions/cache@v4 | |
with: | |
path: ./redmine/vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('./redmine/**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: "'LoadError: cannot load such file -- blankslate' Issue HACK ref. https://www.redmine.org/issues/40802#note-11" | |
uses: DamianReeves/write-file-action@v1.3 | |
with: | |
path: ./redmine/Gemfile.local | |
contents: | | |
gem 'builder', '~> 3.2.4' | |
if: contains(fromJSON('["3.2 redmica/redmica@v2.4.2", "3.2 redmica/redmica@v2.3.2", "3.1 redmica/redmica@v2.2.3", "3.0 redmica/redmica@v2.2.3", "2.7 redmica/redmica@v2.2.3", "2.6 redmine/redmine@4.1.7", "2.6 redmine/redmine@4.0.9", "2.5 redmine/redmine@4.0.9", "2.6 redmine/redmine@4.2.11", "2.7 redmine/redmine@4.2.11"]'), matrix.mat_env) | |
- name: Before script | |
run: | | |
bundle config --local path ${BUNDLE_PATH:-vendor/bundle} | |
bundle install | |
mv plugins plugins_bak | |
# Initialize redmine | |
bundle exec rake generate_secret_token | |
bundle exec rake db:migrate | |
bundle exec rake redmine:load_default_data | |
mv plugins_bak plugins | |
# Execute plugin's migration | |
bundle exec rake redmine:plugins NAME=${{ env.PLUGIN_NAME }} | |
working-directory: ./redmine | |
env: | |
REDMINE_LANG: en | |
RAILS_ENV: test | |
- name: Zeitwerk check | |
run: | | |
if system("grep zeitwerk config/application.rb > /dev/null") | |
exec("bundle exec rake zeitwerk:check") | |
end | |
shell: ruby {0} | |
working-directory: ./redmine | |
env: | |
REDMINE_LANG: en | |
RAILS_ENV: test | |
# HACK sometimes fails login error, so retry 10 times | |
- name: Execute test | |
run: | | |
#!/bin/sh | |
for i in `seq 0 9`; do | |
# Execute plugin's test | |
bundle exec rake redmine:plugins:test NAME=${{ env.PLUGIN_NAME }} | |
retval=$? | |
if [ "$retval" -eq 0 ]; then | |
break | |
fi | |
echo "${i}-th test failed; Retry test..." | |
done | |
exit $retval | |
shell: bash {0} | |
working-directory: ./redmine | |
env: | |
REDMINE_LANG: en | |
RAILS_ENV: test |