Skip to content

Commit 19bd3fe

Browse files
committed
🛠️ Journal: Test only the `Journal in CI
While working on zinc-collective#11, I realized I missed a piece of the refactor because I was leaning-on-ci as a way to confirm that everything was working as expected. Little did I know, CI was not working in this fork. Which makes sense, because you don't want to automatically turn on all the Workflows when you fork a project. This adds a Github Workflow for testing *just* the `Journal`, which should make detecting oopsie-daisys a bit easier for folks who are only interested in working on the Journal.
1 parent 7c33d7b commit 19bd3fe

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Test Journal
2+
on: push
3+
4+
env:
5+
POSTGRES_USER: postgres
6+
POSTGRES_PASSWORD: postgres
7+
# Connect to locally-running Maildev for tests
8+
SMTP_PORT: 1025
9+
SMTP_DOMAIN: localhost
10+
SMTP_ENABLE_TLS: false
11+
REDIS_HOST: redis
12+
REDIS_PORT: 6379
13+
HEADLESS: true
14+
AWS_S3_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
15+
AWS_S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
16+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
17+
18+
jobs:
19+
setup:
20+
name: Install and cache dependencies
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v3
26+
27+
- name: Update apt
28+
env:
29+
DEBIAN_FRONTEND: noninteractive
30+
run:
31+
sudo apt-get update -qq -o Acquire::Retries=3
32+
33+
- name: Install libvips
34+
env:
35+
DEBIAN_FRONTEND: noninteractive
36+
run:
37+
# we only need the library
38+
sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
39+
libvips
40+
41+
- name: Setup Ruby and install gems
42+
uses: ruby/setup-ruby@v1
43+
with:
44+
bundler-cache: true
45+
46+
- name: Setup Node with cache
47+
uses: actions/setup-node@v3
48+
with:
49+
node-version: 18
50+
cache: 'yarn'
51+
52+
- name: Install Node dependencies
53+
run: yarn install
54+
55+
test:
56+
name: Run Tests
57+
runs-on: ubuntu-latest
58+
needs: [setup]
59+
60+
services:
61+
postgres:
62+
image: postgres:latest
63+
env:
64+
POSTGRES_USER: postgres
65+
POSTGRES_PASSWORD: postgres
66+
ports:
67+
- 5432:5432
68+
# needed because the postgres container does not provide a healthcheck
69+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
70+
redis:
71+
image: redis
72+
ports:
73+
# Maps port 6379 on service container to the host
74+
- 6379:6379
75+
# Set health checks to wait until redis has started
76+
options: >-
77+
--health-cmd "redis-cli ping"
78+
--health-interval 10s
79+
--health-timeout 5s
80+
--health-retries 5
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v3
84+
85+
- name: Update apt
86+
env:
87+
DEBIAN_FRONTEND: noninteractive
88+
run:
89+
sudo apt-get update -qq -o Acquire::Retries=3
90+
91+
- name: Install libvips
92+
env:
93+
DEBIAN_FRONTEND: noninteractive
94+
run:
95+
# we only need the library
96+
sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
97+
libvips
98+
99+
- name: Install Firefox
100+
uses: browser-actions/setup-firefox@latest
101+
102+
- name: Setup Ruby and install gems
103+
uses: ruby/setup-ruby@v1
104+
with:
105+
bundler-cache: true
106+
107+
- name: Setup Node with cache
108+
uses: actions/setup-node@v3
109+
with:
110+
node-version: 18
111+
cache: 'yarn'
112+
113+
- name: Allow Ruby process to access port 80
114+
run: sudo setcap 'cap_net_bind_service=+ep' `which ruby`
115+
116+
- name: Setup CI database.yml
117+
run: cp config/database.yml.github-actions config/database.yml
118+
119+
- name: Setup rails
120+
run: bin/setup-rails && bin/rails assets:precompile
121+
122+
- name: Run Tests
123+
env:
124+
HEADLESS: true
125+
run: bundle exec rspec spec/furniture/journal
126+
- name: Upload RSpec Screenshots
127+
uses: actions/upload-artifact@v2
128+
if: failure()
129+
with:
130+
name: rspec-failed-screenshot
131+
path: tmp/capybara/*.png
132+
133+
lint:
134+
name: Run style checks
135+
runs-on: ubuntu-latest
136+
needs: [setup]
137+
138+
steps:
139+
- name: Checkout code
140+
uses: actions/checkout@v3
141+
142+
- name: Setup Ruby and install gems
143+
uses: ruby/setup-ruby@v1
144+
with:
145+
bundler-cache: true
146+
147+
- name: Setup Node with cache
148+
uses: actions/setup-node@v3
149+
with:
150+
node-version: 18
151+
cache: 'yarn'
152+
153+
- name: Install Node dependencies
154+
run: yarn install
155+
156+
- run: bundle exec rubocop --parallel --config .rubocop.yml
157+
- run: yarn prettier --check "./**/*.{scss,css,js}"

0 commit comments

Comments
 (0)