Project

General

Profile

Feature #30069 » 0001-Simplify-environment-setup-in-tests.yml.patch

Mizuki ISHIKAWA, 2024-11-16 07:46

View differences:

.github/workflows/tests.yml
11 11
    strategy:
12 12
      matrix:
13 13
        ruby: ['3.1', '3.2', '3.3']
14
        db: ['postgresql', 'mysql']
14
        db: ['postgresql', 'mysql2']
15 15
      fail-fast: false
16 16

  
17 17
    services:
......
59 59
          sudo rm /etc/ImageMagick-6/policy.xml
60 60
          sudo mv policy.xml /etc/ImageMagick-6/policy.xml
61 61

  
62
      - name: Prepare Redmine database configuration
63
        run: |
64
          cat > config/database.yml <<EOF
65
          test:
66
            adapter: ${{ matrix.db }}
67
            database: redmine_test
68
            username: root
69
            password: root
70
            host: 127.0.0.1
71
          EOF
72

  
62 73
      - name: Install Ruby and gems
63 74
        uses: ruby/setup-ruby@v1.176.0
64 75
        with:
65 76
          ruby-version: ${{ matrix.ruby }}
66 77
          bundler-cache: true
67 78

  
68
      - name: Prepare Redmine configuration for PostgreSQL
69
        run: |
70
          cp config/database.yml.example config/database.yml
71
          sed -i -e "s/mysql2$/postgresql/g" config/database.yml
72
          sed -i -e "s/host:.*$/host: localhost/g" config/database.yml
73
          sed -i -e "s/password:.*$/password: root/g" config/database.yml
74
          sed -i -e "41,43d" config/database.yml
75
        if: matrix.db == 'postgresql'
76

  
77
      - name: Prepare Redmine configuration for MySQL
78
        run: |
79
          cp config/database.yml.example config/database.yml
80
          sed -i -e "s/host:.*$/host: 127.0.0.1/g" config/database.yml
81
          sed -i -e "s/password:.*$/password: root/g" config/database.yml
82
        if: matrix.db == 'mysql'
83

  
84
      - name: Install dependencies
85
        env:
86
          RAILS_ENV: test
87
        run: bundle install --jobs=4 --retry=3
88

  
89
      - name: Run DB migration
90
        env:
91
          RAILS_ENV: test
92
        run: bundle exec rake db:migrate
93

  
94
      - name: Run SCM setup for Git, Git UTF8, Subversion and Filesystem
79
      - name: Run prepare test environment
95 80
        env:
96 81
          RAILS_ENV: test
82
          SCMS: subversion,git,git_utf8,filesystem
97 83
        run: |
98
          bundle exec rake test:scm:setup:git
99
          bundle exec rake test:scm:setup:git_utf8
100
          bundle exec rake test:scm:setup:subversion
101
          bundle exec rake test:scm:setup:filesystem
84
          bundle exec rake ci:about
85
          bundle exec rake ci:setup
86
          bundle exec rake db:environment:set
102 87

  
103 88
      - name: Run tests
104 89
        run: |
(2-2/4)