Project

General

Profile

Patch #42688 » Extract-system-tests-to-a-separate-job-run-only-on-SQLite3-and-latest-stable-Ruby.patch

Katsuya HIDAKA, 2025-05-17 18:37

View differences:

.github/actions/setup-redmine/action.yml
1
name: Setup Redmine Test Environment
2
description: Composite action for setting up Redmine test environment
3

  
4
inputs:
5
  db-type:
6
    description: 'Database type: postgresql, mysql2, or sqlite3. Note: postgresql and mysql2 require service containers to be defined in the workflow.'
7
    required: true
8
  ruby-version:
9
    description: 'Ruby version to use'
10
    required: true
11

  
12
runs:
13
  using: composite
14
  steps:
15
    - name: Install dependencies and configure environment
16
      shell: bash
17
      run: |
18
        sudo apt-get update
19
        sudo apt-get install --yes --quiet ghostscript gsfonts locales bzr cvs
20
        sudo locale-gen en_US # for bazaar non ascii test
21

  
22
    - name: Allow imagemagick to read PDF files
23
      shell: bash
24
      run: |
25
        echo '<policymap>' > policy.xml
26
        echo '<policy domain="coder" rights="read | write" pattern="PDF" />' >> policy.xml
27
        echo '</policymap>' >> policy.xml
28
        sudo rm /etc/ImageMagick-6/policy.xml
29
        sudo mv policy.xml /etc/ImageMagick-6/policy.xml
30

  
31
    - if: ${{ inputs.db-type == 'sqlite3' }}
32
      name: Prepare test database for sqlite3
33
      shell: bash
34
      run: |
35
        cat > config/database.yml <<EOF
36
        test:
37
          adapter: sqlite3
38
          database: db/test.sqlite3
39
        EOF
40

  
41
    - if: ${{ inputs.db-type == 'mysql2' || inputs.db-type == 'postgresql' }}
42
      name: Prepare test database for mysql2 and postgresql
43
      shell: bash
44
      run: |
45
        cat > config/database.yml <<EOF
46
        test:
47
          adapter: ${{ inputs.db-type }}
48
          database: redmine_test
49
          username: root
50
          password: root
51
          host: 127.0.0.1
52
        EOF
53

  
54
    - name: Install Ruby and gems
55
      uses: ruby/setup-ruby@v1
56
      with:
57
        ruby-version: ${{ inputs.ruby-version }}
58
        bundler-cache: true
59

  
60
    - name: Run prepare test environment
61
      shell: bash
62
      env:
63
        RAILS_ENV: test
64
        SCMS: subversion,git,git_utf8,filesystem,bazaar,cvs
65
      run: |
66
        bundle exec rake ci:about
67
        bundle exec rake ci:setup
68
        bundle exec rake db:environment:set
.github/workflows/tests.yml
46 46
      - name: Checkout code
47 47
        uses: actions/checkout@v4
48 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
49
      - name: Setup Redmine test environment
50
        uses: ./.github/actions/setup-redmine
86 51
        with:
52
          db-type: ${{ matrix.db }}
87 53
          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 54

  
99 55
      - name: Run tests
100 56
        run: |
......
111 67
        run: |
112 68
          bin/rails test:autoload
113 69

  
70
  system-tests:
71
    name: system test
72
    runs-on: ubuntu-latest
73

  
74
    steps:
75
      - name: Checkout code
76
        uses: actions/checkout@v4
77

  
78
      - name: Setup Redmine test environment
79
        uses: ./.github/actions/setup-redmine
80
        with:
81
          db-type: sqlite3
82
          ruby-version: '3.4'
83

  
114 84
      # System tests use Chrome and ChromeDriver installed on the GitHub Actions Ubuntu image.
115 85
      # They are generally updated to the latest stable versions.
86
      - name: Display Chrome version
87
        run: google-chrome --version
88

  
116 89
      - name: Run system tests
117
        run: |
118
          google-chrome --version
119
          bin/rails test:system
90
        run: bin/rails test:system
120 91
        env:
121 92
          GOOGLE_CHROME_OPTS_ARGS: headless,disable-gpu,no-sandbox,disable-dev-shm-usage
122 93
        # System tests might still be a bit unstable, so for now, even if a system test fails,
......
127 98
        if: always()
128 99
        uses: actions/upload-artifact@v4
129 100
        with:
130
          name: system-test-screenshots-ruby${{ matrix.ruby }}-${{ matrix.db }}
101
          name: system-test-screenshots-ruby3.4-sqlite3
131 102
          path: tmp/screenshots
132 103
          if-no-files-found: ignore
(4-4/5)