Skip to content

Commit

Permalink
Merge pull request #7 from trunk-io/nikhil/upload-tests
Browse files Browse the repository at this point in the history
feat(tests): Add and Run Tests in CI
  • Loading branch information
nikhilbirmiwal authored Jul 14, 2023
2 parents 6946d9f + 3f4be36 commit 6835693
Show file tree
Hide file tree
Showing 12 changed files with 806 additions and 8 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull Request
on: pull_request

jobs:
tests:
runs-on: ubuntu-latest
name: Run Tests
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Bazel
uses: bazelbuild/setup-bazelisk@v2

- name: Run Tests
run: |
bazel run //tests:test_image
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ dependent PRs; no more waiting for your backend changes to test before landing y

### How it Works

After creating a MergeGraph [app.trunk.io](app.trunk.io), simply comment `/trunk merge` on your PRs
to submit it to the graph. Once the graph has passed the prerequisites to be admitted into the graph
(impacted targets have been uploaded, Github deems the PR mergeable), the Trunk Service will
After creating a MergeGraph at [app.trunk.io](app.trunk.io), simply comment `/trunk merge` on your
PRs to submit it to the graph. Once the graph has passed the prerequisites to be admitted into the
graph (impacted targets have been uploaded, Github deems the PR mergeable), the Trunk Service will
en-graph the PR, constructing a test branch between the PR and all of its ancestors. On successful
completion of tests, Trunk merges the PR, keeping your main branch green 😎.

Expand Down Expand Up @@ -41,6 +41,10 @@ jobs:
<!-- end usage -->
### Tests
`bazel run //tests:test_image`

### What is an Impacted Target?

An impacted target is a unit that is affected by a particular PR. For example, a change at
Expand Down
6 changes: 3 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ runs:
- name: Prerequisites
id: prerequisites
run: ${GITHUB_ACTION_PATH}/prerequisites.sh
run: ${GITHUB_ACTION_PATH}/src/scripts/prerequisites.sh
shell: bash
env:
TARGET_BRANCH: ${{ inputs.target-branch }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}

- name: Compute Impacted Targets
id: compute-impacted-targets
run: ${GITHUB_ACTION_PATH}/compute_impacted_targets.sh
run: ${GITHUB_ACTION_PATH}/src/scripts/compute_impacted_targets.sh
shell: bash
env:
MERGE_INSTANCE_BRANCH: ${{ steps.prerequisites.outputs.merge_instance_branch }}
PR_BRANCH: ${{ github.head_ref }}
VERBOSE: ${{ inputs.verbose }}

- name: Upload Impacted Targets
run: ${GITHUB_ACTION_PATH}/upload_impacted_targets.sh
run: ${GITHUB_ACTION_PATH}/src/scripts/upload_impacted_targets.sh
shell: bash
env:
ACTOR: ${{ github.actor }}
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@
},
"dependencies": {
"@types/node": "20.4.2",
"typescript": "5.1.6"
"typescript": "5.1.6",
"zod": "3.21.4"
},
"devDependencies": {
"@types/chai": "4.3.5",
"@types/chai-as-promised": "7.1.5",
"@types/express": "4.17.17",
"@types/lodash": "4.14.195",
"@types/mocha": "10.0.1",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"express": "4.18.2",
"http-status-codes": "2.2.0",
"lodash": "4.17.21",
"mocha": "10.2.0"
}
}
Loading

0 comments on commit 6835693

Please sign in to comment.