Project

General

Profile

Patch #42135 » 0001-5.0-stable-Enable-GitHub-Actions-for-testing-and-linting-on-5.0-stable-branch.patch

Katsuya HIDAKA, 2025-01-21 14:32

View differences:

.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.1
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 "public/stylesheets/**/*.css"
.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.0', '3.1']
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 libsqlite3-dev 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
.rubocop.yml
200 200

  
201 201
Style/TrailingCommaInHashLiteral:
202 202
  Enabled: false
203

  
204
Style/InverseMethods:
205
  Enabled: false
.stylelintrc
24 24
    "no-empty-source": true,
25 25
    "no-extra-semicolons": true,
26 26
    "no-invalid-double-slash-comments": true,
27
  }
27
  },
28
  "ignoreFiles": [
29
    "app/assets/stylesheets/jquery/*.css"
30
  ]
28 31
}
(5-5/8)