-
Notifications
You must be signed in to change notification settings - Fork 8
134 lines (109 loc) · 3.67 KB
/
build.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: efolder_rake
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
env:
FORCE_COLOR: "1" #Forces color within GHA - Note RSPEC still won't use color see line 199 --tty for rspec color
jobs:
rake:
runs-on: ubuntu-8-cores-latest
services:
postgres:
image: postgres:14.8
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
POSTGRES_DB: caseflow_efolder_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:4.0.10
ports:
- 6379:6379
localstack:
image: localstack/localstack:0.12.5
container:
image: 065403089830.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers
options: --privileged # Necessary for Rspec to run with our configuration within GHA. Needed for rspec step to prevent chromedriver issue
credentials:
username: AWS
password: ${{ secrets.VAEC_ECR_PASSWORD }}
env:
DBUS_SESSION_BUS_ADDRESS: /dev/null
RAILS_ENV: test
BUNDLE_PATH: vendor/bundle
POSTGRES_HOST: postgres
POSTGRES_USER: root
POSTGRES_PASSWORD: password
WD_INSTALL_DIR: .webdrivers
CI: true
REDIS_URL_CACHE: redis://redis:6379/0/cache/
steps:
- uses: actions/checkout@v3
- name: install node version
uses: actions/setup-node@v4
with:
node-version: '16.16.0'
- name: Install Chrome
run: |
apt-get update
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt install -y /tmp/chrome.deb \
&& rm /tmp/chrome.deb
echo "Chrome exe name: $(ls /usr/bin | chrome)"
echo "Chrome version: $(google-chrome --version)"
- name: Ruby version
run: ruby -v
- name: Configure Bundler
run: |-
BUNDLER_V=$(cat ./Gemfile.lock | tail -1 | tr -d " ")
echo $BUNDLER_V
gem install bundler:$BUNDLER_V
- name: Bundle install
run: bundle install --path vendor/bundle
- name: yarn install
run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile"
- name: Yarn build
run: yarn run build
working-directory: "./client"
- name: Database setup
run: |-
./ci-bin/capture-log "RAILS_ENV=test bundle exec rake db:create"
./ci-bin/capture-log "RAILS_ENV=test bundle exec rake db:schema:load"
- name: Assets Precompile
run: |
./ci-bin/capture-log "bundle exec rake assets:precompile"
- name: RSpec
run: |-
mkdir -p ./test-results/rspec
mkdir .webdrivers
chmod -R 777 ${GITHUB_WORKSPACE}
set -o pipefail
runuser -u circleci -- make -f Makefile.example test | tee ./test-results/rspec/rspec.out # circleci refers to user
env:
POSTGRES_HOST: postgres
shell: bash
# Artifact Uploads
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
path: "./test-results"
- uses: actions/upload-artifact@v3
if: failure()
with:
path: "./tmp/capybara"
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
path: "./log/test.log"
# Run both Lint and Security since it's not reliant on build process
- name: Lint
run: |-
npm install -g eslint
./ci-bin/capture-log "make -f Makefile.example lint"
if: ${{ always() }}
- name: Security
run: ./ci-bin/capture-log "make -f Makefile.example security"
if: ${{ always() }}