55 CI : " true"
66 RUBY_VERSION : 3.1.1
77 NODE_VERSION : 18.17.1
8- CHROME_VERSION : 126.0.6478.182
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.head_ref || github.ref }}
11+ cancel-in-progress : true
912
1013jobs :
14+ build_app :
15+ uses : ./.github/workflows/build_app.yml
16+ secrets : inherit
17+ name : Build test application
18+
1119 lint :
20+ name : Lint code
1221 runs-on : ubuntu-latest
22+ timeout-minutes : 60
1323 steps :
1424 - uses : actions/checkout@v3
1525 with :
@@ -25,132 +35,11 @@ jobs:
2535 name : Lint Ruby files
2636 - run : bundle exec erblint app/**/*.erb
2737 name : Lint ERB files
38+
2839 tests :
2940 name : Tests
30- runs-on : ubuntu-latest
31- timeout-minutes : 30
32- services :
33- postgres :
34- image : postgres:11
35- ports : ["5432:5432"]
36- options : >-
37- --health-cmd pg_isready
38- --health-interval 10s
39- --health-timeout 5s
40- --health-retries 5
41- env :
42- POSTGRES_PASSWORD : postgres
43- env :
44- DATABASE_USERNAME : postgres
45- DATABASE_PASSWORD : postgres
46- DATABASE_HOST : localhost
47- steps :
48- - uses : rokroskar/workflow-run-cleanup-action@v0.3.0
49- if : " github.ref != 'refs/heads/develop'"
50- env :
51- GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
52- - uses : actions/checkout@v3
53- with :
54- fetch-depth : 1
55- - uses : ruby/setup-ruby@v1
56- with :
57- bundler-cache : true
58- - uses : actions/setup-node@v3
59- with :
60- node-version : ${{ env.NODE_VERSION }}
61- - name : Get npm cache directory path
62- id : npm-cache-dir-path
63- run : echo "::set-output name=dir::$(npm get cache)-extra_user_fields"
64- - uses : actions/cache@v3
65- id : npm-cache
66- with :
67- path : ${{ steps.npm-cache-dir-path.outputs.dir }}
68- key : npm-${{ hashFiles('**/package-lock.json') }}
69- restore-keys : |
70- npm-
71- - run : bundle exec rake test_app
72- name : Create test app
73- - run : mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
74- name : Create the screenshots folder
75- - uses : nanasess/setup-chromedriver@v2
76- - run : RAILS_ENV=test bundle exec rails assets:precompile
77- name : Precompile assets
78- working-directory : ./spec/decidim_dummy_app/
79- - run : bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb"
80- name : RSpec
81- - uses : codecov/codecov-action@v3
82- - uses : actions/upload-artifact@v3
83- if : always()
84- with :
85- name : screenshots
86- path : ./spec/decidim_dummy_app/tmp/screenshots
87- if-no-files-found : ignore
88- system-tests :
89- name : System tests
90- runs-on : ubuntu-latest
91- timeout-minutes : 30
92- services :
93- postgres :
94- image : postgres:11
95- ports : ["5432:5432"]
96- options : >-
97- --health-cmd pg_isready
98- --health-interval 10s
99- --health-timeout 5s
100- --health-retries 5
101- env :
102- POSTGRES_PASSWORD : postgres
103- env :
104- DATABASE_USERNAME : postgres
105- DATABASE_PASSWORD : postgres
106- DATABASE_HOST : localhost
107- steps :
108- - uses : rokroskar/workflow-run-cleanup-action@v0.3.0
109- if : " github.ref != 'refs/heads/develop'"
110- env :
111- GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
112- - uses : actions/checkout@v3
113- with :
114- fetch-depth : 1
115- - uses : ruby/setup-ruby@v1
116- with :
117- ruby-version : ${{ env.RUBY_VERSION }}
118- bundler-cache : true
119- - run : |
120- sudo apt install libu2f-udev imagemagick
121- wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${{env.CHROME_VERSION}}-1_amd64.deb
122- sudo dpkg -i /tmp/chrome.deb
123- rm /tmp/chrome.deb
124- name: Install Chrome version ${{ env.CHROME_VERSION }}
125- - uses : actions/setup-node@v3
126- with :
127- node-version : ${{ env.NODE_VERSION }}
128- - name : Get npm cache directory path
129- id : npm-cache-dir-path
130- run : echo "dir=$(npm get cache)--extra_user_fields" >> $GITHUB_OUTPUT
131- - uses : actions/cache@v3
132- id : npm-cache
133- with :
134- path : ${{ steps.npm-cache-dir-path.outputs.dir }}
135- key : npm-${{ hashFiles('**/package-lock.json') }}
136- restore-keys : |
137- npm-
138- - run : bundle exec rake test_app
139- name : Create test app
140- - run : mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
141- name : Create the screenshots folder
142- - uses : nanasess/setup-chromedriver@v2
143- with :
144- chromedriver-version : ${{ env.CHROME_VERSION }}
145- - run : RAILS_ENV=test bundle exec rails assets:precompile
146- name : Precompile assets
147- working-directory : ./spec/decidim_dummy_app/
148- - run : bundle exec rspec spec/system
149- name : RSpec
150- - uses : codecov/codecov-action@v3
151- - uses : actions/upload-artifact@v3
152- if : always()
153- with :
154- name : screenshots
155- path : ./spec/decidim_dummy_app/tmp/screenshots
156- if-no-files-found : ignore
41+ needs : build_app.
42+ uses : ./.github/workflows/test_app.yml
43+ with :
44+ test_command : " bundle exec rspec --pattern './spec/**/*_spec.rb'"
45+ secrets : inherit
0 commit comments