Skip to content

Commit 37cce29

Browse files
committed
move to compose on gh actions
1 parent fa9ea23 commit 37cce29

File tree

2 files changed

+40
-52
lines changed

2 files changed

+40
-52
lines changed

.github/workflows/test-unit.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
name: test-unit
22
on: [push]
33
jobs:
4-
test-unit:
4+
test:
55
runs-on: ubuntu-latest
6-
76
steps:
8-
- uses: actions/checkout@v2
9-
- name: install docker compose
10-
run: sudo curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
11-
- name: Build and run tests
12-
run: |
13-
docker-compose -f .circleci/compose-unit.yml up -d --wait
14-
timeout 60 bash -c -- 'while [[ "$(docker-compose -f .circleci/compose-unit.yml exec -T rails-unit curl -s -o /dev/null -w ''%{http_code}'' http://localhost:3000/api/v1/health)" != "200" ]]; do sleep 1; printf "."; done'
15-
docker-compose -f .circleci/compose-unit.yml exec -T rails-unit bundle exec rails db:test:prepare
16-
docker-compose -f .circleci/compose-unit.yml exec -T rails-unit bundle exec rspec --format progress
17-
7+
- uses: actions/checkout@latest
8+
- name: compose up
9+
run: |-
10+
docker compose -f docker-compose.unit up -d --wait --build
11+
- name: start recording
12+
run: |-
13+
docker compose -f docker-compose.unit exec rz curl chromevideo:9494/start
14+
- name: run tests
15+
run: |-
16+
docker compose -f docker-compose.unit exec rz rspec
17+
- name: stop recording
18+
run: |-
19+
docker compose -f docker-compose.unit exec rz curl chromevideo:9494/stop
20+
sleep 3
21+
- uses: actions/upload-artifact@v4
22+
with:
23+
name: test-video
24+
path: vidoutput/out.mp4
25+
if-no-files-found: error

.github/workflows/test.yml

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,25 @@ on: [push]
33
jobs:
44
test:
55
runs-on: ubuntu-latest
6-
services:
7-
postgres:
8-
image: postgres
9-
ports:
10-
- 5432:5432
11-
env:
12-
POSTGRES_PASSWORD: postgres
13-
options: >-
14-
--health-cmd pg_isready
15-
--health-interval 10s
16-
--health-timeout 5s
17-
--health-retries 5
18-
redis:
19-
image: redis
20-
ports:
21-
- 6379:6379
22-
options: --entrypoint redis-server
23-
chrome:
24-
image: selenium/standalone-chrome
25-
ports:
26-
- 4444:4444
6+
steps:
7+
- uses: actions/checkout@latest
8+
- name: compose up
9+
run: |-
10+
docker compose up -d --wait --build
11+
- name: start recording
12+
run: |-
13+
docker compose exec rails curl chromevideo:9494/start
14+
- name: run tests
15+
run: |-
16+
docker compose exec rails rspec
17+
- name: stop recording
18+
run: |-
19+
docker compose exec rails curl chromevideo:9494/stop
20+
sleep 3
21+
- uses: actions/upload-artifact@v4
22+
with:
23+
name: test-video
24+
path: vidoutput/out.mp4
25+
if-no-files-found: error
2726

28-
container:
29-
image: ruby:3.3-alpine
3027

31-
steps:
32-
- uses: actions/checkout@v2
33-
- name: Build and run tests
34-
env:
35-
CHROME_HOSTNAME: chrome
36-
DATABASE_URL: postgres://postgres:postgres@postgres:5432/test
37-
REDIS_URL: redis://redis:6379/0
38-
RAILS_ENV: test
39-
run: |
40-
ruby -v
41-
apk --update add build-base git file less postgresql-dev nodejs tzdata curl rust cargo
42-
gem install bundler
43-
bundle install -j $(nproc) --path vendor
44-
bundle exec rails db:create
45-
bundle exec rails db:migrate
46-
bundle exec rails db:test:prepare
47-
TEST_HOST="$(hostname -i)" bundle exec rspec

0 commit comments

Comments
 (0)