mirror of https://github.com/docusealco/docuseal
Updated CI workflow to include deployment step and removed redundant jobs.pull/624/head
parent
450ac8e649
commit
0433b47982
@ -1,179 +1,27 @@
|
|||||||
---
|
name: Prod Pipeline
|
||||||
name: CI
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rubocop:
|
Deploy:
|
||||||
name: Rubocop
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install Ruby
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: 3.4.2
|
|
||||||
- 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:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout code
|
||||||
- name: Install Ruby
|
uses: actions/checkout@v4
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: 3.4.2
|
|
||||||
- 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.9.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: Deploy
|
||||||
name: Brakeman
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
runs-on: ubuntu-latest
|
with:
|
||||||
timeout-minutes: 10
|
host: ${{ secrets.SERVER_IP }}
|
||||||
steps:
|
username: ${{ secrets.SERVER_USER }}
|
||||||
- uses: actions/checkout@v4
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
- name: Install Ruby
|
port: ${{ secrets.SERVER_SSH_PORT }}
|
||||||
uses: ruby/setup-ruby@v1
|
script: |
|
||||||
with:
|
cd ${{ secrets.PROD_PATH }}
|
||||||
ruby-version: 3.4.2
|
git stash && git pull
|
||||||
- name: Cache gems
|
docker compose down
|
||||||
uses: actions/cache@v4
|
docker compose up -d --build
|
||||||
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
|
|
||||||
- name: Run Brakeman
|
|
||||||
run: bundle exec brakeman -q --exit-on-warn
|
|
||||||
|
|
||||||
rspec:
|
|
||||||
name: RSpec
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:14
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: docuseal_test
|
|
||||||
ports: ["5432:5432"]
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install Ruby
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: 3.4.2
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 20.9.0
|
|
||||||
- name: Install Chrome
|
|
||||||
uses: browser-actions/setup-chrome@latest
|
|
||||||
with:
|
|
||||||
chrome-version: 125
|
|
||||||
- name: Cache node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
- 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 dependencies
|
|
||||||
env:
|
|
||||||
RAILS_ENV: test
|
|
||||||
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 -y libvips
|
|
||||||
wget -O pdfium-linux.tgz "https://github.com/docusealco/pdfium-binaries/releases/latest/download/pdfium-linux-$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/').tgz"
|
|
||||||
sudo tar -xzf pdfium-linux.tgz --strip-components=1 -C /usr/lib lib/libpdfium.so
|
|
||||||
rm -f pdfium-linux.tgz
|
|
||||||
- name: Run
|
|
||||||
env:
|
|
||||||
RAILS_ENV: test
|
|
||||||
NODE_ENV: test
|
|
||||||
COVERAGE: true
|
|
||||||
DATABASE_URL: postgres://postgres:postgres@localhost:5432/docuseal_test
|
|
||||||
run: |
|
|
||||||
bundle exec rake db:create
|
|
||||||
bundle exec rake db:migrate
|
|
||||||
bundle exec rake assets:precompile
|
|
||||||
bundle exec rspec
|
|
||||||
|
|||||||
Loading…
Reference in new issue