From 3343c6b19f40c317034bce2970b809dc97733adc Mon Sep 17 00:00:00 2001 From: discoursebot Date: Fri, 17 Jun 2022 16:23:35 -0400 Subject: [PATCH] DEV: Update CI workflows (#41) Co-authored-by: discoursebuild --- .github/workflows/component-tests.yml | 35 ++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/component-tests.yml b/.github/workflows/component-tests.yml index 0251257..944aa1e 100644 --- a/.github/workflows/component-tests.yml +++ b/.github/workflows/component-tests.yml @@ -11,7 +11,29 @@ concurrency: cancel-in-progress: true jobs: - build: + check: + 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 container: discourse/discourse_test:slim-browsers timeout-minutes: 15 @@ -117,18 +139,9 @@ jobs: 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 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 - if: 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]" + UNICORN_TIMEOUT=120 bundle exec rake "themes:qunit[name,$THEME_NAME]" timeout-minutes: 10