]> gitweb.mndrdr.org Git - arelpe.git/commitdiff
Fixed some test stuff; fiddling with github CI
authorAidan Cornelius-Bell <[email protected]>
Tue, 31 Dec 2024 20:40:27 +0000 (07:10 +1030)
committerAidan Cornelius-Bell <[email protected]>
Tue, 31 Dec 2024 20:40:27 +0000 (07:10 +1030)
.github/workflows/ci.yml
.rubocop.yml
config/credentials/test.yml.enc [new file with mode: 0644]
config/environments/test.rb

index bd2ce72d0ea5c9d1b070a680fd5240fedf4823a4..da7f229f428b63a9fc3e43c80aa4971c08212907 100644 (file)
@@ -1,76 +1,47 @@
 name: CI
-
 on:
-  pull_request:
   push:
-    branches: [ main ]
-
+    branches: [main]
+  pull_request:
+    branches: [main]
 jobs:
   scan_ruby:
     runs-on: ubuntu-latest
-
     steps:
       - name: Checkout code
         uses: actions/checkout@v4
-
       - name: Set up Ruby
         uses: ruby/setup-ruby@v1
         with:
           ruby-version: .ruby-version
           bundler-cache: true
-
       - name: Scan for common Rails security vulnerabilities using static analysis
         run: bin/brakeman --no-pager
 
-  scan_js:
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v4
-
-      - name: Set up Ruby
-        uses: ruby/setup-ruby@v1
-        with:
-          ruby-version: .ruby-version
-          bundler-cache: true
-
-      - name: Scan for security vulnerabilities in JavaScript dependencies
-        run: bin/importmap audit
-
   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: .ruby-version
           bundler-cache: true
-
       - name: Lint code for consistent style
         run: bin/rubocop -f github
 
   test:
     runs-on: ubuntu-latest
-
     services:
       mysql:
-        image: mysql
+        image: mysql:8.0
         env:
           MYSQL_ALLOW_EMPTY_PASSWORD: true
         ports:
           - 3306:3306
         options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
 
-      # redis:
-      #   image: redis
-      #   ports:
-      #     - 6379:6379
-      #   options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
-
     steps:
       - name: Install packages
         run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl default-mysql-client libjemalloc2 libvips
@@ -84,12 +55,17 @@ jobs:
           ruby-version: .ruby-version
           bundler-cache: true
 
-      - name: Run tests
+      - name: Setup test database and run tests
         env:
           RAILS_ENV: test
           DATABASE_URL: mysql2://127.0.0.1:3306
           # REDIS_URL: redis://localhost:6379/0
-        run: bin/rails db:test:prepare test test:system
+          ENCRYPTION_PRIMARY_KEY: ${{ secrets.ENCRYPTION_PRIMARY_KEY || 'test_primary_key_1234567890' }}
+          ENCRYPTION_DETERMINISTIC_KEY: ${{ secrets.ENCRYPTION_DETERMINISTIC_KEY || 'test_deterministic_key_1234567890' }}
+          ENCRYPTION_KEY_DERIVATION_SALT: ${{ secrets.ENCRYPTION_KEY_DERIVATION_SALT || 'test_derivation_salt_1234567890' }}
+        run: |
+          bin/rails db:test:prepare
+          bin/rails test test:system
 
       - name: Keep screenshots from failed system tests
         uses: actions/upload-artifact@v4
index f9d86d4a5480283221e922c5e4c42b7f7e532996..f25c8c2e675ca8f440ea057d5507cf91be66b9c9 100644 (file)
@@ -6,3 +6,26 @@ inherit_gem: { rubocop-rails-omakase: rubocop.yml }
 # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
 # Layout/SpaceInsideArrayLiteralBrackets:
 #   Enabled: false
+
+AllCops:
+  NewCops: enable
+  TargetRubyVersion: 3.2
+
+# Disable checks for trailing empty lines
+Layout/TrailingEmptyLines:
+  Enabled: false
+
+# Disable checks for comment spacing
+Layout/LeadingCommentSpace:
+  Enabled: false
+
+# Allow both tabs and spaces
+Layout/IndentationStyle:
+  Enabled: false
+
+# You might want to disable more rules that you don't care about
+Style/Documentation:
+  Enabled: false
+
+Style/FrozenStringLiteralComment:
+  Enabled: false
diff --git a/config/credentials/test.yml.enc b/config/credentials/test.yml.enc
new file mode 100644 (file)
index 0000000..b64fd13
--- /dev/null
@@ -0,0 +1 @@
+Nf8qnLmxZNpwpE2SpsKIvVPcc5Xgefgejov6iuF5+2AGUxNPu8ZirAaQddphdxoxC2PEkETv1tcFWANDMX5o6Pc3YjEDU8rSbRkuCVuuYS6AkYgDN9Iw12ix6g5t6+e/dkuQHiqdkHGN/vvofCZ0sRPbHujDb3ImaWx4Bs72og2kVFJkIfMZK5PEB2ihmwwVfzAiEFV8+hh1ZVLzxMSFMDvm/oKV8H6vE5EC70ZW9IzHPjHo9PPw3iDHvPKLviN3m5IB9y4MaCgUo7eATxa9W09ZHoRuh8cMCgRXyO3uf6zvErImEpAda0tPTaM9PJoXmTM/rmGYBWjt/cH4baNWBNBoNFmXrJTqEir+uwUMFrEPhoQLFD6qjbVAOdMfQNFOExnJ1Cbqad3JJLhcwXmj6czwhcxah8jPZdlDei2ywXaQjCTM/dAUC1twBEQWniOygQKdbHN17OZmrps9v09xPY1cjHYwdcy/7pe1H9AXxW14Ob9StIiRnEh5eqQyQ+8tg2ZioY+jPPzufFnbhEZ6IrArVgpFDYTU1kNINRNJXAztNuU=--+lV4znQQFC0LuJsa--6BoUpOAGHCy5MQC98vXCFA==
\ No newline at end of file
index 59c672390d801a2cd61bf1a3a9b5da78b1796f49..8545c39524465ecd420eef838c950faa91da6eb1 100644 (file)
@@ -8,6 +8,10 @@ require "active_support/core_ext/integer/time"
 Rails.application.configure do
   # Settings specified here will take precedence over those in config/application.rb.
 
+  config.active_record.encryption.primary_key = ENV.fetch('ENCRYPTION_PRIMARY_KEY') { 'test' * 8 }
+  config.active_record.encryption.deterministic_key = ENV.fetch('ENCRYPTION_DETERMINISTIC_KEY') { 'test' * 8 }
+  config.active_record.encryption.key_derivation_salt = ENV.fetch('ENCRYPTION_KEY_DERIVATION_SALT') { 'test' * 8 }
+
   # While tests run files are not watched, reloading is not necessary.
   config.enable_reloading = false
 
@@ -55,10 +59,10 @@ Rails.application.configure do
 
   # Tell Active Support which deprecation messages to disallow.
   config.active_support.disallowed_deprecation_warnings = []
-  
+
   # Turn off captcha stuff for localhost
   config.hcaptcha_enabled = false
-  
+
   # Raises error for missing translations.
   # config.i18n.raise_on_missing_translations = true