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

Add upstream LSP tests to CI #210

Merged
merged 19 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
run E2E tests in github actions instead of circleCI
  • Loading branch information
phryneas committed Sep 18, 2024
commit 6c1cfa47a418d22e137e5cefc4189d7566bec227
15 changes: 0 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ jobs:
name: Test
command: npm run test -- --runInBand

E2E tests:
executor: node
steps:
- checkout
- npm-install
- run: sudo apt update && sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb
- run:
name: Build
command: npm run build:production
- run:
command: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env
- run:
name: E2E tests
command: xvfb-run -a npm run test:extension

workflows:
build-test-deploy:
jobs:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/E2E.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run E2E tests
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: Run E2E tests
runs-on: ubuntu-latest
steps:
- run: sudo apt update && sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "npm"
- run: npm install
- run: npm run build:production
- run: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env
- run: |
expect <<EOF pr/extend-ci
spawn ./node_modules/.bin/rover config auth --profile VSCode-E2E
expect "Copy the key and paste it into the prompt below."
send -- "test\n"
expect eof
EOF
- run: xvfb-run -a npm run test:extension
2 changes: 1 addition & 1 deletion sampleWorkspace/rover/apollo.config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rover:
profile: default
bin: ../../node_modules/@apollo/rover/binary/rover-0.27.0-alpha.0
bin: ../../node_modules/.bin/rover
36 changes: 36 additions & 0 deletions src/language-server/__e2e__/rover.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { test as origTest } from "@jest/globals";
import { load } from "js-yaml";
import { readFileSync } from "node:fs";
import { execFileSync } from "node:child_process";
import { join } from "node:path";
import { ParsedApolloConfigFormat } from "../config";

// we want to skip these tests unless the user running them has a rover config profile named "VSCode-E2E"
let test = origTest.skip;
try {
const roverProjectDir = join(__dirname, "../../../sampleWorkspace/rover");
const config = load(
readFileSync(join(roverProjectDir, "apollo.config.yaml"), "utf-8"),
) as ParsedApolloConfigFormat;
const roverBin = join(roverProjectDir, config.rover!.bin);
const result = execFileSync(roverBin, [
"config",
"list",
"--format=json",
]).toString("utf8");
const parsed = JSON.parse(result);
if (parsed.data.profiles.includes("VSCode-E2E")) {
test = origTest;
}
} catch (e) {}
if (test === origTest.skip) {
console.info(
"Skipping rover E2E tests: no profile with the name 'VSCode-E2E'\n" +
"You can create one by running `rover config auth --profile VSCode-E2E`",
);
}

test("result", () => {
// deliberately fail the test to show that it's running
expect(true).toBeFalsy();
});