Skip to content

Commit 8b91d1c

Browse files
authored
Build if present before test (#6)
1 parent ea65959 commit 8b91d1c

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

.github/workflows/test-ecosystem.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
111111
# TODO: Add repo info to https://github.com/3846masa/stylelint-browser-compat
112112
if [[ "${url}" == 'null' ]]; then
113+
echo "::warning ::The repository info is missing. Visit https://github.com/3846masa/stylelint-browser-compat"
113114
echo "url=https://github.com/3846masa/stylelint-browser-compat" >> "${GITHUB_OUTPUT}"
114115
echo "fullname=3846masa/stylelint-browser-compat" >> "${GITHUB_OUTPUT}"
115116
fi
@@ -140,20 +141,51 @@ jobs:
140141
echo "yarn: $(yarn --version)"
141142
142143
- name: Install dependencies
143-
continue-on-error: true
144+
id: install-dependencies
144145
working-directory: ${{ steps.repo-info.outputs.directory }}
145-
run: npm install --no-audit
146+
env:
147+
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
148+
run: |
149+
if npm install --no-audit; then
150+
echo "passed=true" >> "${GITHUB_OUTPUT}"
151+
else
152+
echo "::error ::The dependency installation failed. Visit ${PACKAGE_URL}"
153+
fi
146154
147155
- name: Install Stylelint ${{ matrix.stylelint-version }}
148-
continue-on-error: true
156+
id: install-stylelint
157+
if: ${{ steps.install-dependencies.outputs.passed }}
158+
working-directory: ${{ steps.repo-info.outputs.directory }}
159+
env:
160+
STYLELINT_VERSION: ${{ matrix.stylelint-version }}
161+
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
162+
run: |
163+
if npm install --no-audit --no-save "${STYLELINT_VERSION}"; then
164+
echo "passed=true" >> "${GITHUB_OUTPUT}"
165+
else
166+
echo "::error ::The Stylelint (${STYLELINT_VERSION}) installation failed. Visit ${PACKAGE_URL}"
167+
fi
168+
169+
- name: Run build
170+
id: build
171+
if: ${{ steps.install-dependencies.outputs.passed && steps.install-stylelint.outputs.passed }}
149172
working-directory: ${{ steps.repo-info.outputs.directory }}
150-
run: npm install --no-audit --no-save ${{ matrix.stylelint-version }}
173+
env:
174+
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
175+
run: |
176+
if npm run build --if-present; then
177+
echo "passed=true" >> "${GITHUB_OUTPUT}"
178+
else
179+
echo "::error ::The build failed. Visit ${PACKAGE_URL}"
180+
fi
151181
152182
- name: Run test
153-
continue-on-error: true
183+
id: test
184+
if: ${{ steps.install-dependencies.outputs.passed && steps.install-stylelint.outputs.passed && steps.build.outputs.passed }}
154185
working-directory: ${{ steps.repo-info.outputs.directory }}
155186
env:
156-
PACKAGE: ${{ matrix.package }}
157187
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
158188
run: |
159-
npm test || echo "::error title=${PACKAGE}::The test failed. Visit ${PACKAGE_URL}"
189+
if ! npm test; then
190+
echo "::error ::The test failed. Visit ${PACKAGE_URL}"
191+
fi

0 commit comments

Comments
 (0)