From 702dd457b2bd0cb67949925faf0d9dfba3e9bf6e Mon Sep 17 00:00:00 2001 From: Shigenobu Nishikawa Date: Sat, 10 Jul 2021 14:40:18 +0900 Subject: [PATCH 1/4] replace travis with github actions and heroku integration --- .github/workflows/test.yml | 35 ++++++++++++++++++++++++++++++++++ .travis.yml | 39 -------------------------------------- Procfile | 1 + scripts/release.sh | 7 +++++++ 4 files changed, 43 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml create mode 100644 scripts/release.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..ca9021aa7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: actions +on: + push: + branches: + - master + pull_request: + branches: + - "*" +jobs: + test: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:10.4-alpine + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: prepare db + run: | + bundle exec rails db:create + bundle exec rails db:setup + - name: rspec + run: bundle exec rails spec + env: + TZ: Asia/Tokyo + SCRIVITO_TENANT: ${{ secrets.SCRIVITO_TENANT }} + SCRIVITO_API_KEY: ${{ secrets.SCRIVITO_API_KEY }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 78cc31c02..000000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: ruby -dependencies: - cache_directories: - - public/assets - - tmp/cache/assets -deploy: - provider: heroku - api_key: - secure: N82OyI5dr8Li2JRg1l/WJXDjEKyLCxerQx1YGZcR16Ui97sCiG57liGpUKb7S6bUpQJrB0XBSiC197Q+0JgIt6u6gETcPjlvCoHmM04gvxZis8bZtxarT72xHZvE2M8jH++JSkggIc9kcU01YYuKZTK74rWVajCoYzvauJLjVHu9GyYxuST/j/mbQTcHpXCQIXADlKYuzvtOYexB74dmNU04Zc9Tlbgd11N8PPCmQEplW1j6h01px+8a8xSyt/zNQCN6uX+ELC6lxj7ZH4o9/GutcLrfY6hhM3xy9B/MuaUmY58hOLngx8Du/BZGC4+x4KHADoGFqnEWwO2Pvx8aTcI+hfQtrsAn6KpOMNEcVM7x1gbUShM5e3I+AFiXILKfCrsLdINPXmWQZTgL8j8EgSe2hd0TKZPoHAsbifwtyf0XUVFRjccjQNDKuXtovPoYBabZ0R+nJnbXxPfCNJMfwCFDc7dDliWCN91dkWJSiHYth+1+zcHx5R4ItvOxjqJmtiYDvLMKkYLnKLtM9gtR5TuhO9hv6jDLHMNp25PWQP92anNdVITD3jh8EpGebiZb5qpmQMnK3U2ltS63Q7cApzAHzT1Y+vPnhPeeidk2TmgMGr9XS822mCmFmwzmaJteVx/JcsA/iw0lcqALvZaZW67hQV9c9YZjMp3a+iWKNmY= - app: - master: coderdojo-japan - run: - - bundle exec rails db:migrate - - bundle exec rails db:seed - - bundle exec rails dojos:update_db_by_yaml - - bundle exec rails dojo_event_services:upsert - - bundle exec rails podcasts:upsert -cache: -- bundler -before_install: -- gem install bundler -before_script: -- psql -c 'create database coderdojo_jp_test;' -U postgres -script: -- bundle exec rake db:migrate --trace -- bundle exec rake db:seed --trace -- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bundle exec rspec spec; fi -- if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_PULL_REQUEST_SLUG" = "coderdojo-japan/coderdojo.jp" - ]; then bundle exec rspec spec; fi -- if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_PULL_REQUEST_SLUG" != "coderdojo-japan/coderdojo.jp" - ]; then bundle exec rspec spec --tag ~@scrivito; fi -env: - global: - - TZ='Asia/Tokyo' -addons: - postgresql: '9.4' -branches: - only: - - master diff --git a/Procfile b/Procfile index c2c566e8c..37d87c6da 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,2 @@ web: bundle exec puma -C config/puma.rb +release: ./scripts/release.sh diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 000000000..bea511eb8 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,7 @@ +set -e + +bundle exec rails db:migrate +bundle exec rails db:seed +bundle exec rails dojos:update_db_by_yaml +bundle exec rails dojo_event_services:upsert +bundle exec rails podcasts:upsert From 2844ddaa504f6671a2718c644e1e0050860febfc Mon Sep 17 00:00:00 2001 From: Shigenobu Nishikawa Date: Sat, 10 Jul 2021 15:08:20 +0900 Subject: [PATCH 2/4] ruby-version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca9021aa7..616308be0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: fetch-depth: 1 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 2.7.3 bundler-cache: true - name: prepare db run: | From 36e125acb662b47aec7ef2a7416b5819e18ae251 Mon Sep 17 00:00:00 2001 From: Shigenobu Nishikawa Date: Sat, 10 Jul 2021 15:17:45 +0900 Subject: [PATCH 3/4] specify db default --- .github/workflows/test.yml | 2 +- config/database.yml | 8 ++++---- docker-compose.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 616308be0..cd0fe98be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: test: runs-on: ubuntu-latest services: - postgres: + db: image: postgres:10.4-alpine env: POSTGRES_USER: postgres diff --git a/config/database.yml b/config/database.yml index 1320279da..7e0512e86 100644 --- a/config/database.yml +++ b/config/database.yml @@ -20,10 +20,10 @@ default: &default # For details on connection pooling, see Rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - username: <%= ENV.fetch('DATABASE_USER') { '' } %> - password: <%= ENV.fetch('DATABASE_PASSWORD') { '' } %> - host: <%= ENV.fetch('DATABASE_HOST') { '' } %> - port: <%= ENV.fetch('DATABASE_PORT') { '' } %> + username: <%= ENV.fetch('DATABASE_USER') { 'postgres' } %> + password: <%= ENV.fetch('DATABASE_PASSWORD') { 'password' } %> + host: <%= ENV.fetch('DATABASE_HOST') { 'db' } %> + port: <%= ENV.fetch('DATABASE_PORT') { '5432' } %> development: <<: *default diff --git a/docker-compose.yml b/docker-compose.yml index 95b4b9786..f055e0467 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: depends_on: - db db: - image: "postgres:10.4" + image: "postgres:10.4-alpine" environment: - "POSTGRES_USER=postgres" - "POSTGRES_PASSWORD=password" From 3b9268b35abfcd17bc74f7a9020502eabab13057 Mon Sep 17 00:00:00 2001 From: Shigenobu Nishikawa Date: Sat, 10 Jul 2021 15:25:24 +0900 Subject: [PATCH 4/4] specify ports for actions db --- .github/workflows/test.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd0fe98be..f395ad0aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,9 +9,18 @@ on: jobs: test: runs-on: ubuntu-latest + env: + DATABASE_HOST: localhost + TZ: Asia/Tokyo + SCRIVITO_EMAIL: test@example.com + SCRIVITO_PASSWORD: testpassword + SCRIVITO_TENANT: ${{ secrets.SCRIVITO_TENANT }} + SCRIVITO_API_KEY: ${{ secrets.SCRIVITO_API_KEY }} services: db: image: postgres:10.4-alpine + ports: + - 5432:5432 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password @@ -29,7 +38,3 @@ jobs: bundle exec rails db:setup - name: rspec run: bundle exec rails spec - env: - TZ: Asia/Tokyo - SCRIVITO_TENANT: ${{ secrets.SCRIVITO_TENANT }} - SCRIVITO_API_KEY: ${{ secrets.SCRIVITO_API_KEY }} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy