Skip to content

Commit

Permalink
feat: add CI provider info
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliimelnychuk committed Dec 12, 2022
1 parent 11af660 commit 403be98
Show file tree
Hide file tree
Showing 6 changed files with 769 additions and 12 deletions.
18 changes: 18 additions & 0 deletions examples/nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ To learn more about Next.js, take a look at the following resources:

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Run Currents runner

In order to run currents runner you can use the following command:

> Make sure that .env file created and you have `CURRENTS_RECORD_KEY` env variable set up
```
yarn cypress
```

### Simulate currents runner execution from CI

- Github Actions

```
bash ./test/run-from-github-actions.sh
```

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js.
Expand Down
14 changes: 14 additions & 0 deletions examples/nextjs/test/run-from-github-actions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Main bariable based on what all others will be stored
export GITHUB_ACTIONS=1

export GITHUB_WORKFLOW=
export GITHUB_ACTION=
export GITHUB_EVENT_NAME=
export GITHUB_RUN_ID=
export GITHUB_RUN_ATTEMPT=
export GITHUB_REPOSITORY=
export GITHUB_REPOSITORY=

node ../../packages/cypress-runner --parallel --record --key ${CURRENTS_RECORD_KEY} --ci-build-id $(date +%s)
22 changes: 12 additions & 10 deletions packages/cypress-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import {
} from "./lib/results";
import { findSpecs } from "./lib/specMatcher";
import { Platform, TestingType } from "./types";
import {
getCommitDefaults,
getCiParams,
getCiProvider,
} from "./lib/ciProvider";

const stdout = capture.stdout();

Expand Down Expand Up @@ -77,21 +82,18 @@ export async function run() {
browserName: "Electron",
browserVersion: "106.0.5249.51",
};
const ci = {
params: getCiParams(),
provider: getCiProvider(),
};
console.log("CI info", ci);
const res = await makeRequest({
method: "POST",
url: "runs",
data: {
ci: {
params: null,
provider: null,
},
ci,
specs: specs.map((spec) => spec.relative),
commit: {
...commit,
remoteOrigin: commit.remote,
authorEmail: commit.email,
authorName: commit.author,
},
commit: getCommitDefaults(commit),
group,
platform,
parallel,
Expand Down
Loading

0 comments on commit 403be98

Please sign in to comment.