@@ -11,13 +11,14 @@ jobs:
1111 build :
1212 name : ${{ matrix.build_type }}
1313 runs-on : ubuntu-latest
14+ container : discourse/discourse_test:release
1415 timeout-minutes : 60
1516
1617 env :
1718 DISCOURSE_HOSTNAME : www.example.com
1819 RUBY_GLOBAL_METHOD_CACHE_SIZE : 131072
1920 RAILS_ENV : test
20- PGHOST : localhost
21+ PGHOST : postgres
2122 PGUSER : discourse
2223 PGPASSWORD : discourse
2324
2728 matrix :
2829 build_type : ["backend", "frontend"]
2930 ruby : ["2.7"]
30- postgres : ["12 "]
31+ postgres : ["13 "]
3132 redis : ["4.x"]
3233
3334 services :
@@ -57,46 +58,31 @@ jobs:
5758 path : plugins/${{ github.event.repository.name }}
5859 fetch-depth : 1
5960
60- - name : Check spec existence
61- id : check_spec
62- uses : andstor/file-existence-action@v1
63- with :
64- files : " plugins/${{ github.event.repository.name }}/spec"
65-
66- - name : Check qunit existence
67- id : check_qunit
68- uses : andstor/file-existence-action@v1
69- with :
70- files : " plugins/${{ github.event.repository.name }}/test/javascripts"
71-
7261 - name : Setup Git
7362 run : |
7463 git config --global user.email "ci@ci.invalid"
7564 git config --global user.name "Discourse CI"
7665
77- - name : Setup packages
78- run : |
79- sudo apt-get update
80- sudo apt-get -yqq install postgresql-client libpq-dev gifsicle jpegoptim optipng jhead
81- wget -qO- https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-pngquant | sudo sh
82-
83- - name : Update imagemagick
84- if : matrix.build_type == 'backend'
85- run : |
86- wget https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-imagemagick
87- chmod +x install-imagemagick
88- sudo ./install-imagemagick
89-
9066 - name : Setup redis
9167 uses : shogo82148/actions-setup-redis@v1
9268 with :
9369 redis-version : ${{ matrix.redis }}
9470
95- - name : Setup ruby
96- uses : ruby/setup-ruby@v1
71+ - name : Bundler cache
72+ uses : actions/cache@v2
9773 with :
98- ruby-version : ${{ matrix.ruby }}
99- bundler-cache : true
74+ path : vendor/bundle
75+ key : ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
76+ restore-keys : |
77+ ${{ runner.os }}-${{ matrix.ruby }}-gem-
78+
79+ - name : Setup gems
80+ run : |
81+ bundle config --local path vendor/bundle
82+ bundle config --local deployment true
83+ bundle config --local without development
84+ bundle install --jobs 4
85+ bundle clean
10086
10187 - name : Lint English locale
10288 if : matrix.build_type == 'backend'
@@ -116,18 +102,36 @@ jobs:
116102 ${{ runner.os }}-${{ matrix.os }}-yarn-
117103
118104 - name : Yarn install
119- run : yarn install --dev
105+ run : yarn install
120106
121107 - name : Migrate database
122108 run : |
123109 bin/rake db:create
124110 bin/rake db:migrate
125111
112+ - name : Check spec existence
113+ id : check_spec
114+ shell : bash
115+ run : |
116+ shopt -s extglob
117+ if ls plugins/${{ github.event.repository.name }}/spec/**/*.@(rb) &> /dev/null; then
118+ echo "::set-output name=files_exist::true"
119+ fi
120+
126121 - name : Plugin RSpec
127- if : matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true'
122+ if : matrix.build_type == 'backend' && steps.check_spec.outputs.files_exist == 'true'
128123 run : bin/rake plugin:spec[${{ github.event.repository.name }}]
129124
125+ - name : Check qunit existence
126+ id : check_qunit
127+ shell : bash
128+ run : |
129+ shopt -s extglob
130+ if ls plugins/${{ github.event.repository.name }}/test/javascripts/**/*.@(js|es6) &> /dev/null; then
131+ echo "::set-output name=files_exist::true"
132+ fi
133+
130134 - name : Plugin QUnit
131- if : matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true'
135+ if : matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exist == 'true'
132136 run : bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
133137 timeout-minutes : 30
0 commit comments