Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

407 Add test workflow for leapfrogai_ui #439

Merged
merged 24 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d3fbc32
add ui-test workflow
jalling97 Apr 24, 2024
8939555
add npm prefix
jalling97 Apr 24, 2024
d311db7
add trufflehog scans to workflows
jalling97 Apr 25, 2024
8d0bb03
Merge remote-tracking branch 'origin/main' into 407-ci-create-test-wo…
jalling97 Apr 25, 2024
488b65f
add UI linter to github workflows
jalling97 Apr 25, 2024
a62b4a8
add eslint to pre-commit
jalling97 Apr 25, 2024
bbfa0d4
fix: prettier and eslint issues
andrewrisse Apr 25, 2024
0f0cab6
add prettier to pre-commit
jalling97 Apr 26, 2024
4fc87ea
fix wording mistake
jalling97 Apr 26, 2024
03cdee8
change to npm ci vs install
jalling97 Apr 26, 2024
7021fcf
convert prettier to eslint plugin
jalling97 Apr 26, 2024
0b21f9c
update package.json and package-lock.json
jalling97 Apr 26, 2024
48c284e
merge in main and sync eslint between pre-commit and npm script
jalling97 Apr 29, 2024
0a42e8d
pin setup node actions version
jalling97 Apr 29, 2024
60a8e3b
Merge remote-tracking branch 'origin/main' into 407-ci-create-test-wo…
jalling97 Apr 29, 2024
228efdb
linting fixes
jalling97 Apr 29, 2024
2a0ac2d
fix: frontend eslint issues
andrewrisse Apr 29, 2024
02c3087
pin node version in package.json
jalling97 Apr 29, 2024
233537f
remove pre-commit comments
jalling97 Apr 29, 2024
beb9362
fix: merge conflicts, minor test update
andrewrisse Apr 30, 2024
bdb21f5
exclude .pre-commit-config.yaml from e2e workflow
jalling97 Apr 30, 2024
443e57c
catch .pre-commit-config.yaml in e2e-shim workflow
jalling97 Apr 30, 2024
81e8041
add ui-test-shim
jalling97 Apr 30, 2024
0ef7cc3
remove redundancy in secret-scan github action
jalling97 Apr 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-shim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
- "CODEOWNERS"
- ".gitignore"
- "LICENSE"
- "pre-commit-config.yaml"
- ".pre-commit-config.yaml"

# Catch pytests
- "tests/pytest/**"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:
- "!LICENSE"

# Ignore local development files
- "!pre-commit-config.yaml"
- "!.pre-commit-config.yaml"

# Ignore non e2e tests
- "!tests/pytest/**"
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ jobs:
with:
version: 0.3.4
args: format --check

# Javascript & Typescript Linting
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: 'src/leapfrogai_ui/package.json'

- name: Install UI Dependencies
run: npm --prefix src/leapfrogai_ui ci

- name: Run UI Linter
run: npm --prefix src/leapfrogai_ui run lint
16 changes: 16 additions & 0 deletions .github/workflows/secret-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: secret-scan
on: pull_request


jobs:
secret-scan: # scan for any live secrets in the repository using trufflehog
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
with:
extra_args: --only-verified
40 changes: 40 additions & 0 deletions .github/workflows/ui-test-shim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Catch all the things we ignore in the ui-test workflow
name: ui-test-shim
on:
pull_request:
paths:
# catch all workflows except the ui-test
- ".github/workflows/**"
- "!.github/workflows/ui-test.yaml"

# ignore LFAI-UI things
- "!src/leapfrogai_ui/**"
- "!packages/ui/**"


permissions:
contents: read

# This is here to act as a shim for branch protection rules to work correctly.
# This is ugly but this seems to be the best way to do this since:
# - Job names in a workflow must be unique
# - When paths are ignored not all jobs are reported to the branch protection rules
# - Multiple jobs of the same name are still required by branch protection rules

# For more info see below:
# https://github.com/orgs/community/discussions/54877
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks

# Abort prior jobs in the same workflow / PR
concurrency:
group: ui-test-skip-${{ github.ref }}
cancel-in-progress: true


jobs:
ui-test:
runs-on: ubuntu-latest
steps:
- name: Skipped
run: |
echo skipped
35 changes: 35 additions & 0 deletions .github/workflows/ui-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ui-test
on:
pull_request:
paths:
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
# Ignore all workflows except this one
- ".github/workflows/ui-test.yaml"

# LFAI-UI things (no Python)
- "src/leapfrogai_ui/**"
- "packages/ui/**"

# Declare default permissions as read only.
permissions: read-all

concurrency:
group: ui-test-${{ github.ref }}
cancel-in-progress: true

jobs:
ui-test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: 'src/leapfrogai_ui/package.json'

- name: Install Dependencies
run: npm --prefix src/leapfrogai_ui ci

- name: Run Unit Tests
run: npm --prefix src/leapfrogai_ui run test:unit
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ repos:
hooks:
- id: ruff # Run the linter.
- id: ruff-format # Run the formatter.

# Local Eslint w/ Prettier
- repo: local
hooks:
- id: eslint
name: eslint
language: system
entry: sh -c 'npm --prefix src/leapfrogai_ui/ run lint'
files: \.(js|jsx|ts|tsx|svelte|cjs|mjs)$ # *.js, *.jsx, *.ts, *.tsx, *.svelte, *.cjs, *.mjs
5 changes: 4 additions & 1 deletion src/leapfrogai_ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ module.exports = {
parser: '@typescript-eslint/parser'
}
}
]
],
rules: {
'no-undef': 'off'
}
};
4 changes: 3 additions & 1 deletion src/leapfrogai_ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ pnpm-lock.yaml
package-lock.json
yarn.lock

../../packages/ui/chart/
../../packages/ui/chart/

supabase
2 changes: 1 addition & 1 deletion src/leapfrogai_ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ ENV NODE_ENV=production
ENV BODY_SIZE_LIMIT=Infinity
ENV PROTOCOL_HEADER=x-forwarded-proto
ENV HOST_HEADER=x-forwarded-host
CMD ["build"]
CMD ["build"]
2 changes: 1 addition & 1 deletion src/leapfrogai_ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ docker-build:
docker build -t ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION} .

zarf-build:
zarf package create . --confirm --set IMAGE_VERSION=${VERSION}
zarf package create . --confirm --set IMAGE_VERSION=${VERSION}
6 changes: 3 additions & 3 deletions src/leapfrogai_ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ Under a realm in Keycloak that is not the master realm (if using UDS, its "uds")
1. Create a new client (the client ID you use will be used in the env variables below)
2. Turn on "Client Authentication"
3. For "Valid redirect URLs", you need to put:
1. `http://localhost:5173/auth/callback` (or the URL for the frontend app callback)
2. `http://127.0.0.1:54321/auth/v1/callback` (or the URL for the Supabase callback, for locally running Supabase, DO NOT USE LOCALHOST, use 127.0.0.1)
3. Put the same two URLs in for "Web Origins"
1. `http://localhost:5173/auth/callback` (or the URL for the frontend app callback)
2. `http://127.0.0.1:54321/auth/v1/callback` (or the URL for the Supabase callback, for locally running Supabase, DO NOT USE LOCALHOST, use 127.0.0.1)
3. Put the same two URLs in for "Web Origins"
4. Copy the Client Secret under the Clients -> Credentials tab and use in the env variables below
5. You can create users under the "Users" tab and either have them verify their email (if you setup SMTP), or manually mark them as verified.

Expand Down
116 changes: 101 additions & 15 deletions src/leapfrogai_ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading