pass key to translation #38
Workflow file for this run
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 | |
on: | |
push: | |
jobs: | |
lint_and_scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Lint code for consistent style | |
run: bin/lint --no-fix | |
- name: Scan for common Rails security vulnerabilities using static analysis | |
run: bin/brakeman --no-pager | |
# Eventually this should be added: | |
# - name: Scan for security vulnerabilities in JavaScript dependencies | |
# run: bin/importmap audit | |
test: | |
name: "Run tests" | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: postgres | |
# needed because the postgres container does not provide a healthcheck | |
# tmpfs makes DB faster by using RAM | |
options: >- | |
--mount type=tmpfs,destination=/var/lib/postgresql/data | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-retries 5 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: --entrypoint redis-server | |
env: | |
RAILS_ENV: test | |
PGHOST: localhost | |
PGPORT: 5432 | |
PGUSER: postgres | |
PGPASSWORD: password | |
TZ: "America/Chicago" | |
COVERAGE: true | |
CC_TEST_REPORTER_ID: 04daa6564351115dc1515504790cd379ad8dc25e7778f0641e0f8c63185f887c | |
TRANSLATION_BRANCH: main | |
RETRY_FLAKY: true | |
steps: | |
- name: Get CPU cores | |
id: cpu-info | |
run: echo "cpu-cores=$(nproc)" >> $GITHUB_OUTPUT | |
# install system dependencies | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install \ | |
google-chrome-stable \ | |
curl \ | |
gettext \ | |
imagemagick \ | |
libvips \ | |
libcurl4-gnutls-dev \ | |
libexpat1-dev \ | |
libssl-dev \ | |
libz-dev \ | |
postgresql-client \ | |
ripgrep | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Install Ruby dependencies | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- run: bundle install | |
- name: Set up database | |
run: bin/rails db:create db:schema:load:primary db:schema:load:analytics db:migrate db:seed | |
- name: Sync translations (only on main by default) | |
run: bin/check_translations ${{ secrets.TRANSLATION_IO_API_KEY }} | |
# Install JS dependencies | |
- name: build assets | |
run: bin/rails assets:precompile --trace | |
# Run tests | |
- name: Run tests | |
run: bundle exec turbo_test | |
- name: publish code coverage | |
uses: paambaati/[email protected] | |
deploy_production: | |
name: "Deploy to production" | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to Cloud66 production | |
run: | | |
curl --insecure -X POST -d "" https://hooks.cloud66.com/stacks/redeploy/${{ secrets.CLOUD66_REDEPLOYMENT_KEY }} |