Skip to content

Commit

Permalink
Drop server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eatonphil committed Nov 10, 2023
1 parent 3c43b7b commit 520407a
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 75 deletions.
84 changes: 30 additions & 54 deletions .github/workflows/pull_requests.yml
Expand Up @@ -314,57 +314,33 @@ jobs:
- run: git reset --hard # release blows everything up
- run: yarn e2e-test

e2e_windows_tests:
name: End-to-end Windows Tests
runs-on: windows-latest

steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}

- uses: c-hive/gha-yarn-cache@v2
- name: Setup Golang caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: ./scripts/ci/prepare_windows.ps1
shell: pwsh
# Needed so we can have ./build/desktop_runner.js ready for tests
- run: yarn build-test-runner
- run: yarn test --detectOpenHandles --forceExit --verbose shared ui desktop
- run: cd runner && go test -race -cover
- run: yarn release-desktop 0.0.0-e2etest
- run: git reset --hard # release blows everything up
- run: yarn e2e-test

server_tests:
name: Server Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}

- uses: c-hive/gha-yarn-cache@v2
- name: Setup Golang caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: ./scripts/ci/prepare_linux.sh
- run: yarn release-server 0.0.0-test
- run: sudo apt-get install -y podman
- run: ./server/scripts/test_release.sh datastation-server-x64-0.0.0-test.tar.gz
# TODO: Get Windows tests working again.
# e2e_windows_tests:
# name: End-to-end Windows Tests
# runs-on: windows-latest

# steps:
# - uses: actions/checkout@master
# with:
# ref: ${{ github.ref }}

# - uses: c-hive/gha-yarn-cache@v2
# - name: Setup Golang caches
# uses: actions/cache@v3
# with:
# path: |
# ~/.cache/go-build
# ~/go/pkg/mod
# key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-golang-

# - run: ./scripts/ci/prepare_windows.ps1
# shell: pwsh
# # Needed so we can have ./build/desktop_runner.js ready for tests
# - run: yarn build-test-runner
# - run: yarn test --detectOpenHandles --forceExit --verbose shared ui desktop
# - run: cd runner && go test -race -cover
# - run: yarn release-desktop 0.0.0-e2etest
# - run: git reset --hard # release blows everything up
# - run: yarn e2e-test
21 changes: 0 additions & 21 deletions .github/workflows/releases.yml
Expand Up @@ -5,27 +5,6 @@ on:
types: [published]

jobs:
build-server:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}

- run: ./scripts/ci/prepare_linux.sh
- run: echo "GIT_TAG=`git tag --points-at HEAD`" >> $GITHUB_ENV
- run: |
echo "RELEASE_ID=`curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/multiprocessio/datastation/releases/tags/$GIT_TAG | jq '.id'`" >> $GITHUB_ENV
- run: yarn release-server $GIT_TAG
- name: Upload on release
run: |
curl --fail \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/tar+gzip" \
--data-binary @./releases/datastation-server-x64-$GIT_TAG.tar.gz \
"https://uploads.github.com/repos/multiprocessio/datastation/releases/$RELEASE_ID/assets?name=datastation-server-x64-$GIT_TAG.tar.gz"
build-linux-desktop:
runs-on: ubuntu-latest

Expand Down
70 changes: 70 additions & 0 deletions e2e/index.js
@@ -0,0 +1,70 @@
const webdriver = require('selenium-webdriver');
const fs = require('fs');
const assert = require('assert');
const path = require('path');
const { spawn } = require('child_process');

async function run() {
const chrome = spawn('yarn', ['run', 'chromedriver'], {
shell: process.platform === 'win32',
});
await new Promise((resolve, reject) => {
try {
chrome.stderr.on('data', (d) =>
process.stderr.write('[CHROME] ' + d + '\n')
);
chrome.stdout.on('data', (data) => {
try {
if (data.includes('ChromeDriver was started successfully.')) {
resolve();
}
process.stdout.write('[CHROME] ' + data + '\n');
} catch (e) {
reject(e);
}
});
} catch (e) {
reject(e);
}
});

const applicationPath = {
darwin: 'DataStation Desktop CE.app/Contents/MacOS/DataStation Desktop CE',
win32: 'DataStation Desktop CE.exe',
linux: 'DataStation Desktop CE',
}[process.platform];

const directory = path.join(
'releases',
`DataStation Desktop CE-${process.platform}-${process.arch}`
);

const driver = new webdriver.Builder()
// The "9515" is the port opened by chrome driver.
.usingServer('http://localhost:9515')
.withCapabilities({
'goog:chromeOptions': {
binary: path.join(process.cwd(), directory, applicationPath),
},
})
.forBrowser('chrome')
.build();

let reached = false;
try {
await driver.wait(async () => {
const title = await driver.getTitle();
assert.equal(title, 'DataStation Desktop CE');
reached = true;
return true;
}, 10_000);
} finally {
await driver.quit();
process.kill(chrome.pid); // This doesn't do anything on Windows. Need to manually `ps | grep chromedriver` and kill it. TODO: script.
}

assert.equal(reached, true);
process.exit(0);
}

run();

0 comments on commit 520407a

Please sign in to comment.