fix: update confusing example in Coder plugin README (#115) #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
# This workflow will lint and test a plugin whenever it or CI changes. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Cancel in-progress runs for pull requests when developers push changes. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
plugins: ${{ steps.filter.outputs.changes }} | |
steps: | |
# Pull requests do not need to check out the code to detect changes | |
# because the action fetches changed files through the API. | |
- uses: actions/checkout@v4 | |
if: github.event_name != 'pull_request' | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
coder: | |
- ".github/workflows/test.yaml" | |
- "yarn.lock" | |
- "plugins/backstage-plugin-coder/**" | |
devcontainers-backend: | |
- ".github/workflows/test.yaml" | |
- "yarn.lock" | |
- "plugins/backstage-plugin-devcontainers-backend/**" | |
devcontainers-react: | |
- ".github/workflows/test.yaml" | |
- "yarn.lock" | |
- "plugins/backstage-plugin-devcontainers-react/**" | |
plugin: | |
needs: changes | |
if: ${{ needs.changes.outputs.plugins != '' && toJson(fromJson(needs.changes.outputs.plugins)) != '[]' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
plugin: ${{ fromJSON(needs.changes.outputs.plugins) }} | |
name: ${{ matrix.plugin }} | |
defaults: | |
run: | |
working-directory: plugins/backstage-plugin-${{ matrix.plugin }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
# The Prettier command is in the root package.json. | |
- run: yarn prettier --check plugins/backstage-plugin-${{ matrix.plugin }} | |
id: fmt | |
working-directory: . | |
- run: yarn lint | |
id: lint | |
# It could be annoying to not see the test results because of formatting | |
# errors, so keep running even on failures (we will catch failures at | |
# the end of the job). continue-on-error would be ideal but that marks | |
# the step as successful which is not what we want. | |
if: success() || failure() | |
- run: yarn test | |
id: test | |
if: success() || failure() | |
# Must run tsc first to generate the .d.ts files. | |
- run: yarn tsc && yarn build | |
id: build | |
# Version it with the SHA and upload to the run as an artifact in case | |
# someone needs to download it for testing. | |
- run: yarn version --new-version "0.0.0-devel+$GITHUB_SHA" | |
id: version | |
- run: yarn pack | |
id: pack | |
- uses: actions/upload-artifact@v4 | |
id: upload | |
with: | |
name: ${{ matrix.plugin }} | |
path: plugins/backstage-plugin-${{ matrix.plugin }}/*.tgz | |
# Since we continued on failures above, fail now if there were errors. We | |
# allow skipped jobs to pass, but not failed or cancelled jobs. | |
- name: Check required | |
if: success() || failure() | |
run: | | |
echo "- fmt: ${{ steps.fmt.outcome }}" | |
echo "- lint: ${{ steps.lint.outcome }}" | |
echo "- test: ${{ steps.test.outcome }}" | |
echo "- build: ${{ steps.build.outcome }}" | |
echo "- version: ${{ steps.version.outcome }}" | |
echo "- pack: ${{ steps.pack.outcome }}" | |
echo "- upload: ${{ steps.upload.outcome }}" | |
if [[ "${{ contains(steps.*.outcome, 'failure') }}" == "true" || "${{ contains(steps.*.outcome, 'cancelled') }}" == "true" ]]; then | |
echo "One or more required checks have failed or have been cancelled" | |
exit 1 | |
fi | |
echo "Required checks have passed" |