forked from HumanSignal/label-studio
-
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: PLATE-745: Set up frontend test workflows (HumanSignal#5365)
* ci: PLATE-745: Set up frontend test workflows * headless tests * uncomment pipeline * ci: Build frontend Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7693774741 --------- Co-authored-by: robot-ci-heartex <[email protected]>
- Loading branch information
1 parent
2e736d9
commit 522b241
Showing
9 changed files
with
284 additions
and
31 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,50 @@ | ||
name: Setup frontend environment | ||
description: Setup frontend environment | ||
|
||
inputs: | ||
node-version: | ||
description: node version | ||
default: "18" | ||
required: false | ||
yarn-version: | ||
description: yarn version | ||
default: "1.22" | ||
required: false | ||
directory: | ||
description: frontend directory | ||
default: "web" | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "${{ inputs.node-version }}" | ||
|
||
- name: Upgrade Yarn | ||
env: | ||
VERSION: "${{ inputs.yarn-version }}" | ||
shell: bash | ||
run: npm install -g "yarn@${VERSION}" | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
shell: bash | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure yarn cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-node-${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Print Yarn cache size | ||
shell: bash | ||
run: du -d 0 -h ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
|
||
- name: Install yarn dependencies | ||
working-directory: "${{ inputs.directory }}" | ||
shell: bash | ||
run: yarn install --frozen-lockfile |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,8 @@ on: | |
type: string | ||
|
||
env: | ||
NODE: 18 | ||
CACHE_NAME_PREFIX: v1 | ||
FRONTEND_MONOREPO_DIR: web | ||
NODE: "18" | ||
FRONTEND_MONOREPO_DIR: "web" | ||
FRONTEND_BUILD_COMMIT_MESSAGE: "ci: Build frontend" | ||
|
||
jobs: | ||
|
@@ -40,31 +39,15 @@ jobs: | |
token: ${{ secrets.GIT_PAT }} | ||
ref: ${{ inputs.ref }} | ||
|
||
- uses: actions/setup-node@v4 | ||
- name: Setup frontend environment | ||
uses: ./.github/actions/setup-frontend-environment | ||
with: | ||
node-version: "${{ env.NODE }}" | ||
|
||
- name: Upgrade Yarn | ||
run: npm install -g [email protected] | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Configure yarn cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-node-${{ env.NODE }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Print Yarn cache size | ||
run: du -d 0 -h ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
directory: "${{ env.FRONTEND_MONOREPO_DIR }}" | ||
|
||
- name: "Monorepo: Build" | ||
run: | | ||
yarn install --frozen-lockfile | ||
yarn build | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }} | ||
working-directory: "${{ env.FRONTEND_MONOREPO_DIR }}" | ||
run: yarn build | ||
|
||
- name: Commit and Push | ||
run: | | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: "yarn e2e" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
head_sha: | ||
required: true | ||
type: string | ||
|
||
env: | ||
NODE: "18" | ||
FRONTEND_MONOREPO_DIR: "web" | ||
|
||
jobs: | ||
main: | ||
name: "yarn e2e" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- name: Configure git | ||
shell: bash | ||
run: | | ||
set -xeuo pipefail | ||
git config --global user.name 'robot-ci-heartex' | ||
git config --global user.email '[email protected]' | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Setup frontend environment | ||
uses: ./.github/actions/setup-frontend-environment | ||
with: | ||
node-version: "${{ env.NODE }}" | ||
directory: "${{ env.FRONTEND_MONOREPO_DIR }}" | ||
|
||
- name: Install e2e dependencies | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }}/libs/editor/tests/e2e | ||
run: yarn install | ||
|
||
- name: Run LSO server | ||
id: run-lso-server | ||
run: | | ||
container_id=$(docker run --rm -d -p 8080:8080 heartexlabs/label-studio:develop) | ||
echo "container_id=${container_id}" >> $GITHUB_OUTPUT | ||
- name: Run LSF server | ||
id: run-lsf-server | ||
timeout-minutes: 1 | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }} | ||
run: | | ||
set -xeuo pipefail | ||
yarn lsf:serve & | ||
pid=$! | ||
echo "pid=${pid}" >> $GITHUB_OUTPUT | ||
while ! curl -s -o /dev/null -L "http://localhost:3000"; do | ||
echo "=> Waiting for service to become available" | ||
sleep 2s | ||
done | ||
- name: Run tests | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }} | ||
env: | ||
HEADLESS: true | ||
run: | | ||
yarn test:e2e | ||
- name: Kill LSO server | ||
if: always() | ||
continue-on-error: true | ||
run: docker rm -f "${{ steps.run-lso-server.outputs.container_id }}" | ||
|
||
- name: Kill LSF server | ||
if: always() | ||
continue-on-error: true | ||
run: kill -9 "${{ steps.run-lsf-server.outputs.pid }}" |
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,64 @@ | ||
name: "yarn integration" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
head_sha: | ||
required: true | ||
type: string | ||
|
||
env: | ||
NODE: "18" | ||
FRONTEND_MONOREPO_DIR: "web" | ||
|
||
jobs: | ||
main: | ||
name: "yarn integration" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- name: Configure git | ||
shell: bash | ||
run: | | ||
set -xeuo pipefail | ||
git config --global user.name 'robot-ci-heartex' | ||
git config --global user.email '[email protected]' | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Setup frontend environment | ||
uses: ./.github/actions/setup-frontend-environment | ||
with: | ||
node-version: "${{ env.NODE }}" | ||
directory: "${{ env.FRONTEND_MONOREPO_DIR }}" | ||
|
||
- name: Run server | ||
id: run-server | ||
timeout-minutes: 1 | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }} | ||
run: | | ||
set -xeuo pipefail | ||
yarn lsf:serve & | ||
pid=$! | ||
echo "pid=${pid}" >> $GITHUB_OUTPUT | ||
while ! curl -s -o /dev/null -L "http://localhost:3000"; do | ||
echo "=> Waiting for service to become available" | ||
sleep 2s | ||
done | ||
- name: Run tests | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }} | ||
run: | | ||
yarn test:integration | ||
- name: Kill server | ||
if: always() | ||
continue-on-error: true | ||
run: kill -9 "${{ steps.run-server.outputs.pid }}" |
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,43 @@ | ||
name: "yarn unit" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
head_sha: | ||
required: true | ||
type: string | ||
|
||
env: | ||
NODE: "18" | ||
FRONTEND_MONOREPO_DIR: "web" | ||
|
||
jobs: | ||
main: | ||
name: "yarn unit" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- name: Configure git | ||
shell: bash | ||
run: | | ||
set -xeuo pipefail | ||
git config --global user.name 'robot-ci-heartex' | ||
git config --global user.email '[email protected]' | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Setup frontend environment | ||
uses: ./.github/actions/setup-frontend-environment | ||
with: | ||
node-version: "${{ env.NODE }}" | ||
directory: "${{ env.FRONTEND_MONOREPO_DIR }}" | ||
|
||
- name: Run tests | ||
working-directory: ${{ env.FRONTEND_MONOREPO_DIR }} | ||
run: | | ||
yarn test:unit |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.