|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + |
| 8 | +jobs: |
| 9 | + scan_ruby: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Set up Ruby |
| 15 | + uses: ruby/setup-ruby@v1 |
| 16 | + with: |
| 17 | + ruby-version: .ruby-version |
| 18 | + bundler-cache: true |
| 19 | + |
| 20 | + - name: Scan for common Rails security vulnerabilities using static analysis |
| 21 | + run: bin/brakeman --no-pager |
| 22 | + |
| 23 | + lint: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Set up Ruby |
| 29 | + uses: ruby/setup-ruby@v1 |
| 30 | + with: |
| 31 | + ruby-version: .ruby-version |
| 32 | + bundler-cache: true |
| 33 | + |
| 34 | + - name: Lint code for consistent style |
| 35 | + run: bin/rubocop -f github |
| 36 | + |
| 37 | + typecheck: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Set up Node |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: 20 |
| 46 | + cache: npm |
| 47 | + |
| 48 | + - name: Install JS dependencies |
| 49 | + run: npm ci |
| 50 | + |
| 51 | + - name: Type check |
| 52 | + run: npm run check |
| 53 | + |
| 54 | + test: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + services: |
| 58 | + postgres: |
| 59 | + image: postgres:14 |
| 60 | + env: |
| 61 | + POSTGRES_USER: postgres |
| 62 | + POSTGRES_PASSWORD: postgres |
| 63 | + ports: |
| 64 | + - 5432:5432 |
| 65 | + options: >- |
| 66 | + --health-cmd pg_isready |
| 67 | + --health-interval 10s |
| 68 | + --health-timeout 5s |
| 69 | + --health-retries 5 |
| 70 | +
|
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: Set up Ruby |
| 75 | + uses: ruby/setup-ruby@v1 |
| 76 | + with: |
| 77 | + ruby-version: .ruby-version |
| 78 | + bundler-cache: true |
| 79 | + |
| 80 | + - name: Set up Node |
| 81 | + uses: actions/setup-node@v4 |
| 82 | + with: |
| 83 | + node-version: 20 |
| 84 | + cache: npm |
| 85 | + |
| 86 | + - name: Install JS dependencies |
| 87 | + run: npm ci |
| 88 | + |
| 89 | + - name: Run tests |
| 90 | + env: |
| 91 | + RAILS_ENV: test |
| 92 | + DATABASE_USER: postgres |
| 93 | + DATABASE_PASSWORD: postgres |
| 94 | + DATABASE_HOST: localhost |
| 95 | + DATABASE_PORT: 5432 |
| 96 | + run: bin/rails db:test:prepare test |
| 97 | + |
| 98 | + - name: Keep screenshots from failed tests |
| 99 | + uses: actions/upload-artifact@v4 |
| 100 | + if: failure() |
| 101 | + with: |
| 102 | + name: screenshots |
| 103 | + path: ${{ github.workspace }}/tmp/screenshots |
| 104 | + if-no-files-found: ignore |
| 105 | + |
| 106 | + test_system: |
| 107 | + runs-on: ubuntu-latest |
| 108 | + |
| 109 | + services: |
| 110 | + postgres: |
| 111 | + image: postgres:14 |
| 112 | + env: |
| 113 | + POSTGRES_USER: postgres |
| 114 | + POSTGRES_PASSWORD: postgres |
| 115 | + ports: |
| 116 | + - 5432:5432 |
| 117 | + options: >- |
| 118 | + --health-cmd pg_isready |
| 119 | + --health-interval 10s |
| 120 | + --health-timeout 5s |
| 121 | + --health-retries 5 |
| 122 | +
|
| 123 | + steps: |
| 124 | + - uses: actions/checkout@v4 |
| 125 | + |
| 126 | + - name: Install Google Chrome |
| 127 | + uses: browser-actions/setup-chrome@v1 |
| 128 | + |
| 129 | + - name: Set up Ruby |
| 130 | + uses: ruby/setup-ruby@v1 |
| 131 | + with: |
| 132 | + ruby-version: .ruby-version |
| 133 | + bundler-cache: true |
| 134 | + |
| 135 | + - name: Set up Node |
| 136 | + uses: actions/setup-node@v4 |
| 137 | + with: |
| 138 | + node-version: 20 |
| 139 | + cache: npm |
| 140 | + |
| 141 | + - name: Install JS dependencies |
| 142 | + run: npm ci |
| 143 | + |
| 144 | + - name: Run system tests |
| 145 | + env: |
| 146 | + RAILS_ENV: test |
| 147 | + DATABASE_USER: postgres |
| 148 | + DATABASE_PASSWORD: postgres |
| 149 | + DATABASE_HOST: localhost |
| 150 | + DATABASE_PORT: 5432 |
| 151 | + run: bin/rails db:test:prepare test:system |
| 152 | + |
| 153 | + - name: Keep screenshots from failed system tests |
| 154 | + uses: actions/upload-artifact@v4 |
| 155 | + if: failure() |
| 156 | + with: |
| 157 | + name: system-test-screenshots |
| 158 | + path: ${{ github.workspace }}/tmp/screenshots |
| 159 | + if-no-files-found: ignore |
0 commit comments