diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 37e05ae..e1ce158 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -17,22 +17,83 @@ runs: ref: master path: redmine-src - - run: | - docker volume create redmine-bundle-cache + - name: Set up redmined + run: | + chmod +x redmined + mkdir $HOME/.local/bin + cp redmined $HOME/.local/bin - cd redmine-src + echo "REDMINED_IMAGE=redmined:test" >> $GITHUB_ENV + echo 'REDMINED_CONTAINER_ENVS="CUSTOM_ENV1=1 CUSTOM_ENV2=2"' >> $GITHUB_ENV + echo "REDMINED_REDMINE_PORT=3001" >> $GITHUB_ENV + shell: bash + - name: Set up Redmine + run: | cat < config/database.yml development: adapter: sqlite3 database: db/development.sqlite3 + test: + adapter: sqlite3 + database: db/development.sqlite3 EOS - docker run --rm \ - -v ${PWD}:/redmine \ - -v redmine-bundle-cache:/bundle \ - -u root:root --entrypoint "" \ - redmined:test \ - bash -c "bundle install && bin/rails db:prepare && RAILS_ENV=development bin/about" - shell: bash + # This is a workaround for the issue that the Gemfile.lock is not writable + # chmod a+w -R log tmp files db + # touch Gemfile.lock && chmod a+w Gemfile.lock + # touch tmp/local_secret.txt && chmod a+w -R tmp/local_secret.txt + # touch db/development.sqlite3 && chmod a+w db/development.sqlite3 + chmod a+w -R . + + redmined bundle install + redmined bin/rails db:prepare + shell: script -q -e -c "bash {0}" + working-directory: redmine-src + + - name: Test + run: | + docker volume ls + + redmined cat /etc/os-release + redmined env RAILS_ENV=development bin/about + + redmined printenv | grep CUSTOM_ENV1=1 + redmined printenv | grep CUSTOM_ENV2=2 + redmined printenv | grep PORT=3001 + + redmined bin/rails test test/unit/news_test.rb + redmined bin/rails test test/system/my_page_test.rb + shell: script -q -e -c "bash {0}" + working-directory: redmine-src + + - name: Test the indivisual settings + run: | + cat < .redmined.json + { + "default": { + "name": "default", + "port": 4000, + "env": { + "DEFAULT_ENV": "1" + } + }, + "other1": { + "name": "other1", + "port": 4001, + "env": { + "OTHER1_ENV": "1" + } + } + } + EOS + + # Test against default + redmined printenv | grep DEFAULT_ENV=1 + redmined printenv | grep PORT=4000 + # Test against other1 + redmined -n other1 printenv | grep OTHER1_ENV=1 + redmined -n other1 printenv | grep PORT=4001 + shell: script -q -e -c "bash {0}" + working-directory: redmine-src