<commit_before>name: Test
on:
  push:
  pull_request:

jobs:
  test:
    name: Ruby ${{ matrix.ruby }} / Redmine ${{ matrix.redmine }}
    runs-on: ubuntu-latest

    strategy:
      matrix:
        ruby: ['2.6', '2.4']
        redmine: ['4.1-stable', 'master']
        db: ['postgres', 'mysql']
      fail-fast: false

    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

      mysql:
          image: mysql:5.7
          env:
              MYSQL_ALLOW_EMPTY_PASSWORD: yes
              MYSQL_DATABASE: redmine
          ports:
            - 5432:5432
          options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Checkout Redmine
        uses: actions/checkout@v2
        with:
          repository: redmine/redmine
          ref: ${{ matrix.redmine }}
          path: redmine

      - name: Checkout redmine_git_hosting
        uses: actions/checkout@v2
        with:
          path: redmine/plugins/redmine_git_hosting

      - name: Checkout additionals
        uses: actions/checkout@v2
        with:
          repository: AlphaNodes/additionals
          path: redmine/plugins/additionals

      - name: Checkout redmine_sidekiq
        uses: actions/checkout@v2
        with:
          repository: ogom/redmine_sidekiq
          path: redmine/plugins/redmine_sidekiq

      - name: Checkout gitolite
        uses: actions/checkout@v2
        with:
          repository: sitaramc/gitolite
          path: gitolite

      - name: Update package archives
        run: sudo apt-get update --yes --quiet

      - name: Install package dependencies
        run: >
          sudo apt-get install --yes --quiet
          build-essential
          cmake
          libgpg-error-dev
          libicu-dev
          libpq-dev
          libmysqlclient-dev
          libssh2-1
          libssh2-1-dev
          subversion

      - name: Setup Ruby
        uses: actions/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          architecture: 'x64'

      - name: Setup Cache
        uses: actions/cache@v1
        with:
          path: vendor
          key: v1-ruby-${{ matrix.ruby }}-redmine-${{ matrix.redmine }}

      - name: Setup Bundler
        run: |
          gem install bundler -v '~> 1.0'
          bundle config path "$(pwd)/vendor/bundle"

      - name: Prepare Redmine source
        working-directory: redmine
        run: |
          sed -i '/rubocop/d' Gemfile
          rm -f .rubocop*
          cp plugins/redmine_git_hosting/contrib/github/database-${{ matrix.db }}.yml config/database.yml

      - name: Install admin ssh key
        working-directory: redmine
        run: |
          ssh-keygen -N '' -f plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa

      - name: Install Gitolite
        working-directory: redmine
        run: |
          sudo useradd --create-home git
          sudo -n -u git -i mkdir bin
          sudo -n -u git -i $GITHUB_WORKSPACE/gitolite/install -to /home/git/bin
          sudo cp plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub /home/git/
          sudo chown git.git /home/git/redmine_gitolite_admin_id_rsa.pub
          sudo -n -u git -i bin/gitolite setup -pk redmine_gitolite_admin_id_rsa.pub

      - name: Install Ruby dependencies
        working-directory: redmine
        run: |
          bundle install --jobs=4 --retry=3 --without development

      - name: Run Redmine rake tasks
        env:
          RAILS_ENV: test
        working-directory: redmine
        run: |
          bundle exec rake generate_secret_token
          bundle exec rake db:create db:migrate redmine:plugins:migrate
          bundle exec rake db:test:prepare

      - name: Install rspec file
        working-directory: redmine
        run: |
          mkdir spec
          cp plugins/redmine_git_hosting/spec/root_spec_helper.rb spec/spec_helper.rb

      - name: Run tests
        env:
          RAILS_ENV: test
          REDMINE_VERSION: ${{ matrix.redmine }}
        working-directory: redmine
        run: bundle exec rake redmine_git_hosting:ci:all

      - name: Upload coverage results
        uses: actions/upload-artifact@v2
        if: always()
        with:
          name: coverage-report
          path: redmine/coverage
<commit_msg>Fix mysql port for github action<commit_after>name: Test
on:
  push:
  pull_request:

jobs:
  test:
    name: Ruby ${{ matrix.ruby }} / Redmine ${{ matrix.redmine }} / DB  ${{ matrix.db }}
    runs-on: ubuntu-latest

    strategy:
      matrix:
        ruby: ['2.6', '2.4']
        redmine: ['4.1-stable', 'master']
        db: ['postgres', 'mysql']
      fail-fast: false

    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

      mysql:
          image: mysql:5.7
          env:
              MYSQL_ALLOW_EMPTY_PASSWORD: yes
              MYSQL_DATABASE: redmine
          ports:
            - 3306:3306
          options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - name: Checkout Redmine
        uses: actions/checkout@v2
        with:
          repository: redmine/redmine
          ref: ${{ matrix.redmine }}
          path: redmine

      - name: Checkout redmine_git_hosting
        uses: actions/checkout@v2
        with:
          path: redmine/plugins/redmine_git_hosting

      - name: Checkout additionals
        uses: actions/checkout@v2
        with:
          repository: AlphaNodes/additionals
          path: redmine/plugins/additionals

      - name: Checkout redmine_sidekiq
        uses: actions/checkout@v2
        with:
          repository: ogom/redmine_sidekiq
          path: redmine/plugins/redmine_sidekiq

      - name: Checkout gitolite
        uses: actions/checkout@v2
        with:
          repository: sitaramc/gitolite
          path: gitolite

      - name: Update package archives
        run: sudo apt-get update --yes --quiet

      - name: Install package dependencies
        run: >
          sudo apt-get install --yes --quiet
          build-essential
          cmake
          libgpg-error-dev
          libicu-dev
          libpq-dev
          libmysqlclient-dev
          libssh2-1
          libssh2-1-dev
          subversion

      - name: Setup Ruby
        uses: actions/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          architecture: 'x64'

      - name: Setup Cache
        uses: actions/cache@v1
        with:
          path: vendor
          key: v1-ruby-${{ matrix.ruby }}-redmine-${{ matrix.redmine }}

      - name: Setup Bundler
        run: |
          gem install bundler -v '~> 1.0'
          bundle config path "$(pwd)/vendor/bundle"

      - name: Prepare Redmine source
        working-directory: redmine
        run: |
          sed -i '/rubocop/d' Gemfile
          rm -f .rubocop*
          cp plugins/redmine_git_hosting/contrib/github/database-${{ matrix.db }}.yml config/database.yml

      - name: Install admin ssh key
        working-directory: redmine
        run: |
          ssh-keygen -N '' -f plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa

      - name: Install Gitolite
        working-directory: redmine
        run: |
          sudo useradd --create-home git
          sudo -n -u git -i mkdir bin
          sudo -n -u git -i $GITHUB_WORKSPACE/gitolite/install -to /home/git/bin
          sudo cp plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub /home/git/
          sudo chown git.git /home/git/redmine_gitolite_admin_id_rsa.pub
          sudo -n -u git -i bin/gitolite setup -pk redmine_gitolite_admin_id_rsa.pub

      - name: Install Ruby dependencies
        working-directory: redmine
        run: |
          bundle install --jobs=4 --retry=3 --without development

      - name: Run Redmine rake tasks
        env:
          RAILS_ENV: test
        working-directory: redmine
        run: |
          bundle exec rake generate_secret_token
          bundle exec rake db:create db:migrate redmine:plugins:migrate
          bundle exec rake db:test:prepare

      - name: Install rspec file
        working-directory: redmine
        run: |
          mkdir spec
          cp plugins/redmine_git_hosting/spec/root_spec_helper.rb spec/spec_helper.rb

      - name: Run tests
        env:
          RAILS_ENV: test
          REDMINE_VERSION: ${{ matrix.redmine }}
        working-directory: redmine
        run: bundle exec rake redmine_git_hosting:ci:all

      - name: Upload coverage results
        uses: actions/upload-artifact@v2
        if: always()
        with:
          name: coverage-report
          path: redmine/coverage

{'fraction_non_alphanumeric': 0.08912948381452318, 'fraction_numerical': 0.011592300962379702, 'mean_word_length': 1.7462462462462462, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1277792', 'n_tokens_mistral': 2904, 'n_tokens_neox': 2732, 'n_words': 667}