-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (101 loc) · 3.11 KB
/
test_app.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
on:
workflow_call:
inputs:
ruby_version:
description: 'Ruby Version'
default: "3.2.2"
required: false
type: string
test_command:
description: 'The testing command to be ran'
required: true
type: string
chrome_version:
description: 'Chrome & Chromedriver version'
required: false
default: "126.0.6478.182"
type: string
jobs:
build_app:
name: Test
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
RUBYOPT: '-W:no-deprecated'
services:
validator:
image: ghcr.io/validator/validator:latest
ports: ["8888:8888"]
postgres:
image: postgres:14
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: postgres
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
- run: |
sudo apt update
sudo apt install libu2f-udev
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${{inputs.chrome_version}}-1_amd64.deb
sudo dpkg -i /tmp/chrome.deb
rm /tmp/chrome.deb
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: ${{inputs.chrome_version}}
name: Install Chrome version ${{inputs.chrome_version}}
- uses: actions/cache@v4
id: app-cache
with:
path: ./spec/decidim_dummy_app/
key: app-${{ github.sha }}
restore-keys: app-${{ github.sha }}
- run: |
bundle install
bundle exec rake db:create db:schema:load
name: Install gems and create db
shell: "bash"
working-directory: ./spec/decidim_dummy_app/
- run: |
sudo Xvfb -ac $DISPLAY -screen 0 1920x1084x24 > /dev/null 2>&1 & # optional
${{ inputs.test_command }}
name: RSpec
working-directory: ./
env:
VALIDATOR_HTML_URI: http://localhost:8888/
RUBY_VERSION: ${{ inputs.ruby_version }}
DECIDIM_MODULE: "decidim-module-additional_authorization_handler"
DISPLAY: ":99"
CI: "true"
SIMPLECOV: "true"
SHAKAPACKER_RUNTIME_COMPILE: "false"
NODE_ENV: "test"
- uses: codecov/codecov-action@v3
name: Upload coverage
- uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
if-no-files-found: ignore
overwrite: true