Skip to content

Commit

Permalink
Build if present before test (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored Jul 12, 2024
1 parent ea65959 commit 8b91d1c
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions .github/workflows/test-ecosystem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
# TODO: Add repo info to https://github.com/3846masa/stylelint-browser-compat
if [[ "${url}" == 'null' ]]; then
echo "::warning ::The repository info is missing. Visit https://github.com/3846masa/stylelint-browser-compat"
echo "url=https://github.com/3846masa/stylelint-browser-compat" >> "${GITHUB_OUTPUT}"
echo "fullname=3846masa/stylelint-browser-compat" >> "${GITHUB_OUTPUT}"
fi
Expand Down Expand Up @@ -140,20 +141,51 @@ jobs:
echo "yarn: $(yarn --version)"
- name: Install dependencies
continue-on-error: true
id: install-dependencies
working-directory: ${{ steps.repo-info.outputs.directory }}
run: npm install --no-audit
env:
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
run: |
if npm install --no-audit; then
echo "passed=true" >> "${GITHUB_OUTPUT}"
else
echo "::error ::The dependency installation failed. Visit ${PACKAGE_URL}"
fi
- name: Install Stylelint ${{ matrix.stylelint-version }}
continue-on-error: true
id: install-stylelint
if: ${{ steps.install-dependencies.outputs.passed }}
working-directory: ${{ steps.repo-info.outputs.directory }}
env:
STYLELINT_VERSION: ${{ matrix.stylelint-version }}
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
run: |
if npm install --no-audit --no-save "${STYLELINT_VERSION}"; then
echo "passed=true" >> "${GITHUB_OUTPUT}"
else
echo "::error ::The Stylelint (${STYLELINT_VERSION}) installation failed. Visit ${PACKAGE_URL}"
fi
- name: Run build
id: build
if: ${{ steps.install-dependencies.outputs.passed && steps.install-stylelint.outputs.passed }}
working-directory: ${{ steps.repo-info.outputs.directory }}
run: npm install --no-audit --no-save ${{ matrix.stylelint-version }}
env:
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
run: |
if npm run build --if-present; then
echo "passed=true" >> "${GITHUB_OUTPUT}"
else
echo "::error ::The build failed. Visit ${PACKAGE_URL}"
fi
- name: Run test
continue-on-error: true
id: test
if: ${{ steps.install-dependencies.outputs.passed && steps.install-stylelint.outputs.passed && steps.build.outputs.passed }}
working-directory: ${{ steps.repo-info.outputs.directory }}
env:
PACKAGE: ${{ matrix.package }}
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
run: |
npm test || echo "::error title=${PACKAGE}::The test failed. Visit ${PACKAGE_URL}"
if ! npm test; then
echo "::error ::The test failed. Visit ${PACKAGE_URL}"
fi

0 comments on commit 8b91d1c

Please sign in to comment.