Patch #42135 » 0001-6.0-stable-Enable-GitHub-Actions-for-testing-and-linting-on-6.0-stable-branch.patch
| .github/workflows/linters.yml | ||
|---|---|---|
| 1 |
name: Lint |
|
| 2 | ||
| 3 |
on: |
|
| 4 |
push: |
|
| 5 | ||
| 6 |
jobs: |
|
| 7 |
lint: |
|
| 8 |
runs-on: ubuntu-latest |
|
| 9 | ||
| 10 |
steps: |
|
| 11 |
- name: Checkout code |
|
| 12 |
uses: actions/checkout@v4 |
|
| 13 | ||
| 14 |
- name: Set up Ruby |
|
| 15 |
uses: ruby/setup-ruby@v1 |
|
| 16 |
with: |
|
| 17 |
ruby-version: 3.2 |
|
| 18 |
bundler-cache: true |
|
| 19 | ||
| 20 |
- name: Lint code for consistent style |
|
| 21 |
run: bundle exec rubocop --parallel |
|
| 22 | ||
| 23 |
stylelint: |
|
| 24 |
runs-on: ubuntu-latest |
|
| 25 | ||
| 26 |
steps: |
|
| 27 |
- name: Checkout code |
|
| 28 |
uses: actions/checkout@v4 |
|
| 29 | ||
| 30 |
- name: Set up Node.js |
|
| 31 |
uses: actions/setup-node@v2 |
|
| 32 |
with: |
|
| 33 |
node-version: '20' |
|
| 34 | ||
| 35 |
- name: Install dependencies |
|
| 36 |
run: yarn install |
|
| 37 | ||
| 38 |
- name: Lint CSS and SCSS files |
|
| 39 |
run: npx stylelint "app/assets/stylesheets/**/*.css" |
|
| 40 | ||
| 41 |
bundle-audit: |
|
| 42 |
runs-on: ubuntu-latest |
|
| 43 | ||
| 44 |
steps: |
|
| 45 |
- name: Checkout code |
|
| 46 |
uses: actions/checkout@v4 |
|
| 47 | ||
| 48 |
- name: Set up Ruby |
|
| 49 |
uses: ruby/setup-ruby@v1 |
|
| 50 |
with: |
|
| 51 |
ruby-version: '3.2' |
|
| 52 |
bundler-cache: true |
|
| 53 | ||
| 54 |
- name: Run bundle-audit |
|
| 55 |
run: bundle exec bundle audit check --update |
|
| .github/workflows/rubyonrails.yml | ||
|---|---|---|
| 1 |
name: "Ruby on Rails CI" |
|
| 2 |
on: |
|
| 3 |
push: |
|
| 4 | ||
| 5 |
jobs: |
|
| 6 |
lint: |
|
| 7 |
runs-on: ubuntu-latest |
|
| 8 |
steps: |
|
| 9 |
- name: Checkout code |
|
| 10 |
uses: actions/checkout@v4 |
|
| 11 |
- name: Install Ruby and gems |
|
| 12 |
uses: ruby/setup-ruby@v1 |
|
| 13 |
with: |
|
| 14 |
ruby-version: 3.2 |
|
| 15 |
bundler-cache: true |
|
| 16 |
- name: Lint Ruby files |
|
| 17 |
run: bundle exec rubocop --parallel |
|
| .github/workflows/tests.yml | ||
|---|---|---|
| 1 |
name: Tests |
|
| 2 | ||
| 3 |
on: |
|
| 4 |
push: |
|
| 5 | ||
| 6 |
jobs: |
|
| 7 |
tests: |
|
| 8 |
name: test ${{matrix.db}} ruby-${{ matrix.ruby }}
|
|
| 9 |
runs-on: ubuntu-latest |
|
| 10 | ||
| 11 |
strategy: |
|
| 12 |
matrix: |
|
| 13 |
ruby: ['3.1', '3.2', '3.3'] |
|
| 14 |
db: ['postgresql', 'mysql2', 'sqlite3'] |
|
| 15 |
fail-fast: false |
|
| 16 | ||
| 17 |
services: |
|
| 18 |
postgres: |
|
| 19 |
image: postgres:13 |
|
| 20 |
env: |
|
| 21 |
POSTGRES_DB: redmine_test |
|
| 22 |
POSTGRES_USER: root |
|
| 23 |
POSTGRES_PASSWORD: root |
|
| 24 |
ports: |
|
| 25 |
- 5432:5432 |
|
| 26 |
options: >- |
|
| 27 |
--health-cmd pg_isready |
|
| 28 |
--health-interval 10s |
|
| 29 |
--health-timeout 5s |
|
| 30 |
--health-retries 5 |
|
| 31 | ||
| 32 |
mysql: |
|
| 33 |
image: mysql:8.0 |
|
| 34 |
env: |
|
| 35 |
MYSQL_DATABASE: redmine_test |
|
| 36 |
MYSQL_ROOT_PASSWORD: 'root' |
|
| 37 |
ports: |
|
| 38 |
- 3306:3306 |
|
| 39 |
options: >- |
|
| 40 |
--health-cmd="mysqladmin ping" |
|
| 41 |
--health-interval=10s |
|
| 42 |
--health-timeout=5s |
|
| 43 |
--health-retries=3 |
|
| 44 | ||
| 45 |
steps: |
|
| 46 |
- name: Checkout code |
|
| 47 |
uses: actions/checkout@v4 |
|
| 48 | ||
| 49 |
- name: Install dependencies and configure environment |
|
| 50 |
run: | |
|
| 51 |
sudo apt-get update |
|
| 52 |
sudo apt-get install --yes --quiet ghostscript gsfonts locales bzr cvs |
|
| 53 |
sudo locale-gen en_US # for bazaar non ascii test |
|
| 54 | ||
| 55 |
- name: Allow imagemagick to read PDF files |
|
| 56 |
run: | |
|
| 57 |
echo '<policymap>' > policy.xml |
|
| 58 |
echo '<policy domain="coder" rights="read | write" pattern="PDF" />' >> policy.xml |
|
| 59 |
echo '</policymap>' >> policy.xml |
|
| 60 |
sudo rm /etc/ImageMagick-6/policy.xml |
|
| 61 |
sudo mv policy.xml /etc/ImageMagick-6/policy.xml |
|
| 62 | ||
| 63 |
- if: ${{ matrix.db == 'sqlite3' }}
|
|
| 64 |
name: Prepare test database for sqlite3 |
|
| 65 |
run: | |
|
| 66 |
cat > config/database.yml <<EOF |
|
| 67 |
test: |
|
| 68 |
adapter: sqlite3 |
|
| 69 |
database: db/test.sqlite3 |
|
| 70 |
EOF |
|
| 71 | ||
| 72 |
- if: ${{ matrix.db == 'mysql2' || matrix.db == 'postgresql' }}
|
|
| 73 |
name: Prepare test database for mysql2 and postgresql |
|
| 74 |
run: | |
|
| 75 |
cat > config/database.yml <<EOF |
|
| 76 |
test: |
|
| 77 |
adapter: ${{ matrix.db }}
|
|
| 78 |
database: redmine_test |
|
| 79 |
username: root |
|
| 80 |
password: root |
|
| 81 |
host: 127.0.0.1 |
|
| 82 |
EOF |
|
| 83 | ||
| 84 |
- name: Install Ruby and gems |
|
| 85 |
uses: ruby/setup-ruby@v1 |
|
| 86 |
with: |
|
| 87 |
ruby-version: ${{ matrix.ruby }}
|
|
| 88 |
bundler-cache: true |
|
| 89 | ||
| 90 |
- name: Run prepare test environment |
|
| 91 |
env: |
|
| 92 |
RAILS_ENV: test |
|
| 93 |
SCMS: subversion,git,git_utf8,filesystem,bazaar,cvs |
|
| 94 |
run: | |
|
| 95 |
bundle exec rake ci:about |
|
| 96 |
bundle exec rake ci:setup |
|
| 97 |
bundle exec rake db:environment:set |
|
| 98 | ||
| 99 |
- name: Run tests |
|
| 100 |
run: | |
|
| 101 |
bin/rails test |
|
| 102 | ||
| 103 |
- name: Run bazaar non ascii test |
|
| 104 |
env: |
|
| 105 |
LANG: en_US.ISO8859-1 |
|
| 106 |
LC_ALL: en_US.ISO8859-1 |
|
| 107 |
run: | |
|
| 108 |
bin/rails test test/unit/repository_bazaar_test.rb |
|
| 109 | ||
| 110 |
- name: Run autoload test |
|
| 111 |
run: | |
|
| 112 |
bin/rails test:autoload |
|
| .stylelintrc | ||
|---|---|---|
| 22 | 22 |
"no-duplicate-selectors": true, |
| 23 | 23 |
"no-empty-source": true, |
| 24 | 24 |
"no-invalid-double-slash-comments": true, |
| 25 |
} |
|
| 25 |
}, |
|
| 26 |
"ignoreFiles": [ |
|
| 27 |
"app/assets/stylesheets/jquery/*.css" |
|
| 28 |
] |
|
| 26 | 29 |
} |
| Gemfile | ||
|---|---|---|
| 113 | 113 |
gem 'rubocop', '~> 1.68.0', require: false |
| 114 | 114 |
gem 'rubocop-performance', '~> 1.22.0', require: false |
| 115 | 115 |
gem 'rubocop-rails', '~> 2.27.0', require: false |
| 116 |
gem 'bundle-audit', require: false |
|
| 116 | 117 |
end |
| 117 | 118 | |
| 118 | 119 |
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") |