Skip to content

Merge branch 'develop' into 866-refresh-new-category #1365

Merge branch 'develop' into 866-refresh-new-category

Merge branch 'develop' into 866-refresh-new-category #1365

Workflow file for this run

name: CI
on:
push:
pull_request:
branches:
- develop
- master
types:
- closed
release:
types: [published]
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.5
bundler-cache: true
cache-version: 1
- name: Run rubocop
run: |
bundle exec rubocop
rspec:
needs: rubocop
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: password
POSTGRES_DB: zero_waste_test
ports:
- 5432:5432
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: postgres://test:password@localhost:5432/zero_waste_test
USE_STATIC_ASSETS: true
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.5
bundler-cache: true
- name: Update packages
run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get install -y libvips42 libvips-dev imagemagick
- uses: actions/setup-node@v1
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- uses: nanasess/setup-chromedriver@master
- name: Prepare config
run: |
mv config/database.yml.docker config/database.yml
- name: Precompile assets
run: |
bundle exec rails assets:precompile
- name: Run tests
run: |
bundle exec rspec ./spec -f j -o tmp/rspec_results.json -f p
- name: RSpec Report
uses: SonicGarden/rspec-report-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
json-path: tmp/rspec_results.json
if: always()
deploy-to-staging:
needs: rspec
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.5
bundler-cache: true
- uses: miloserdow/capistrano-deploy@v3
with:
target: development
deploy_key: ${{ secrets.DEV_DEPLOY_KEY }}
enc_rsa_key_pth: config/credentials/deploy_id_ed25519_enc
deploy-to-production:
needs: rspec
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.5
bundler-cache: true
- uses: miloserdow/capistrano-deploy@v3
with:
target: production
deploy_key: ${{ secrets.PROD_DEPLOY_KEY }}