Skip to content

Commit

Permalink
reorganize into separate directories
Browse files Browse the repository at this point in the history
  • Loading branch information
wuweiweiwu committed Nov 25, 2024
1 parent ce9844d commit eed03b3
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-amazon-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches:
- main

jobs:
run-tests-on-amazon-linux:
name: Run tests
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
# Run tests
cat momentic.config.yaml
npx momentic@^1 run momentic/google-test.test.yaml
npx momentic@latest run google-test.test.yaml
EOF
Expand All @@ -73,8 +73,8 @@ jobs:
run: |
docker run -d --name momentic --network host -e MOMENTIC_API_KEY='${{ secrets.MOMENTIC_API_KEY }}' ubuntu:20.04 sleep infinity
docker cp run_tests.sh momentic:/run_tests.sh
docker cp momentic.config.yaml momentic:/momentic.config.yaml
docker cp momentic momentic:/
docker cp single-project/momentic.config.yaml momentic:/momentic.config.yaml
docker cp single-project/ momentic:/
docker exec momentic bash /run_tests.sh
# Section 5: Cleanup
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-pr-inputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
repository-projects: read
strategy:
fail-fast: false
defaults:
run:
working-directory: ./single-project
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
Expand All @@ -24,4 +27,4 @@ jobs:
with:
node-version: 21
cache: "pnpm"
- run: npx momentic@^1 run --input-csv momentic/data/inputs.csv momentic/input-from-csv-test.test.yaml
- run: npx momentic@latest run --input-csv data/inputs.csv input-from-csv-test.test.yaml
8 changes: 4 additions & 4 deletions .github/workflows/test-pr-multi-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
repository-projects: read
defaults:
run:
working-directory: ./multi-project-workspace-example
working-directory: ./multi-project-workspace
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
Expand All @@ -28,12 +28,12 @@ jobs:
- name: Install dependencies
run: pnpm i
- name: Run specific marketing tests using project name and substring match
run: npx momentic@^1 run --filter marketing variable
run: npx momentic@latest run --filter marketing variable
env:
VAR_FROM_SHELL: test-var-from-shell
- name: Run all QA tests using config path
run: npx momentic@^1 run --config qa/momentic.config.yaml .
run: npx momentic@latest run --config qa/momentic.config.yaml .
- name: Run dashboard tests using absolute path
run: |
cd apps/dashboard
npx momentic@^1 run google-search.test.yaml
npx momentic@latest run google-search.test.yaml
5 changes: 4 additions & 1 deletion .github/workflows/test-pr-sharding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
matrix:
shardIndex: [1, 2]
shardTotal: [2]
defaults:
run:
working-directory: ./single-project
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
Expand All @@ -30,7 +33,7 @@ jobs:
- name: Install dependencies
run: pnpm i
- run: |
npx momentic@^1 run momentic/create-react-app-test.test.yaml \
npx momentic@latest run create-react-app-test.test.yaml \
--start "npm run start" \
--env development \
--shard-index ${{ matrix.shardIndex }} \
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
permissions:
contents: read
repository-projects: read
defaults:
run:
working-directory: ./single-project
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
Expand All @@ -24,4 +27,4 @@ jobs:
cache: "pnpm"
- name: Install dependencies
run: pnpm i
- run: npx momentic@^1 run momentic/create-react-app-test.test.yaml --start "npm run start" --env development
- run: npx momentic@latest run create-react-app-test.test.yaml --start "npm run start" --env development
5 changes: 4 additions & 1 deletion .github/workflows/test-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ jobs:
permissions:
contents: read
repository-projects: read
defaults:
run:
working-directory: ./single-project
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 21
- run: npx momentic@^1 queue tests create-react-app-test
- run: npx momentic@latest queue tests create-react-app-test
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Momentic GitHub Actions demo

This repo uses the [Momentic CLI](https://docs.momentic.ai/cli/installation) to:
This repo contains usage examples and patterns for the [Momentic CLI](https://momentic.ai/docs/cli/v1/installation).

1. Trigger Momentic cloud test runs on every push to `main`.
2. Run local tests against a local React app on every pull request.
- [Workspace](multi-project-workspace/)
- [Project](single-project/)
- CI/CD workflows
- [Amazon Linux](.github/workflows/test-amazon-linux.yml)
- [CSV inputs](.github/workflows/test-pr-inputs.yml)
- [Multiple projects](.github/workflows/test-pr-multi-project.yml)
- [Sharding](.github/workflows/test-pr-sharding.yml)
- [Run in a PR](.github/workflows/test-pr.yml)
- [Queue in cloud](.github/workflows/test-prod.yml)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ projects:
- qa
# immediate children directories of apps
- apps/*

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions momentic.config.yaml → single-project/momentic.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: default
include:
- "**/*.test.yaml"
- "**/*.module.yaml"
exclude:
- "multi-project-workspace-example/**/*"
environments:
- name: development
baseUrl: https://momentic-github-actions-demo.vercel.app/
Expand Down

0 comments on commit eed03b3

Please sign in to comment.