174 lines
5.2 KiB
YAML
174 lines
5.2 KiB
YAML
---
|
|
name: CI
|
|
on: [push]
|
|
|
|
jobs:
|
|
rubocop:
|
|
name: Rubocop
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 4.0.5
|
|
- name: Cache gems
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/bundle
|
|
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gem-
|
|
- name: Install gems
|
|
run: |
|
|
gem install bundler
|
|
bundle config path vendor/bundle
|
|
bundle install --jobs 4 --retry 4
|
|
- name: Run RuboCop
|
|
run: bundle exec rubocop
|
|
|
|
erblint:
|
|
name: Erblint
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 4.0.5
|
|
- name: Cache gems
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/bundle
|
|
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gem-
|
|
- name: Install gems
|
|
run: |
|
|
gem install bundler
|
|
bundle config path vendor/bundle
|
|
bundle install --jobs 4 --retry 4
|
|
- name: Run Erblint
|
|
run: bundle exec erb_lint ./app
|
|
|
|
eslint:
|
|
name: ESLint
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 20.19.0
|
|
- name: Cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
- uses: actions/cache@v4
|
|
id: yarn-cache
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
- name: Install dependencies
|
|
run: |
|
|
yarn install
|
|
- name: Run eslint
|
|
run: |
|
|
./node_modules/eslint/bin/eslint.js "app/javascript/**/*.js"
|
|
|
|
brakeman:
|
|
name: Brakeman
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 4.0.5
|
|
- name: Cache gems
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/bundle
|
|
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gem-
|
|
- name: Install gems
|
|
run: |
|
|
gem install bundler
|
|
bundle config path vendor/bundle
|
|
bundle install --jobs 4 --retry 4
|
|
yarn install
|
|
sudo apt-get update
|
|
sudo apt-get install libvips liblept5
|
|
- name: Run Brakeman
|
|
run: bundle exec brakeman -q --exit-on-warn
|
|
|
|
rspec:
|
|
name: RSpec
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
container:
|
|
image: ruby:4.0.5-alpine
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: docuseal_test
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres -d docuseal_test"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- name: Install packages
|
|
run: apk add --no-cache build-base git libpq-dev yaml-dev nodejs yarn tar zstd gzip wget unzip vips leptonica chromium
|
|
- uses: actions/checkout@v4
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-musl-node-${{ hashFiles('**/yarn.lock') }}
|
|
- name: Cache gems
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor/bundle
|
|
key: ${{ runner.os }}-musl-gem-${{ hashFiles('**/Gemfile.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-musl-gem-
|
|
- name: Install dependencies
|
|
env:
|
|
RAILS_ENV: test
|
|
run: |
|
|
gem install bundler
|
|
bundle config path vendor/bundle
|
|
bundle install --jobs 4 --retry 4
|
|
yarn install
|
|
wget -O pdfium-linux.zip "https://github.com/docusealco/pdfium-binaries/releases/download/20260813/pdfium-musl-$(uname -m).zip"
|
|
case "$(uname -m)" in
|
|
x86_64) echo "c5c7dde243ecb66ab0819c8193515ef38ad53549fe260f3c2dfd93ea56eda2e7 pdfium-linux.zip" ;;
|
|
aarch64) echo "64c4483449b1b4dccc696ad0c5c96e0b7f74dcc57b4f23c676b7a70671b0bbb5 pdfium-linux.zip" ;;
|
|
esac | sha256sum -c -
|
|
unzip -q pdfium-linux.zip -d /tmp/pdfium-linux
|
|
cp /tmp/pdfium-linux/lib/libpdfium.so /usr/lib/libpdfium.so
|
|
rm -rf pdfium-linux.zip /tmp/pdfium-linux
|
|
- name: Run
|
|
env:
|
|
RAILS_ENV: test
|
|
NODE_ENV: test
|
|
COVERAGE: true
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/docuseal_test
|
|
run: |
|
|
bundle exec rake db:create
|
|
bundle exec rake db:migrate
|
|
bundle exec rake assets:precompile
|
|
bundle exec rspec
|