[feature] email tracking opt-in #2814
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake | |
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby | |
name: Ruby | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: Violet Rails Build (Ruby - ${{ matrix.ruby_version }}, Node.js - ${{ matrix.node_version }}) | |
runs-on: ubuntu-latest | |
env: | |
RUBY_BUILD: ${{ matrix.ruby_version }} | |
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | |
services: | |
db: | |
image: postgres:12.3-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: password | |
POSTGRES_USER: postgres | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
redis: | |
image: redis:4.0-alpine | |
ports: | |
- 6379:6379 | |
strategy: | |
matrix: | |
node_version: [14.x, 10.x] | |
ruby_version: [2.6.6, 3.0.0] | |
steps: | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Install App dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -yqq install libxml2-dev libxslt-dev nodejs yarn tzdata less imagemagick libpq-dev postgresql-client jq bc | |
- uses: actions/checkout@v3 | |
- name: Set Environment Variables | |
run: cat ci_env.cfg >> $GITHUB_ENV | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} # Not needed with a .ruby-version file (2.6.6) but it's good to be clear here | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Fetch schema file before running migration | |
run: | | |
tmpfile=$(mktemp) | |
cp ./db/schema.rb tmpfile | |
- name: Setup main DB | |
run: | | |
bin/rails db:create | |
bin/rails db:migrate | |
- name: Comparing schema.rb to db/migrations | |
run: | | |
if ! diff -q tmpfile ./db/schema.rb &>/dev/null; then | |
echo diff -q tmpfile ./db/schema.rb | |
rm tmpfile | |
>&2 echo "Migration changes have not been committed." | |
# Exits the github workflow | |
exit 1 | |
fi | |
rm tmpfile | |
echo "Migrations have been committed." | |
- name: compile assets/javascript | |
run: | | |
yarn install | |
bin/rails assets:precompile | |
- name: compile ember client | |
run: | | |
cd client | |
npm install -g ember-cli | |
- name: Run Tests | |
run: bin/rails test -f | |
- name: Save code coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report(Ruby - ${{ matrix.ruby_version }}, Node.js - ${{ matrix.node_version }}) | |
path: coverage/ |