-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial extensible check workflow test
- Loading branch information
1 parent
f2a2d01
commit d7abc02
Showing
7 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"build-and-test": [ | ||
"plugin-background-removal-web", | ||
"plugin-cutout-library-web", | ||
"plugin-remote-asset-source-web", | ||
"plugin-utils" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Build & Test | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: read | ||
checks: write | ||
statuses: write | ||
|
||
jobs: | ||
configure: | ||
name: Configure the build | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Create the commit status check | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
STATUS_REPO: ${{ github.repository }} | ||
STATUS_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | ||
STATUS_STATE: pending | ||
STATUS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
run: | | ||
set -x | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"/repos/${STATUS_REPO}/statuses/${STATUS_SHA}" \ | ||
-f "state=${STATUS_STATE}" \ | ||
-f "target_url=${STATUS_URL}" \ | ||
-f "description=PR Check Workflow" \ | ||
-f "context=IMG.LY" | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
sparse-checkout: | | ||
.github | ||
- name: Construct build matrix | ||
id: construct_matrix | ||
shell: bash | ||
run: | | ||
set -x | ||
jq --compact-output --raw-output '."build-and-test" | tostring | "matrix_packages=" + .' .github/ci.json | tee -a "$GITHUB_OUTPUT" | ||
outputs: | ||
matrix_packages: ${{ steps.construct_matrix.outputs.matrix_packages }} | ||
|
||
test: | ||
name: Test ${{ matrix.package }} for Node ${{ matrix.node-version }} | ||
needs: [configure] | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [20.x, 21.x] | ||
package: ${{ fromJson(needs.configure.outputs.matrix_packages) }} | ||
env: | ||
IMGLY_PACKAGE_DIR: ${{ matrix.package == '.' && github.workspace || format('{0}/packages/{1}', github.workspace, matrix.package) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: yarn | ||
- name: Install dependencies | ||
working-directory: ${{ env.IMGLY_PACKAGE_DIR }} | ||
shell: bash | ||
run: yarn install | ||
- name: Run checks | ||
working-directory: ${{ env.IMGLY_PACKAGE_DIR }} | ||
shell: bash | ||
run: yarn run check:all | ||
- name: Build | ||
working-directory: ${{ env.IMGLY_PACKAGE_DIR }} | ||
shell: bash | ||
run: yarn run build | ||
- name: Test | ||
working-directory: ${{ env.IMGLY_PACKAGE_DIR }} | ||
shell: bash | ||
run: yarn run test | ||
- name: Package | ||
if: success() || failure() | ||
working-directory: ${{ env.IMGLY_PACKAGE_DIR }} | ||
shell: bash | ||
run: yarn pack | ||
- name: Upload | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.package }}-ci-node${{ matrix.node-version }}.tgz.zip | ||
path: '${{ env.IMGLY_PACKAGE_DIR }}/*.tgz' | ||
if-no-files-found: ignore | ||
overwrite: true | ||
|
||
summary: | ||
name: Summary test status | ||
needs: [test] | ||
if: success() || failure() | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Update the commit status check | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
STATUS_REPO: ${{ github.repository }} | ||
STATUS_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | ||
STATUS_STATE: ${{ needs.test.result == 'success' && 'success' || 'failure' }} | ||
STATUS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
run: | | ||
set -x | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"/repos/${STATUS_REPO}/statuses/${STATUS_SHA}" \ | ||
-f "state=${STATUS_STATE}" \ | ||
-f "target_url=${STATUS_URL}" \ | ||
-f "description=PR Check Workflow" \ | ||
-f "context=IMG.LY" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ packages/*/dist | |
examples/*/dist | ||
.env.local | ||
.nvmrc | ||
*.tgz | ||
|
||
.DS_Store | ||
yarn-error.log | ||
|
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
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
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
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