-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Extract tests from the CI workflow into a reusable workflow and call it from the original - Add a deploy workflow to automatically deploy to Fly.io - Call the reusable test workflow from the deploy workflow
- Loading branch information
1 parent
2314d8a
commit 82fd135
Showing
3 changed files
with
46 additions
and
25 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 |
---|---|---|
@@ -1,27 +1,5 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
on: pull_request | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
redis: | ||
image: redis | ||
ports: ['6379:6379'] | ||
options: --entrypoint redis-server | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.2.2 | ||
- name: Build and run tests | ||
env: | ||
REDIS_URL: redis://localhost:6379/0 | ||
RAILS_ENV: test | ||
run: | | ||
sudo apt-get -yqq install libpq-dev | ||
gem install bundler | ||
bundle install --jobs 4 --retry 3 | ||
bundle exec rails db:prepare | ||
bundle exec rails test:all | ||
bundle exec rspec | ||
call-test: | ||
uses: ./.github/workflows/test.yml |
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,17 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
call-test: | ||
uses: ./.github/workflows/test.yml | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
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,26 @@ | ||
on: workflow_call | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
redis: | ||
image: redis | ||
ports: ['6379:6379'] | ||
options: --entrypoint redis-server | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.2.2 | ||
- name: Build and run tests | ||
env: | ||
REDIS_URL: redis://localhost:6379/0 | ||
RAILS_ENV: test | ||
run: | | ||
sudo apt-get -yqq install libpq-dev | ||
gem install bundler | ||
bundle install --jobs 4 --retry 3 | ||
bundle exec rails db:prepare | ||
bundle exec rails test:all | ||
bundle exec rspec |