From 1b0656ca190ce9ced2235efa89cb56b936f449da Mon Sep 17 00:00:00 2001 From: Daniel Kastl Date: Fri, 7 Jun 2024 19:08:44 +0900 Subject: [PATCH] Revert use of scripts Signed-off-by: Daniel Kastl --- .github/workflows/test-postgis.yml | 81 ++++++++++++++++++++++------ scripts/adjust_gem_env.sh | 7 --- scripts/install_ruby_dependencies.sh | 4 -- scripts/prepare_plugin.sh | 4 -- scripts/prepare_redmine.sh | 11 ---- scripts/run_rake_tasks.sh | 4 -- scripts/run_tests.sh | 8 --- scripts/run_uninstall_test.sh | 3 -- scripts/setup_environment.sh | 18 ------- scripts/zeitwerk_check.sh | 5 -- 10 files changed, 64 insertions(+), 81 deletions(-) delete mode 100755 scripts/adjust_gem_env.sh delete mode 100755 scripts/install_ruby_dependencies.sh delete mode 100755 scripts/prepare_plugin.sh delete mode 100755 scripts/prepare_redmine.sh delete mode 100755 scripts/run_rake_tasks.sh delete mode 100755 scripts/run_tests.sh delete mode 100755 scripts/run_uninstall_test.sh delete mode 100755 scripts/setup_environment.sh delete mode 100755 scripts/zeitwerk_check.sh diff --git a/.github/workflows/test-postgis.yml b/.github/workflows/test-postgis.yml index d06ed9a..6e51c4e 100644 --- a/.github/workflows/test-postgis.yml +++ b/.github/workflows/test-postgis.yml @@ -18,6 +18,7 @@ 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 @@ -47,12 +48,6 @@ jobs: options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: List scripts directory for debugging - run: ls -l $GITHUB_WORKSPACE/scripts - - name: Checkout Redmine uses: actions/checkout@v4 with: @@ -65,45 +60,97 @@ jobs: with: path: redmine/plugins/${{ env.PLUGIN_NAME }} - - name: Setup Environment - run: $GITHUB_WORKSPACE/scripts/setup_environment.sh + - name: Update package archives + run: apt-get update --yes --quiet + + - name: Install package dependencies + run: | + apt-get install --yes --quiet \ + postgresql-client \ + gcc libpq-dev make patch libgeos-dev curl + # 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: 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 + apt-get update --yes --quiet + apt-get install --yes --quiet --no-install-recommends nodejs yarn - name: Prepare Plugin - working-directory: redmine/plugins/${{ env.PLUGIN_NAME }} - run: $GITHUB_WORKSPACE/scripts/prepare_plugin.sh + working-directory: redmine/plugins/redmine_gtt + run: | + yarn + npx webpack - name: Prepare Redmine source working-directory: redmine - run: $GITHUB_WORKSPACE/scripts/prepare_redmine.sh + run: | + cat < config/database.yml + test: + adapter: postgis + database: redmine + host: postgres + username: postgres + password: postgres + encoding: utf8 + EOF - name: Adjust Gem environment - run: $GITHUB_WORKSPACE/scripts/adjust_gem_env.sh + run: | + case "${{ matrix.redmine_version }}" in + master) + echo "GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION=9.0.1" >> ${GITHUB_ENV} + ;; + esac - name: Install Ruby dependencies working-directory: redmine - run: $GITHUB_WORKSPACE/scripts/install_ruby_dependencies.sh + 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: $GITHUB_WORKSPACE/scripts/run_rake_tasks.sh + 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: $GITHUB_WORKSPACE/scripts/zeitwerk_check.sh + run: | + if grep -q zeitwerk config/application.rb ; then + bundle exec rake zeitwerk:check + fi + shell: bash - name: Run 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: $GITHUB_WORKSPACE/scripts/run_tests.sh + run: | + bundle exec rake redmine:plugins:test:units NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + bundle exec rake redmine:plugins:test:functionals NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + bundle exec rake redmine:plugins:test:integration NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + if [ ${{ matrix.system_test }} = "true" ]; then + bundle exec rake redmine:plugins:test:system NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" + fi - name: Run uninstall test env: RAILS_ENV: test working-directory: redmine - run: $GITHUB_WORKSPACE/scripts/run_uninstall_test.sh + run: bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0 diff --git a/scripts/adjust_gem_env.sh b/scripts/adjust_gem_env.sh deleted file mode 100755 index 640fe09..0000000 --- a/scripts/adjust_gem_env.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -case "${{ matrix.redmine_version }}" in - master) - echo "GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION=9.0.1" >> ${GITHUB_ENV} - ;; -esac diff --git a/scripts/install_ruby_dependencies.sh b/scripts/install_ruby_dependencies.sh deleted file mode 100755 index 13e26e7..0000000 --- a/scripts/install_ruby_dependencies.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -bundle config set --local without 'development' -bundle install --jobs=4 --retry=3 diff --git a/scripts/prepare_plugin.sh b/scripts/prepare_plugin.sh deleted file mode 100755 index 95408e7..0000000 --- a/scripts/prepare_plugin.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -yarn -npx webpack diff --git a/scripts/prepare_redmine.sh b/scripts/prepare_redmine.sh deleted file mode 100755 index 148b05d..0000000 --- a/scripts/prepare_redmine.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -cat < config/database.yml - test: - adapter: postgis - database: redmine - host: postgres - username: postgres - password: postgres - encoding: utf8 -EOF diff --git a/scripts/run_rake_tasks.sh b/scripts/run_rake_tasks.sh deleted file mode 100755 index ae05094..0000000 --- a/scripts/run_rake_tasks.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -bundle exec rake generate_secret_token -bundle exec rake db:create db:migrate redmine:plugins:migrate diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh deleted file mode 100755 index aeca417..0000000 --- a/scripts/run_tests.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -bundle exec rake redmine:plugins:test:units NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" -bundle exec rake redmine:plugins:test:functionals NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" -bundle exec rake redmine:plugins:test:integration NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" -if [ "${{ matrix.system_test }}" = "true" ]; then - bundle exec rake redmine:plugins:test:system NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0" -fi diff --git a/scripts/run_uninstall_test.sh b/scripts/run_uninstall_test.sh deleted file mode 100755 index 1a27e07..0000000 --- a/scripts/run_uninstall_test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0 diff --git a/scripts/setup_environment.sh b/scripts/setup_environment.sh deleted file mode 100755 index 8c5dfa5..0000000 --- a/scripts/setup_environment.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -apt-get update --yes --quiet -apt-get install --yes --quiet postgresql-client gcc libpq-dev make patch libgeos-dev curl - -# 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 - -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 -apt-get update --yes --quiet -apt-get install --yes --quiet --no-install-recommends nodejs yarn diff --git a/scripts/zeitwerk_check.sh b/scripts/zeitwerk_check.sh deleted file mode 100755 index a78117f..0000000 --- a/scripts/zeitwerk_check.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if grep -q zeitwerk config/application.rb ; then - bundle exec rake zeitwerk:check -fi