diff --git a/action.yml b/action.yml index 6ed5acc..09f91ef 100644 --- a/action.yml +++ b/action.yml @@ -51,32 +51,19 @@ runs: env: REDMINE_DIR: ${{ inputs.path }} - - name: Install dependencies + - name: Set up base environment run: | - sudo apt-get update; \ - sudo apt-get install -y --no-install-recommends \ - build-essential \ - bzr git mercurial subversion cvs \ - ghostscript \ - gsfonts \ - imagemagick libmagick++-dev \ - libnss3-dev; - shell: bash - - - name: Allow ImageMagick to read PDF files - run: | - sudo sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml - shell: bash - - - name: Set up Google Chrome for system tests - run: | - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list - sudo apt-get update - sudo apt-get install -y --no-install-recommends google-chrome-stable + # For example: v5.1.3.stable -> "setup-base-5.1.sh" + setup_base_script="setup-base-$REDMINE_VERSION_MAJOR.$REDMINE_VERSION_MINOR.sh" - echo GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage" >> $GITHUB_ENV + if [ -e ./scripts/$setup_base_script ]; then + ./scripts/$setup_base_script + else + ./scripts/setup-base-next.sh + fi shell: bash + env: + REDMINE_DIR: ${{ inputs.path }} - name: Set up PostgreSQL database if: ${{ startsWith(inputs.database, 'postgres:') }} @@ -101,13 +88,6 @@ runs: env: REDMINE_DIR: ${{ inputs.path }} - # https://www.redmine.org/issues/40802 - - name: Fix LoadError in Redmine 4.2 - if: ${{ env.REDMINE_VERSION_MAJOR < 5 }} - run: echo "gem 'builder', '~> 3.2.4'" >> Gemfile.local - shell: bash - working-directory: ${{ inputs.path }} - - name: Set up Ruby and install dependencies uses: ruby/setup-ruby@v1 with: diff --git a/scripts/setup-base-4.2.sh b/scripts/setup-base-4.2.sh new file mode 100644 index 0000000..1af3bc7 --- /dev/null +++ b/scripts/setup-base-4.2.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -eu + +# Install dependencies +sudo apt-get update; \ +sudo apt-get install -y --no-install-recommends \ + build-essential \ + bzr git mercurial subversion cvs \ + ghostscript \ + gsfonts \ + imagemagick libmagick++-dev \ + libnss3-dev; + +# Allow ImageMagick to read PDF files +sudo sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml + +# Set up Google Chrome for system tests +wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list +sudo apt-get update +sudo apt-get install -y --no-install-recommends google-chrome-stable +echo GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage" >> $GITHUB_ENV + +# Fix LoadError cannot load such file -- builder +# https://www.redmine.org/issues/40802 +echo "gem 'builder', '~> 3.2.4'" >> $REDMINE_DIR/Gemfile.local diff --git a/scripts/setup-base-5.0.sh b/scripts/setup-base-5.0.sh new file mode 100644 index 0000000..f7add9b --- /dev/null +++ b/scripts/setup-base-5.0.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -eu + +# Install dependencies +sudo apt-get update; \ +sudo apt-get install -y --no-install-recommends \ + build-essential \ + bzr git mercurial subversion cvs \ + ghostscript \ + gsfonts \ + imagemagick libmagick++-dev \ + libnss3-dev; + +# Allow ImageMagick to read PDF files +sudo sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml + +# Set up Google Chrome for system tests +wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list +sudo apt-get update +sudo apt-get install -y --no-install-recommends google-chrome-stable +echo GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage" >> $GITHUB_ENV diff --git a/scripts/setup-base-5.1.sh b/scripts/setup-base-5.1.sh new file mode 100644 index 0000000..f7add9b --- /dev/null +++ b/scripts/setup-base-5.1.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -eu + +# Install dependencies +sudo apt-get update; \ +sudo apt-get install -y --no-install-recommends \ + build-essential \ + bzr git mercurial subversion cvs \ + ghostscript \ + gsfonts \ + imagemagick libmagick++-dev \ + libnss3-dev; + +# Allow ImageMagick to read PDF files +sudo sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml + +# Set up Google Chrome for system tests +wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list +sudo apt-get update +sudo apt-get install -y --no-install-recommends google-chrome-stable +echo GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage" >> $GITHUB_ENV diff --git a/scripts/setup-base-next.sh b/scripts/setup-base-next.sh new file mode 100644 index 0000000..f7add9b --- /dev/null +++ b/scripts/setup-base-next.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -eu + +# Install dependencies +sudo apt-get update; \ +sudo apt-get install -y --no-install-recommends \ + build-essential \ + bzr git mercurial subversion cvs \ + ghostscript \ + gsfonts \ + imagemagick libmagick++-dev \ + libnss3-dev; + +# Allow ImageMagick to read PDF files +sudo sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml + +# Set up Google Chrome for system tests +wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list +sudo apt-get update +sudo apt-get install -y --no-install-recommends google-chrome-stable +echo GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage" >> $GITHUB_ENV