-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #298 from openstax/dotenv
New backend deployment
- Loading branch information
Showing
45 changed files
with
701 additions
and
740 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Migrations | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
migrations: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-18.04 | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
# Set health checks to wait until redis has started | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
# Clone repo and checkout merge commit parent (PR target commit) | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- run: git checkout HEAD^ | ||
|
||
# Install ruby | ||
- uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 | ||
|
||
# Retrieve gem cache for merge commit parent | ||
- uses: actions/cache@v2 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-gems-parent-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems-parent- | ||
# Install gems, create data to be migrated and revert to PR merge commit | ||
- name: Create data to be migrated | ||
env: | ||
OXE_DB_USER: postgres | ||
OXE_DB_PASS: postgres | ||
run: | | ||
gem install bundler | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
bundle exec rake db:create db:schema:load db:seed --trace | ||
bundle exec rails runner '10.times { FactoryBot.create :exercise }' | ||
git checkout - | ||
# Retrieve gem cache for PR merge commit | ||
- uses: actions/cache@v2 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-gems-pr-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems-pr- | ||
# Migrate the data | ||
- name: Migrate | ||
env: | ||
OXE_DB_USER: postgres | ||
OXE_DB_PASS: postgres | ||
run: | | ||
bundle install --jobs 4 --retry 3 | ||
bundle exec rake db:migrate |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 0 * * 0' # weekly | ||
|
||
jobs: | ||
tests: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-18.04 | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: ci_test | ||
POSTGRES_PASSWORD: postgres | ||
strategy: | ||
matrix: | ||
tests: | ||
- name: 'assets' | ||
args: 'ASSETS=true' | ||
- name: 'tests' | ||
args: 'ASSETS=false' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-gems-pr-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems-pr- | ||
- name: Test | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
OXT_DB_USER: postgres | ||
OXT_TEST_DB: ci_test | ||
OXT_DB_PASS: postgres | ||
RAILS_ENV: test | ||
run: | | ||
gem install bundler | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
${{ matrix.tests.args }} ./bin/ci |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,94 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile ~/.gitignore_global | ||
*.rbc | ||
capybara-*.html | ||
.rspec | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
/db/*.sqlite3-[0-9]* | ||
/public/system | ||
/coverage/ | ||
/spec/tmp | ||
*.orig | ||
rerun.txt | ||
pickle-email-*.html | ||
|
||
# Ignore bundler config | ||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo | ||
config/initializers/secret_token.rb | ||
config/master.key | ||
|
||
# Only include if you have production secrets in this file, which is no longer a Rails default | ||
# config/secrets.yml | ||
|
||
# dotenv, dotenv-rails | ||
# TODO Comment out these rules if environment variables can be committed | ||
.env | ||
.env.* | ||
|
||
## Environment normalization: | ||
/.bundle | ||
/vendor/bundle | ||
|
||
# Ignore installed gems | ||
vendor | ||
# these should all be checked in to normalize the environment: | ||
# Gemfile.lock, .ruby-version, .ruby-gemset | ||
|
||
# Ignore the default SQLite database and yaml_db database files | ||
/db/*.sqlite3* | ||
/db/data.yml* | ||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
.rvmrc | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/*.log | ||
/tmp/**/* | ||
# if using bower-rails ignore default bower_components path bower.json files | ||
/vendor/assets/bower_components | ||
*.bowerrc | ||
bower.json | ||
|
||
# Ignore pow environment settings | ||
.powenv | ||
|
||
# Ignore Byebug command history file. | ||
.byebug_history | ||
|
||
# Ignore node_modules | ||
node_modules/ | ||
|
||
# Ignore files containing keys and passwords | ||
config/*settings.yml | ||
# Ignore precompiled javascript packs | ||
/public/packs | ||
/public/packs-test | ||
/public/assets | ||
|
||
# Ignore compiled assets and uploaded files | ||
public/assets/**/* | ||
public/attachments/**/* | ||
# Ignore yarn files | ||
/yarn-error.log | ||
yarn-debug.log* | ||
.yarn-integrity | ||
|
||
# Ignore vagrant and berkshelf files | ||
.vagrant* | ||
.vagrant_setup.json | ||
Berksfile.lock | ||
# Ignore uploaded files in development | ||
/storage/* | ||
!/storage/.keep | ||
/public/uploads | ||
|
||
# Ignore attached files in development | ||
/public/attachments | ||
|
||
# Ignore Cucumber and RSpec failure information | ||
cucumber_rerun.txt | ||
rspec.failures | ||
|
||
# Ignore brakeman reports | ||
brakeman.html | ||
# Ignore webdrivers lock file | ||
.webdrivers_update | ||
|
||
# Ignore coverage reports | ||
coverage/* | ||
|
||
# Ignore ERD diagrams | ||
erd*.pdf | ||
|
||
# Ignore misc files | ||
notes | ||
# Ignore brakeman reports | ||
brakeman.html | ||
|
||
# Ignore gedit and OSX temp files | ||
# Ignore editor temp files | ||
*~ | ||
*.DS_Store | ||
|
||
# Ignore dotenv env variable definitions | ||
.env | ||
|
||
# Ignore byebug history | ||
.byebug_history | ||
# Ignore OS X's Desktop Service Store files | ||
*.DS_Store |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.