Skip to content

Commit 5015dc6

Browse files
committed
run test on GitHub Actions
1 parent 840bfd2 commit 5015dc6

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

.github/workflows/_test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Test
2+
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v5
8+
- run: docker compose up -d --wait db
9+
- uses: sorah-rbpkg/actions@v2
10+
with:
11+
ruby-version-file: .ruby-version
12+
bundler-cache: true
13+
- run: bundle exec rspec -f j -o tmp/rspec_results.json -f d spec
14+
- uses: SonicGarden/rspec-report-action@v6
15+
if: always()
16+
with:
17+
json-path: tmp/rspec_results.json

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ on:
33
push:
44
branches:
55
- master
6+
- main
67
- test
78

89
jobs:
10+
test:
11+
uses: ./.github/workflows/_test.yml
912
build:
1013
name: build
1114
permissions:
@@ -46,7 +49,7 @@ jobs:
4649
tags: "${{ steps.login-ecr.outputs.registry }}/sponsor-app:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/sponsor-app:latest"
4750

4851
deploy-prod:
49-
if: "${{ success() && github.event_name == 'push' }}"
52+
if: "${{ success() && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }}"
5053
name: deploy-prod
5154
needs: ["build"]
5255
permissions:

.github/workflows/pr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: pr
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
uses: ./.github/workflows/_test.yml

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.2

0 commit comments

Comments
 (0)