Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Discourse SAML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Vercesi
Discourse SAML
Commits
851f6ceb
Unverified
Commit
851f6ceb
authored
3 years ago
by
discoursebot
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
DEV: Update CI workflows (#58)
Co-authored-by:
CvX
<
CvX@users.noreply.github.com
>
parent
7792d1eb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.github/workflows/plugin-tests.yml
+50
-24
50 additions, 24 deletions
.github/workflows/plugin-tests.yml
with
50 additions
and
24 deletions
.github/workflows/plugin-tests.yml
+
50
−
24
View file @
851f6ceb
...
...
@@ -10,14 +10,13 @@ jobs:
build
:
name
:
${{ matrix.build_type }}
runs-on
:
ubuntu-latest
container
:
discourse/discourse_test:
release
container
:
discourse/discourse_test:
slim${{ matrix.build_type == 'frontend' && '-browsers' || '' }}
timeout-minutes
:
60
env
:
DISCOURSE_HOSTNAME
:
www.example.com
RUBY_GLOBAL_METHOD_CACHE_SIZE
:
131072
RAILS_ENV
:
test
PGHOST
:
postgres
PGUSER
:
discourse
PGPASSWORD
:
discourse
...
...
@@ -26,23 +25,7 @@ jobs:
matrix
:
build_type
:
[
"
backend"
,
"
frontend"
]
ruby
:
[
"
2.7"
]
postgres
:
[
"
13"
]
services
:
postgres
:
image
:
postgres:${{ matrix.postgres }}
ports
:
-
5432:5432
env
:
POSTGRES_USER
:
discourse
POSTGRES_PASSWORD
:
discourse
options
:
>-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps
:
-
uses
:
actions/checkout@v2
with
:
...
...
@@ -59,16 +42,25 @@ jobs:
run
:
|
git config --global user.email "ci@ci.invalid"
git config --global user.name "Discourse CI"
-
name
:
Start redis
run
:
|
redis-server /etc/redis/redis.conf &
-
name
:
Start Postgres
run
:
|
chown -R postgres /var/run/postgresql
sudo -E -u postgres script/start_test_db.rb
sudo -u postgres psql -c "CREATE ROLE $PGUSER LOGIN SUPERUSER PASSWORD '$PGPASSWORD';"
-
name
:
Bundler cache
uses
:
actions/cache@v2
with
:
path
:
vendor/bundle
key
:
${{ runner.os
}}-${{ matrix.ruby
}}-gem-${{ hashFiles('**/Gemfile.lock') }}
key
:
${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys
:
|
${{ runner.os }}-${{ matrix.ruby }}-gem-
${{ runner.os }}-gem-
-
name
:
Setup gems
run
:
|
bundle config --local path vendor/bundle
...
...
@@ -76,6 +68,7 @@ jobs:
bundle config --local without development
bundle install --jobs 4
bundle clean
-
name
:
Lint English locale
if
:
matrix.build_type == 'backend'
run
:
bundle exec ruby script/i18n_lint.rb "plugins/${{ github.event.repository.name }}/locales/{client,server}.en.yml"
...
...
@@ -89,16 +82,47 @@ jobs:
id
:
yarn-cache
with
:
path
:
${{ steps.yarn-cache-dir.outputs.dir }}
key
:
${{ runner.os
}}-${{ matrix.os
}}-yarn-${{ hashFiles('**/yarn.lock') }}
key
:
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys
:
|
${{ runner.os }}-${{ matrix.os }}-yarn-
${{ runner.os }}-yarn-
-
name
:
Yarn install
run
:
yarn install
-
name
:
Migrate database
-
name
:
Fetch app state cache
uses
:
actions/cache@v2
id
:
app-cache
with
:
path
:
tmp/app-cache
key
:
>-
# postgres version, hash of migrations, "parallel?"
${{ runner.os }}-
${{ hashFiles('.github/workflows/tests.yml') }}-
${{ matrix.postgres }}-
${{ hashFiles('db/**/*', 'plugins/**/db/**/*') }}-
${{ env.USES_PARALLEL_DATABASES }}
-
name
:
Restore database from cache
if
:
steps.app-cache.outputs.cache-hit == 'true'
run
:
psql -f tmp/app-cache/cache.sql postgres
-
name
:
Restore uploads from cache
if
:
steps.app-cache.outputs.cache-hit == 'true'
run
:
rm -rf public/uploads && cp -r tmp/app-cache/uploads public/uploads
-
name
:
Create and migrate database
if
:
steps.app-cache.outputs.cache-hit != 'true'
run
:
|
bin/rake db:create
bin/rake db:migrate
-
name
:
Dump database for cache
if
:
steps.app-cache.outputs.cache-hit != 'true'
run
:
mkdir -p tmp/app-cache && pg_dumpall > tmp/app-cache/cache.sql
-
name
:
Dump uploads for cache
if
:
steps.app-cache.outputs.cache-hit != 'true'
run
:
rm -rf tmp/app-cache/uploads && cp -r public/uploads tmp/app-cache/uploads
-
name
:
Check spec existence
id
:
check_spec
shell
:
bash
...
...
@@ -106,6 +130,7 @@ jobs:
if [ 0 -lt $(find plugins/${{ github.event.repository.name }}/spec -type f -name "*.rb" 2> /dev/null | wc -l) ]; then
echo "::set-output name=files_exist::true"
fi
-
name
:
Plugin RSpec
if
:
matrix.build_type == 'backend' && steps.check_spec.outputs.files_exist == 'true'
run
:
bin/rake plugin:spec[${{ github.event.repository.name }}]
...
...
@@ -117,6 +142,7 @@ jobs:
if [ 0 -lt $(find plugins/${{ github.event.repository.name }}/test/javascripts -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
echo "::set-output name=files_exist::true"
fi
-
name
:
Plugin QUnit
if
:
matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exist == 'true'
run
:
bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment