|
1 | 1 | name: WWW |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +defaults: |
| 4 | + run: |
| 5 | + working-directory: ./www |
| 6 | + |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + push: |
| 10 | + branches: [main] |
4 | 11 |
|
5 | 12 | jobs: |
6 | | - build: |
| 13 | + scan_ruby: |
7 | 14 | runs-on: ubuntu-latest |
8 | 15 |
|
9 | 16 | steps: |
10 | | - - uses: actions/checkout@v1 |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up Ruby |
| 21 | + uses: ruby/setup-ruby@v1 |
| 22 | + with: |
| 23 | + ruby-version: .ruby-version |
| 24 | + bundler-cache: true |
| 25 | + |
| 26 | + - name: Scan for common Rails security vulnerabilities using static analysis |
| 27 | + run: bin/brakeman --no-pager |
11 | 28 |
|
12 | | - - name: Set the NODE_VERSION env variable from NVM |
13 | | - run: echo NODE_VERSION=$(cat www/.nvmrc) >> $GITHUB_ENV |
| 29 | + lint: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: Checkout code |
| 33 | + uses: actions/checkout@v4 |
14 | 34 |
|
15 | | - - uses: actions/setup-node@v2 |
| 35 | + - name: Set up Ruby |
| 36 | + uses: ruby/setup-ruby@v1 |
16 | 37 | with: |
17 | | - node-version: "${{ env.NODE_VERSION }}" |
| 38 | + ruby-version: .ruby-version |
| 39 | + bundler-cache: true |
18 | 40 |
|
19 | | - - name: Install dependencies |
20 | | - run: cd www && npm install |
| 41 | + - name: Lint code for consistent style |
| 42 | + run: bin/rubocop -f github |
| 43 | + |
| 44 | + test: |
| 45 | + runs-on: ubuntu-latest |
21 | 46 |
|
22 | | - - name: Lint |
23 | | - run: cd www && npm run lint |
| 47 | + # services: |
| 48 | + # redis: |
| 49 | + # image: redis |
| 50 | + # ports: |
| 51 | + # - 6379:6379 |
| 52 | + # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 |
| 53 | + steps: |
| 54 | + - name: Install packages |
| 55 | + run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git pkg-config google-chrome-stable |
| 56 | + |
| 57 | + - name: Checkout code |
| 58 | + uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Set up Ruby |
| 61 | + uses: ruby/setup-ruby@v1 |
| 62 | + with: |
| 63 | + ruby-version: .ruby-version |
| 64 | + bundler-cache: true |
| 65 | + |
| 66 | + - name: Run tests |
| 67 | + env: |
| 68 | + RAILS_ENV: test |
| 69 | + # REDIS_URL: redis://localhost:6379/0 |
| 70 | + run: bin/rails db:test:prepare test test:system |
| 71 | + |
| 72 | + - name: Keep screenshots from failed system tests |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + if: failure() |
| 75 | + with: |
| 76 | + name: screenshots |
| 77 | + path: ${{ github.workspace }}/tmp/screenshots |
| 78 | + if-no-files-found: ignore |
0 commit comments