DEV: Update CI workflows (#11)

Co-authored-by: discoursebuild <build@discourse.org>
This commit is contained in:
discoursebot 2022-06-17 16:23:39 -04:00 committed by GitHub
parent 24537bd082
commit 45d2c95431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 26 deletions

View File

@ -11,8 +11,29 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build: check:
name: ${{ matrix.build_type }} runs-on: ubuntu-latest
outputs:
tests_exist: ${{ steps.check_tests.outputs.tests_exist }}
steps:
- name: Install component
uses: actions/checkout@v3
with:
path: tmp/component
fetch-depth: 1
- name: Check QUnit existence
id: check_tests
shell: bash
run: |
if [ 0 -lt $(find tmp/component/test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
echo "::set-output name=tests_exist::true"
fi
test:
needs: check
if: ${{ needs.check.outputs.tests_exist }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: discourse/discourse_test:slim-browsers container: discourse/discourse_test:slim-browsers
timeout-minutes: 15 timeout-minutes: 15
@ -24,12 +45,6 @@ jobs:
PGUSER: discourse PGUSER: discourse
PGPASSWORD: discourse PGPASSWORD: discourse
strategy:
fail-fast: false
matrix:
build_type: ["frontend-legacy", "frontend"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -124,26 +139,9 @@ jobs:
if: steps.app-cache.outputs.cache-hit != 'true' if: steps.app-cache.outputs.cache-hit != 'true'
run: rm -rf tmp/app-cache/uploads && cp -r public/uploads tmp/app-cache/uploads run: rm -rf tmp/app-cache/uploads && cp -r public/uploads tmp/app-cache/uploads
- name: Check qunit existence
id: check_qunit
shell: bash
run: |
if [ 0 -lt $(find tmp/component/test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
echo "::set-output name=files_exist::true"
fi
- name: Component QUnit - name: Component QUnit
if: matrix.build_type == 'frontend-legacy' && steps.check_qunit.outputs.files_exist == 'true'
run: | run: |
THEME_NAME=$(ruby -e 'require "json"; puts JSON.parse(File.read("tmp/component/about.json"))["name"]') THEME_NAME=$(ruby -e 'require "json"; puts JSON.parse(File.read("tmp/component/about.json"))["name"]')
bundle exec rake themes:install -- "--{\"$THEME_NAME\": \"tmp/component\"}" bundle exec rake themes:install -- "--{\"$THEME_NAME\": \"tmp/component\"}"
QUNIT_EMBER_CLI=0 UNICORN_TIMEOUT=120 bundle exec rake "themes:qunit[name,$THEME_NAME]" UNICORN_TIMEOUT=120 bundle exec rake "themes:qunit[name,$THEME_NAME]"
timeout-minutes: 10
- name: Component QUnit (Ember CLI)
if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exist == 'true'
run: |
THEME_NAME=$(ruby -e 'require "json"; puts JSON.parse(File.read("tmp/component/about.json"))["name"]')
bundle exec rake themes:install -- "--{\"$THEME_NAME\": \"tmp/component\"}"
QUNIT_EMBER_CLI=1 UNICORN_TIMEOUT=120 bundle exec rake "themes:qunit[name,$THEME_NAME]"
timeout-minutes: 10 timeout-minutes: 10