-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: setup tests on pr * ci: add env for tests * ci: fix invalid characters in artifacts * ci: use clean branch name for reading artifacts * ci: added json-summary to coverage reporters * ci: set coverage thresholds
- Loading branch information
Showing
3 changed files
with
84 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,15 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
|
||
indent_style = space | ||
indent_size = 2 | ||
|
||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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,63 @@ | ||
name: "Test" | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
branch: | ||
- ${{ github.head_ref }} | ||
- "main" | ||
|
||
permissions: | ||
# Required to checkout the code | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ matrix.branch }} | ||
- name: "Install Node" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.11.0" | ||
- name: "Install Deps" | ||
run: npm install | ||
- name: "Test" | ||
run: npx vitest --coverage.enabled true | ||
env: | ||
VITE_CLARIFAI_USER_ID: ${{ secrets.VITE_CLARIFAI_USER_ID }} | ||
VITE_CLARIFAI_PAT: ${{ secrets.VITE_CLARIFAI_PAT }} | ||
- name: Prepare Branch Name | ||
id: prepare | ||
run: | | ||
echo "CLEAN_BRANCH=$(echo '${{ matrix.branch }}' | sed 's/[":<>|*?\r\n\\\/]/-/g')" >> $GITHUB_ENV | ||
- name: "Upload Coverage" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-${{ env.CLEAN_BRANCH }} | ||
path: coverage | ||
|
||
report-coverage: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Prepare Branch Name | ||
id: prepare | ||
run: | | ||
echo "CLEAN_BRANCH=$(echo '${{ github.head_ref }}' | sed 's/[":<>|*?\r\n\\\/]/-/g')" >> $GITHUB_ENV | ||
- name: "Download Coverage Artifacts" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage-${{ env.CLEAN_BRANCH }} | ||
path: coverage | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage-main | ||
path: coverage-main | ||
- name: "Report Coverage" | ||
uses: davelosert/vitest-coverage-report-action@v2 | ||
with: | ||
json-summary-compare-path: coverage-main/coverage-summary.json |
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