diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 000000000..54ffd08df --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,55 @@ +name: Lint + +on: + push: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + bundler-cache: true + + - name: Lint code for consistent style + run: bundle exec rubocop --parallel + + stylelint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install dependencies + run: yarn install + + - name: Lint CSS and SCSS files + run: npx stylelint "app/assets/stylesheets/**/*.css" + + bundle-audit: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Run bundle-audit + run: bundle exec bundle audit check --update diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index d147851b2..e69de29bb 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -1,17 +0,0 @@ -name: "Ruby on Rails CI" -on: - push: - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Install Ruby and gems - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.2 - bundler-cache: true - - name: Lint Ruby files - run: bundle exec rubocop --parallel diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..12b507b0e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,112 @@ +name: Tests + +on: + push: + +jobs: + tests: + name: test ${{matrix.db}} ruby-${{ matrix.ruby }} + runs-on: ubuntu-latest + + strategy: + matrix: + ruby: ['3.1', '3.2', '3.3'] + db: ['postgresql', 'mysql2', 'sqlite3'] + fail-fast: false + + services: + postgres: + image: postgres:13 + env: + POSTGRES_DB: redmine_test + POSTGRES_USER: root + POSTGRES_PASSWORD: root + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: redmine_test + MYSQL_ROOT_PASSWORD: 'root' + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies and configure environment + run: | + sudo apt-get update + sudo apt-get install --yes --quiet ghostscript gsfonts locales bzr cvs + sudo locale-gen en_US # for bazaar non ascii test + + - name: Allow imagemagick to read PDF files + run: | + echo '' > policy.xml + echo '' >> policy.xml + echo '' >> policy.xml + sudo rm /etc/ImageMagick-6/policy.xml + sudo mv policy.xml /etc/ImageMagick-6/policy.xml + + - if: ${{ matrix.db == 'sqlite3' }} + name: Prepare test database for sqlite3 + run: | + cat > config/database.yml < config/database.yml < 1.68.0', require: false gem 'rubocop-performance', '~> 1.22.0', require: false gem 'rubocop-rails', '~> 2.27.0', require: false + gem 'bundle-audit', require: false end local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb index 5af9e7f13..23f3ce48f 100644 --- a/test/unit/repository_bazaar_test.rb +++ b/test/unit/repository_bazaar_test.rb @@ -165,7 +165,22 @@ class RepositoryBazaarTest < ActiveSupport::TestCase end if File.directory?(REPOSITORY_PATH_NON_ASCII) && RUN_LATIN1_OUTPUT_TEST + # https://www.redmine.org/issues/42024 + def skip_bzr_failure_on_ubuntu24 + return unless File.exist?('/etc/os-release') + + os_release = File.read('/etc/os-release') + name = os_release[/^NAME="(.+?)"$/, 1] + version = os_release[/^VERSION_ID="(.+?)"$/, 1] + + if name == 'Ubuntu' && version == '24.04' + skip 'bzr command fails on Ubuntu 24.04, causing this test to fail' + end + end + def test_cat_latin1_path + skip_bzr_failure_on_ubuntu24 + latin1_repo = create_latin1_repo buf = latin1_repo.cat( @@ -186,6 +201,8 @@ class RepositoryBazaarTest < ActiveSupport::TestCase end def test_annotate_latin1_path + skip_bzr_failure_on_ubuntu24 + latin1_repo = create_latin1_repo ann1 = latin1_repo.annotate( @@ -206,6 +223,8 @@ class RepositoryBazaarTest < ActiveSupport::TestCase end def test_diff_latin1_path + skip_bzr_failure_on_ubuntu24 + latin1_repo = create_latin1_repo diff1 = latin1_repo.diff( @@ -217,6 +236,8 @@ class RepositoryBazaarTest < ActiveSupport::TestCase end def test_entries_latin1_path + skip_bzr_failure_on_ubuntu24 + latin1_repo = create_latin1_repo entries = latin1_repo.entries("test-#{CHAR_1_UTF8_HEX}-dir", 2) assert_kind_of Redmine::Scm::Adapters::Entries, entries @@ -227,6 +248,8 @@ class RepositoryBazaarTest < ActiveSupport::TestCase end def test_entry_latin1_path + skip_bzr_failure_on_ubuntu24 + latin1_repo = create_latin1_repo ["test-#{CHAR_1_UTF8_HEX}-dir", "/test-#{CHAR_1_UTF8_HEX}-dir", @@ -245,6 +268,8 @@ class RepositoryBazaarTest < ActiveSupport::TestCase end def test_changeset_latin1_path + skip_bzr_failure_on_ubuntu24 + latin1_repo = create_latin1_repo assert_equal 0, latin1_repo.changesets.count latin1_repo.fetch_changesets