From ac5cd9b3e93e80118cad98d9ed4abe6e91196b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Pitk=C3=A4nen?= Date: Thu, 17 Jun 2021 00:14:02 +0300 Subject: [PATCH 1/2] Run test suite on GitHub actions * Needs work on analysis script and publishing logic before done * Rewrote "docker compose" -> "docker-compose" in scripts as GH Actions didn't support the former --- .github/workflows/test-suite.yml | 34 ++++++++++++++++++++++++++++++++ package.json | 12 +++++------ 2 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/test-suite.yml diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml new file mode 100644 index 0000000..85c7d8e --- /dev/null +++ b/.github/workflows/test-suite.yml @@ -0,0 +1,34 @@ +name: Deploy UI + +on: + push: + branches: [main, test/gh-actions-run-test-suite] # TODO: remove test branch! + +jobs: + run_test_suite: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install top level dependencies + run: npm ci + + - name: Transpile the types package + run: | + cd types + npm ci + npm run tsc + + - name: TESTING, run the test suite + run: npm run full-test-suite + + - name: list and print result + run: | + ls -la results + echo "" + cat results/* + + - name: give a friendly reminder + run: | + echo "TODO: do something with the results" diff --git a/package.json b/package.json index b8b05fc..65e11f4 100644 --- a/package.json +++ b/package.json @@ -10,25 +10,25 @@ "sync-data": "mkdir -p visualization-ui/src/data && rm -f visualization-ui/src/data/* && cp results/*.publish.json visualization-ui/src/data", "cli": "npm run tsc && node cli.js", "full-test-suite": "npm run tsc && node runTestSuite.js", - "test:benchmark": "docker compose -f ./ipc-methods/benchmark/docker-compose.yml up", + "test:benchmark": "docker-compose -f ./ipc-methods/benchmark/docker-compose.yml up", "test:benchmark:raw": "npm run tsc && node --max-old-space-size=1536 ./ipc-methods/benchmark/main.js", - "test:unix-socket": "docker compose -f ./ipc-methods/unix-socket/docker-compose.yml up", + "test:unix-socket": "docker-compose -f ./ipc-methods/unix-socket/docker-compose.yml up", "test:unix-socket:server": "THE_OPERATION_SOCKET_PATH=/tmp/unix-socket node --max-old-space-size=1536 ./ipc-methods/unix-socket/server.js", "test:unix-socket:main": "THE_OPERATION_SOCKET_PATH=/tmp/unix-socket node --max-old-space-size=1536 ./ipc-methods/unix-socket/main.js", "test:unix-socket:raw": "unlink /tmp/unix-socket && npm run tsc && concurrently \"npm run test:unix-socket:server\" \"npm run test:unix-socket:main\"", - "test:tcp": "docker compose -f ./ipc-methods/tcp/docker-compose.yml up", + "test:tcp": "docker-compose -f ./ipc-methods/tcp/docker-compose.yml up", "test:tcp:server": "node --max-old-space-size=1536 ./ipc-methods/tcp/server.js", "test:tcp:main": "THE_OPERATION_ENDPOINT_HOSTNAME=localhost THE_OPERATION_ENDPOINT_PORT=3000 node --max-old-space-size=1536 ./ipc-methods/tcp/main.js", "test:tcp:raw": "npm run tsc && concurrently \"npm run test:tcp:server\" \"npm run test:tcp:main\"", - "test:http": "docker compose -f ./ipc-methods/http/docker-compose.yml up", + "test:http": "docker-compose -f ./ipc-methods/http/docker-compose.yml up", "test:http:server": "node --max-old-space-size=1536 ./ipc-methods/http/server.js", "test:http:main": "THE_OPERATION_ENDPOINT_HOSTNAME=localhost THE_OPERATION_ENDPOINT_PORT=3000 node --max-old-space-size=1536 ./ipc-methods/http/main.js", "test:http:raw": "npm run tsc && concurrently \"npm run test:http:server\" \"npm run test:http:main\"", - "test:http-express-axios": "docker compose -f ./ipc-methods/http-express-axios/docker-compose.yml up", + "test:http-express-axios": "docker-compose -f ./ipc-methods/http-express-axios/docker-compose.yml up", "test:http-express-axios:server": "node --max-old-space-size=1536 ./ipc-methods/http-express-axios/server.js", "test:http-express-axios:main": "THE_OPERATION_ENDPOINT_HOSTNAME=localhost THE_OPERATION_ENDPOINT_PORT=3000 node --max-old-space-size=1536 ./ipc-methods/http-express-axios/main.js", "test:http-express-axios:raw": "npm run tsc && concurrently \"npm run test:http-express-axios:server\" \"npm run test:http-express-axios:main\"", - "test:https": "docker compose -f ./ipc-methods/https/docker-compose.yml up", + "test:https": "docker-compose -f ./ipc-methods/https/docker-compose.yml up", "test:https:server": "KEY_PATH=./ipc-methods/https/localhost.pem CERT_PATH=./ipc-methods/https/localhost-cert.pem node --max-old-space-size=1536 ./ipc-methods/https/server.js", "test:https:main": "CERT_PATH=./ipc-methods/https/localhost-cert.pem THE_OPERATION_ENDPOINT_HOSTNAME=localhost THE_OPERATION_ENDPOINT_PORT=3000 node --max-old-space-size=1536 ./ipc-methods/https/main.js", "test:https:raw": "npm run tsc && concurrently \"npm run test:https:server\" \"npm run test:https:main\"", From 07ed7f5f0159825833badac87cfe834a4bcffb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Pitk=C3=A4nen?= Date: Wed, 7 Jul 2021 00:04:28 +0300 Subject: [PATCH 2/2] Try publishing results with GH Actions * Dumb down the publish script since the on-the-fly analysis is not yet implemented --- .github/workflows/test-suite.yml | 24 ++++++++++++------------ package.json | 3 ++- results/createResultsIndex.ts | 3 ++- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 85c7d8e..a63e45c 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -1,4 +1,4 @@ -name: Deploy UI +name: Run test suite on: push: @@ -12,7 +12,8 @@ jobs: - uses: actions/checkout@v2 - name: Install top level dependencies - run: npm ci + run: | + npm ci - name: Transpile the types package run: | @@ -20,15 +21,14 @@ jobs: npm ci npm run tsc - - name: TESTING, run the test suite - run: npm run full-test-suite + # - name: Run the test suite + # run: npm run full-test-suite - - name: list and print result + - name: Create results index and publish run: | - ls -la results - echo "" - cat results/* - - - name: give a friendly reminder - run: | - echo "TODO: do something with the results" + npm run tsc + npm run index-results + git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + npm run publish-results -- -u "github-actions-bot " + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 65e11f4..d094fdd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "tsc -w", "tsc": "tsc", - "publish-results": "node results/createResultsIndex.js && gh-pages -d results -b results -a", + "index-results": "node results/createResultsIndex.js", + "publish-results": "gh-pages -d results -b results -a", "sync-data": "mkdir -p visualization-ui/src/data && rm -f visualization-ui/src/data/* && cp results/*.publish.json visualization-ui/src/data", "cli": "npm run tsc && node cli.js", "full-test-suite": "npm run tsc && node runTestSuite.js", diff --git a/results/createResultsIndex.ts b/results/createResultsIndex.ts index 6e2128d..98add6d 100644 --- a/results/createResultsIndex.ts +++ b/results/createResultsIndex.ts @@ -10,7 +10,8 @@ const createResultsIndex = async () => { try { const files = await fs.promises.readdir(path.join('results')); - const analyzedFiles = files.filter(file => /.analyzed.json/.test(file)); + // const analyzedFiles = files.filter(file => /.analyzed.json/.test(file)); + const analyzedFiles = files; // FIXME: change when on-the-fly analysis is implemented fs.writeFileSync( path.join('results', 'index.json'),