DEV: Update CI workflows (#56)

Co-authored-by: discoursebuild <build@discourse.org>
This commit is contained in:
discoursebot 2022-05-24 13:15:19 -04:00 committed by GitHub
parent cd940e5533
commit 12b361f7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 18 deletions

View File

@ -6,15 +6,19 @@ on:
- main - main
pull_request: pull_request:
concurrency:
group: plugin-linting-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
cancel-in-progress: true
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
cache: yarn cache: yarn
@ -46,7 +50,7 @@ jobs:
- name: Ember template lint - name: Ember template lint
if: ${{ always() }} if: ${{ always() }}
run: yarn ember-template-lint assets/javascripts run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts
- name: Rubocop - name: Rubocop
if: ${{ always() }} if: ${{ always() }}

View File

@ -6,12 +6,16 @@ on:
- main - main
pull_request: pull_request:
concurrency:
group: plugin-tests-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
cancel-in-progress: true
jobs: jobs:
build: build:
name: ${{ matrix.build_type }} name: ${{ matrix.build_type }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: discourse/discourse_test:slim${{ matrix.build_type == 'frontend' && '-browsers' || '' }} container: discourse/discourse_test:slim${{ startsWith(matrix.build_type, 'frontend') && '-browsers' || '' }}
timeout-minutes: 60 timeout-minutes: 30
env: env:
DISCOURSE_HOSTNAME: www.example.com DISCOURSE_HOSTNAME: www.example.com
@ -24,16 +28,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
build_type: ["backend", "frontend"] build_type: ["backend", "frontend-legacy", "frontend"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
with: with:
repository: discourse/discourse repository: discourse/discourse
fetch-depth: 1 fetch-depth: 1
- name: Install plugin - name: Install plugin
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
path: plugins/${{ github.event.repository.name }} path: plugins/${{ github.event.repository.name }}
fetch-depth: 1 fetch-depth: 1
@ -46,7 +50,7 @@ jobs:
- name: Start redis - name: Start redis
run: | run: |
redis-server /etc/redis/redis.conf & redis-server /etc/redis/redis.conf &
- name: Start Postgres - name: Start Postgres
run: | run: |
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
@ -54,7 +58,7 @@ jobs:
sudo -u postgres psql -c "CREATE ROLE $PGUSER LOGIN SUPERUSER PASSWORD '$PGPASSWORD';" sudo -u postgres psql -c "CREATE ROLE $PGUSER LOGIN SUPERUSER PASSWORD '$PGPASSWORD';"
- name: Bundler cache - name: Bundler cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: vendor/bundle path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
@ -63,6 +67,7 @@ jobs:
- name: Setup gems - name: Setup gems
run: | run: |
gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
bundle config --local path vendor/bundle bundle config --local path vendor/bundle
bundle config --local deployment true bundle config --local deployment true
bundle config --local without development bundle config --local without development
@ -78,7 +83,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)" run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Yarn cache - name: Yarn cache
uses: actions/cache@v2 uses: actions/cache@v3
id: yarn-cache id: yarn-cache
with: with:
path: ${{ steps.yarn-cache-dir.outputs.dir }} path: ${{ steps.yarn-cache-dir.outputs.dir }}
@ -90,16 +95,13 @@ jobs:
run: yarn install run: yarn install
- name: Fetch app state cache - name: Fetch app state cache
uses: actions/cache@v2 uses: actions/cache@v3
id: app-cache id: app-cache
with: with:
path: tmp/app-cache path: tmp/app-cache
key: >- # postgres version, hash of migrations, "parallel?" key: >-
${{ runner.os }}-
${{ hashFiles('.github/workflows/tests.yml') }}- ${{ hashFiles('.github/workflows/tests.yml') }}-
${{ matrix.postgres }}-
${{ hashFiles('db/**/*', 'plugins/**/db/**/*') }}- ${{ hashFiles('db/**/*', 'plugins/**/db/**/*') }}-
${{ env.USES_PARALLEL_DATABASES }}
- name: Restore database from cache - name: Restore database from cache
if: steps.app-cache.outputs.cache-hit == 'true' if: steps.app-cache.outputs.cache-hit == 'true'
@ -144,6 +146,11 @@ jobs:
fi fi
- name: Plugin QUnit - name: Plugin QUnit
if: matrix.build_type == 'frontend-legacy' && steps.check_qunit.outputs.files_exist == 'true'
run: QUNIT_EMBER_CLI=0 bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
timeout-minutes: 10
- name: Plugin QUnit (Ember CLI)
if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exist == 'true' if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exist == 'true'
run: bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000'] run: QUNIT_EMBER_CLI=1 bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
timeout-minutes: 30 timeout-minutes: 10