This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
forked from subvisual/heritage-fund
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (100 loc) · 3.24 KB
/
continuous-integration-workflow.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Continuous Integration
on:
push:
branches:
- master
tags:
- '*'
pull_request:
types: [opened, synchronize]
jobs:
build:
name: Build, test and deploy (on master only)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: funding_frontend_test
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: 'Install Postgres client'
run: sudo apt-get -yqq install libpq-dev
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: '16.14.2'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: gem install bundler -v 2.3.11
- name: Cache Gemfile dependencies
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run RSpec automated test suite
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
RAILS_ENV: test
run: |
bin/rails db:setup
bundle exec rspec
- name: Run Jest automated test suite
run: |
yarn jest
- name: Install the CF CLI
if: github.ref == 'refs/heads/master'
run: |
wget https://s3-us-west-1.amazonaws.com/v7-cf-cli-releases/releases/v7.2.0/cf7-cli-installer_7.2.0_x86-64.deb
sudo dpkg -i cf7-cli-installer_7.2.0_x86-64.deb
- name: Authenticate with CloudFoundry
if: github.ref == 'refs/heads/master'
env:
CF_USERNAME: ${{ secrets.CF_USERNAME }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
run: |
cf api https://api.london.cloud.service.gov.uk
cf auth
cf target -o national-lottery-heritage-fund
- name: Deploy to staging
if: github.ref == 'refs/heads/master'
env:
CF_APP: funding-frontend-staging
CF_SPACE: sandbox
CF_MANIFEST: staging
run: |
cf target -s ${CF_SPACE}
cf push ${CF_APP} -f manifest-${CF_MANIFEST}.yml --strategy rolling
- name: Deploy to UAT
if: github.ref == 'refs/heads/master'
env:
CF_APP: funding-frontend-uat
CF_SPACE: uat
CF_MANIFEST: uat
run: |
cf target -s ${CF_SPACE}
cf push ${CF_APP} -f manifest-${CF_MANIFEST}.yml --strategy rolling