This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
forked from geeksforsocialchange/PlaceCal
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (76 loc) · 2.59 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build, Test and Optionally Deploy
on: [push, pull_request, workflow_dispatch]
# According to: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
# Both Node and Yarn should be installed already
# This would ideally be split up into dependent jobs maybe, but this is a direct conversion of the travis script for now
jobs:
test:
runs-on: ubuntu-20.04
env:
NODE_ENV: test
services:
postgres:
image: postgres:13.4 # Same version as on the server
env:
POSTGRES_DB: placecal_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: foobar
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: >- # Health options to wait until postgres has started
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout Repository
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with: # ruby version specified in .ruby-version
bundler-cache: true # Automagically runs bundle install
cache-version: 2 # Invalidate originally used corrupted cache
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14.15.0
cache: yarn
env:
NODE_ENV: test
- name: Setup Yarn Dependencies
run: |
yarn install --immutable
env:
NODE_ENV: test
- name: Do Tests
run: |
bundle exec rails webpacker:compile
bundle exec rake
env:
POSTGRES_USER: postgres
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
PGPASSWORD: foobar
# Why was this run as the after-success step in travis?
# - name: Precompile Assets
# run: |
# bundle exec rails assets:precompile
- name: Deploy To Staging
if: ${{ github.ref == 'refs/heads/main' }}
uses: dokku/github-action@master
with:
git_remote_url: 'ssh://[email protected]:666/placecal'
ssh_private_key: ${{ secrets.CI_STAGING_KEY }}
branch: main
ci_branch_name: main
- name: Deploy To Production
if: ${{ github.ref == 'refs/heads/production' }}
uses: dokku/github-action@master
with:
git_remote_url: 'ssh://[email protected]:666/placecal'
ssh_private_key: ${{ secrets.CI_PRODUCTION_KEY }}
branch: main
ci_branch_name: production