add penza winter image #1937
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CI-CD" | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
security: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2.2 | |
bundler-cache: true | |
- name: Security audit dependencies | |
run: bundle exec bundler-audit --update | |
- name: Security audit application code | |
run: bundle exec brakeman -q -w2 | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2.2 | |
- name: Install packages | |
run: | | |
bundle config set --local only test | |
bundle install | |
- name: Lint Ruby files | |
run: rubocop --fail-fast | |
test: | |
needs: | |
- security | |
- lint | |
runs-on: ubuntu-22.04 | |
services: | |
postgres: | |
image: postgres:17.2-alpine | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: rails_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
env: | |
CI: true | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" | |
TZ: "Europe/Moscow" | |
COVERAGE: on | |
BULLET_ENABLED: true | |
APP_HOST: "test.ru" | |
ADMIN_EMAIL: "[email protected]" | |
INFO_EMAIL: "[email protected]" | |
BOT_TOKEN: "123456:test" | |
VK_TOKEN: ${{ secrets.VK_TOKEN }} | |
VK_ALBUM_ID: 300954831 | |
VK_GROUP_ID: 220002708 | |
MOBILE_API_KEY: '1234abcd' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y libvips | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2.2 | |
bundler-cache: true | |
- name: Set up database schema | |
run: cp config/additional_events.yml.example config/additional_events.yml && bin/rails db:schema:load | |
- name: Check database consistency | |
run: bundle exec database_consistency | |
- name: Rspec tests | |
if: github.ref != 'refs/heads/master' | |
run: bundle exec rspec | |
- name: Test & publish code coverage | |
if: github.ref == 'refs/heads/master' | |
uses: paambaati/codeclimate-action@v9 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE }} | |
with: | |
coverageCommand: bundle exec rspec | |
deploy: | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2.2 | |
bundler-cache: true | |
- name: Deploy | |
uses: miloserdow/capistrano-deploy@master | |
with: | |
target: production | |
deploy_key: ${{ secrets.DEPLOY_ENC_KEY }} | |
env: | |
APP_NAME: ${{ secrets.APP_NAME }} | |
APP_REPO: ${{ secrets.APP_REPO }} | |
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} | |
DEPLOY_USER: ${{ secrets.DEPLOY_USER }} | |
APP_DEPLOY_PATH: ${{ secrets.APP_DEPLOY_PATH }} |