From 280f186fff31e5cce0378b410730843d156ed594 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 09:55:22 +0200 Subject: [PATCH 01/19] Use https://stackoverflow.com/a/58034787/680454 --- test/surface/docker/server/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/surface/docker/server/Dockerfile b/test/surface/docker/server/Dockerfile index cc18eaed2..a373b8295 100644 --- a/test/surface/docker/server/Dockerfile +++ b/test/surface/docker/server/Dockerfile @@ -1,7 +1,8 @@ FROM node:latest RUN git clone https://github.com/solid/node-solid-server WORKDIR node-solid-server -RUN git checkout main +RUN echo Testing branch ${GITHUB_REF##*/} of NSS +RUN git checkout ${GITHUB_REF##*/} RUN npm install RUN openssl req -new -x509 -days 365 -nodes \ -out ./server.cert \ From b79f2feb9e15b7ca7d40d1322ca8972f246e81f1 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:11:51 +0200 Subject: [PATCH 02/19] try out some other ways --- .github/workflows/ci.yml | 3 ++- test/surface/docker/server/Dockerfile | 5 +++-- test/surface/run-solid-test-suite.sh | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f778d1603..21b95e917 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,5 +33,6 @@ jobs: # Test global install of the package - run: npm pack . - run: npm install -g solid-server-*.tgz + - run: echo running on branch ${GITHUB_REF##*/} # Run the Solid test-suite - - run: bash test/surface/run-solid-test-suite.sh + - run: bash test/surface/run-solid-test-suite.sh ${GITHUB_REF##*/} diff --git a/test/surface/docker/server/Dockerfile b/test/surface/docker/server/Dockerfile index a373b8295..cab21d7e7 100644 --- a/test/surface/docker/server/Dockerfile +++ b/test/surface/docker/server/Dockerfile @@ -1,8 +1,9 @@ +ARG BRANCH=main FROM node:latest RUN git clone https://github.com/solid/node-solid-server WORKDIR node-solid-server -RUN echo Testing branch ${GITHUB_REF##*/} of NSS -RUN git checkout ${GITHUB_REF##*/} +RUN echo Testing branch ${BRANCH} of NSS +RUN git checkout ${BRANCH} RUN npm install RUN openssl req -new -x509 -days 365 -nodes \ -out ./server.cert \ diff --git a/test/surface/run-solid-test-suite.sh b/test/surface/run-solid-test-suite.sh index 120e29f37..cdd8e64f5 100755 --- a/test/surface/run-solid-test-suite.sh +++ b/test/surface/run-solid-test-suite.sh @@ -1,9 +1,12 @@ #!/bin/bash set -e +echo Branch name outside bash: $1 +echo Branch name inside bash: ${GITHUB_REF##*/} + function setup { docker network create testnet - docker build -t server test/surface/docker/server + docker build -t server --build-arg BRANCH=${GITHUB_REF##*/} test/surface/docker/server docker build -t cookie test/surface/docker/cookie docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start --config-file /node-solid-server/config.json docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-test start --config-file /surface/thirdparty-config.json From af5ccde732011085d5de5718fa425d503bd94ddc Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:24:42 +0200 Subject: [PATCH 03/19] try out git branch --- .github/workflows/ci.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21b95e917..df06c20e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,18 +21,19 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - # test code - - run: npm run standard - - run: npm run validate - - run: npm run nyc - # Test global install of the package - - run: npm pack . - - run: npm install -g solid-server-*.tgz - - run: echo running on branch ${GITHUB_REF##*/} - # Run the Solid test-suite - - run: bash test/surface/run-solid-test-suite.sh ${GITHUB_REF##*/} + - run: git branch +# - name: Use Node.js ${{ matrix.node-version }} +# uses: actions/setup-node@v1 +# with: +# node-version: ${{ matrix.node-version }} +# - run: npm ci +# # test code +# - run: npm run standard +# - run: npm run validate +# - run: npm run nyc +# # Test global install of the package +# - run: npm pack . +# - run: npm install -g solid-server-*.tgz +# - run: echo running on branch ${GITHUB_REF##*/} +# # Run the Solid test-suite +# - run: bash test/surface/run-solid-test-suite.sh ${GITHUB_REF##*/} From dc02045a9c78bb64dc8888a4acae6b749eaf3428 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:29:35 +0200 Subject: [PATCH 04/19] git reflog show | head -1 | awk '{print ;}' --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df06c20e4..c18ef8f47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v2 - - run: git branch + - run: git reflog show | head -1 | awk '{print $1;}' # - name: Use Node.js ${{ matrix.node-version }} # uses: actions/setup-node@v1 # with: From 6700ea594595f314c56fa655c6a3ab34a0bfe096 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:34:15 +0200 Subject: [PATCH 05/19] Re-add git branch --show-current --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c18ef8f47..badf278c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ jobs: steps: - uses: actions/checkout@v2 + - run: git branch --show-current - run: git reflog show | head -1 | awk '{print $1;}' # - name: Use Node.js ${{ matrix.node-version }} # uses: actions/setup-node@v1 From 69d5e9e7730da487d9c3f569c67b7e5e5518fd41 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:36:20 +0200 Subject: [PATCH 06/19] Try out https://github.com/EthanSK/git-branch-name-action --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index badf278c1..40d44f615 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: git-branch-name + uses: EthanSK/git-branch-name-action@v1 + - name: Echo the branch name + run: echo "Branch name ${GIT_BRANCH_NAME}" - run: git branch --show-current - run: git reflog show | head -1 | awk '{print $1;}' # - name: Use Node.js ${{ matrix.node-version }} From d04d3ce460c468da246cb2cd475efb957c128a00 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:55:29 +0200 Subject: [PATCH 07/19] https://stackoverflow.com/a/68814421/680454 --- .github/workflows/ci.yml | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40d44f615..f606f73de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,24 +21,18 @@ jobs: steps: - uses: actions/checkout@v2 - - name: git-branch-name - uses: EthanSK/git-branch-name-action@v1 - - name: Echo the branch name - run: echo "Branch name ${GIT_BRANCH_NAME}" - - run: git branch --show-current - - run: git reflog show | head -1 | awk '{print $1;}' -# - name: Use Node.js ${{ matrix.node-version }} -# uses: actions/setup-node@v1 -# with: -# node-version: ${{ matrix.node-version }} -# - run: npm ci -# # test code -# - run: npm run standard -# - run: npm run validate -# - run: npm run nyc -# # Test global install of the package -# - run: npm pack . -# - run: npm install -g solid-server-*.tgz -# - run: echo running on branch ${GITHUB_REF##*/} -# # Run the Solid test-suite -# - run: bash test/surface/run-solid-test-suite.sh ${GITHUB_REF##*/} + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + # test code + - run: npm run standard + - run: npm run validate + - run: npm run nyc + # Test global install of the package + - run: npm pack . + - run: npm install -g solid-server-*.tgz + - run: echo running on branch ${GITHUB_REF##*/} + # Run the Solid test-suite + - run: bash test/surface/run-solid-test-suite.sh `git reflog show | head -1 | awk '{print $1;}'` From 0006da939c5793b02e46dc87a06497e7e5d3dc6d Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 10:58:06 +0200 Subject: [PATCH 08/19] fix --- .github/workflows/ci.yml | 26 +++++++++++++------------- test/surface/run-solid-test-suite.sh | 3 +-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f606f73de..4e961d88b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,18 +21,18 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - # test code - - run: npm run standard - - run: npm run validate - - run: npm run nyc - # Test global install of the package - - run: npm pack . - - run: npm install -g solid-server-*.tgz - - run: echo running on branch ${GITHUB_REF##*/} +# - name: Use Node.js ${{ matrix.node-version }} +# uses: actions/setup-node@v1 +# with: +# node-version: ${{ matrix.node-version }} +# - run: npm ci +# # test code +# - run: npm run standard +# - run: npm run validate +# - run: npm run nyc +# # Test global install of the package +# - run: npm pack . +# - run: npm install -g solid-server-*.tgz +# - run: echo running on branch ${GITHUB_REF##*/} # Run the Solid test-suite - run: bash test/surface/run-solid-test-suite.sh `git reflog show | head -1 | awk '{print $1;}'` diff --git a/test/surface/run-solid-test-suite.sh b/test/surface/run-solid-test-suite.sh index cdd8e64f5..0d98c1509 100755 --- a/test/surface/run-solid-test-suite.sh +++ b/test/surface/run-solid-test-suite.sh @@ -2,11 +2,10 @@ set -e echo Branch name outside bash: $1 -echo Branch name inside bash: ${GITHUB_REF##*/} function setup { docker network create testnet - docker build -t server --build-arg BRANCH=${GITHUB_REF##*/} test/surface/docker/server + docker build -t server --build-arg BRANCH=$1 test/surface/docker/server docker build -t cookie test/surface/docker/cookie docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start --config-file /node-solid-server/config.json docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-test start --config-file /surface/thirdparty-config.json From ef5be8676c8298729fc72c52f5b3b7c770cbae45 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:01:24 +0200 Subject: [PATCH 09/19] https://stackoverflow.com/a/63387088/680454 --- .github/workflows/ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e961d88b..ef08f303a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,21 @@ jobs: steps: - uses: actions/checkout@v2 + # extract branch name + - name: Extract branch name + if: github.event_name != 'pull_request' + shell: bash + run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + # extract branch name on pull request + - name: Print branch name + if: github.event_name == 'pull_request' + run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})" + + # print branch name + - name: Get branch name + run: echo 'The branch name is' $BRANCH_NAME # - name: Use Node.js ${{ matrix.node-version }} # uses: actions/setup-node@v1 # with: @@ -35,4 +50,4 @@ jobs: # - run: npm install -g solid-server-*.tgz # - run: echo running on branch ${GITHUB_REF##*/} # Run the Solid test-suite - - run: bash test/surface/run-solid-test-suite.sh `git reflog show | head -1 | awk '{print $1;}'` + - run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME From 3fa190cae141422e3d996fdd38e5e8d5bb658765 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:07:15 +0200 Subject: [PATCH 10/19] combine --- .github/workflows/ci.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef08f303a..300e69882 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,21 +21,15 @@ jobs: steps: - uses: actions/checkout@v2 - # extract branch name - - name: Extract branch name - if: github.event_name != 'pull_request' + # extract commit ref + - name: Extract git ref shell: bash - run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - # extract branch name on pull request - - name: Print branch name - if: github.event_name == 'pull_request' - run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})" + run: echo "##[set-output name=ref;]$(git reflog show | head -1 | awk '{print $1;}')" + id: extract_gitref # print branch name - name: Get branch name - run: echo 'The branch name is' $BRANCH_NAME + run: echo 'The branch name is' ${{ steps.extract_gitref.outputs.ref # - name: Use Node.js ${{ matrix.node-version }} # uses: actions/setup-node@v1 # with: From 23408bc0dba412d8039ccb9459ca160f66376d64 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:11:49 +0200 Subject: [PATCH 11/19] close expression --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 300e69882..844226255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: # print branch name - name: Get branch name - run: echo 'The branch name is' ${{ steps.extract_gitref.outputs.ref + run: echo 'The branch name is' ${{ steps.extract_gitref.outputs.ref }} # - name: Use Node.js ${{ matrix.node-version }} # uses: actions/setup-node@v1 # with: From c091b207a40b7caa1e96c64da460fe338e5571c8 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:16:39 +0200 Subject: [PATCH 12/19] Pass arg into function --- .github/workflows/ci.yml | 33 ++++++++++++++-------------- test/surface/run-solid-test-suite.sh | 2 +- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 844226255..3c55a01d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,22 +26,21 @@ jobs: shell: bash run: echo "##[set-output name=ref;]$(git reflog show | head -1 | awk '{print $1;}')" id: extract_gitref - - # print branch name - - name: Get branch name - run: echo 'The branch name is' ${{ steps.extract_gitref.outputs.ref }} -# - name: Use Node.js ${{ matrix.node-version }} -# uses: actions/setup-node@v1 -# with: -# node-version: ${{ matrix.node-version }} -# - run: npm ci -# # test code -# - run: npm run standard -# - run: npm run validate -# - run: npm run nyc -# # Test global install of the package -# - run: npm pack . -# - run: npm install -g solid-server-*.tgz -# - run: echo running on branch ${GITHUB_REF##*/} + # print git ref + - name: Get git ref + run: echo 'The git ref is' ${{ steps.extract_gitref.outputs.ref }} + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + # test code + - run: npm run standard + - run: npm run validate + - run: npm run nyc + # Test global install of the package + - run: npm pack . + - run: npm install -g solid-server-*.tgz + - run: echo running on branch ${GITHUB_REF##*/} # Run the Solid test-suite - run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME diff --git a/test/surface/run-solid-test-suite.sh b/test/surface/run-solid-test-suite.sh index 0d98c1509..a9741f62a 100755 --- a/test/surface/run-solid-test-suite.sh +++ b/test/surface/run-solid-test-suite.sh @@ -44,7 +44,7 @@ function runTests { # ... teardown || true -setup +setup $1 waitForNss server runTests webid-provider-tests v2.0.3 runTests solid-crud-tests nss-skips From 361ce5024f39447f65c77c9b59d824559e4868db Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:23:37 +0200 Subject: [PATCH 13/19] testing --- .github/workflows/ci.yml | 30 +++++++-------- test/surface/run-solid-test-suite.sh | 55 +--------------------------- 2 files changed, 14 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c55a01d9..471c72ce5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,21 +26,17 @@ jobs: shell: bash run: echo "##[set-output name=ref;]$(git reflog show | head -1 | awk '{print $1;}')" id: extract_gitref - # print git ref - - name: Get git ref - run: echo 'The git ref is' ${{ steps.extract_gitref.outputs.ref }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - # test code - - run: npm run standard - - run: npm run validate - - run: npm run nyc - # Test global install of the package - - run: npm pack . - - run: npm install -g solid-server-*.tgz - - run: echo running on branch ${GITHUB_REF##*/} +# - name: Use Node.js ${{ matrix.node-version }} +# uses: actions/setup-node@v1 +# with: +# node-version: ${{ matrix.node-version }} +# - run: npm ci +# # test code +# - run: npm run standard +# - run: npm run validate +# - run: npm run nyc +# # Test global install of the package +# - run: npm pack . +# - run: npm install -g solid-server-*.tgz # Run the Solid test-suite - - run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME + - run: bash test/surface/run-solid-test-suite.sh ${{ steps.extract_gitref.outputs.ref }} diff --git a/test/surface/run-solid-test-suite.sh b/test/surface/run-solid-test-suite.sh index a9741f62a..f633e4cd4 100755 --- a/test/surface/run-solid-test-suite.sh +++ b/test/surface/run-solid-test-suite.sh @@ -1,63 +1,10 @@ #!/bin/bash set -e -echo Branch name outside bash: $1 function setup { + echo Branch name: $1 docker network create testnet docker build -t server --build-arg BRANCH=$1 test/surface/docker/server - docker build -t cookie test/surface/docker/cookie - docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start --config-file /node-solid-server/config.json - docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-test start --config-file /surface/thirdparty-config.json } -function teardown { - docker stop `docker ps --filter network=testnet -q` - docker rm `docker ps --filter network=testnet -qa` - docker network remove testnet -} - -function waitForNss { - docker pull solidtestsuite/webid-provider-tests - until docker run --rm --network=testnet solidtestsuite/webid-provider-tests curl -kI https://$1 2> /dev/null > /dev/null - do - echo Waiting for $1 to start, this can take up to a minute ... - docker ps -a - docker logs $1 - sleep 1 - done - - docker logs $1 - echo Getting cookie for $1... - export COOKIE_$1="`docker run --cap-add=SYS_ADMIN --network=testnet --env-file test/surface/$1-env.list cookie`" -} - -function runTests { - docker pull solidtestsuite/$1:$2 - - echo "Running $1 against server with cookie $COOKIE_server" - docker run --rm --network=testnet \ - --env COOKIE="$COOKIE_server" \ - --env COOKIE_ALICE="$COOKIE_server" \ - --env COOKIE_BOB="$COOKIE_thirdparty" \ - --env-file test/surface/$1-env.list solidtestsuite/$1:$2 -} - -# ... -teardown || true setup $1 -waitForNss server -runTests webid-provider-tests v2.0.3 -runTests solid-crud-tests nss-skips -waitForNss thirdparty -runTests web-access-control-tests v5.1.0 -teardown - -# To debug, e.g. running web-access-control-tests jest interactively, -# comment out `teardown` and uncomment this instead: -# env -# docker run -it --network=testnet \ -# --env COOKIE="$COOKIE_server" \ -# --env COOKIE_ALICE="$COOKIE_server" \ -# --env COOKIE_BOB="$COOKIE_thirdparty" \ -# --env-file test/surface/web-access-control-tests-env.list \ -# solidtestsuite/web-access-control-tests:latest /bin/bash From b7363c1f8d846d2f98939dc118f56337e3ef8034 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:28:51 +0200 Subject: [PATCH 14/19] ARG after FROM --- test/surface/docker/server/Dockerfile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/surface/docker/server/Dockerfile b/test/surface/docker/server/Dockerfile index cab21d7e7..34d20d675 100644 --- a/test/surface/docker/server/Dockerfile +++ b/test/surface/docker/server/Dockerfile @@ -1,17 +1,8 @@ -ARG BRANCH=main FROM node:latest +ARG BRANCH=main +RUN echo Testing branch ${BRANCH} of NSS RUN git clone https://github.com/solid/node-solid-server WORKDIR node-solid-server -RUN echo Testing branch ${BRANCH} of NSS RUN git checkout ${BRANCH} -RUN npm install -RUN openssl req -new -x509 -days 365 -nodes \ - -out ./server.cert \ - -keyout ./server.key \ - -subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro" -EXPOSE 443 -ADD config.json . -ADD config ./config -ADD data ./data -ADD .db ./.db -CMD ./bin/solid-test start +RUN git status + From 36540b6db27f4d0524e3b570cb06457c9a6d5d25 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:37:22 +0200 Subject: [PATCH 15/19] with safe env --- .github/workflows/ci.yml | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 471c72ce5..ad8df1f2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,22 +21,12 @@ jobs: steps: - uses: actions/checkout@v2 - # extract commit ref - - name: Extract git ref - shell: bash - run: echo "##[set-output name=ref;]$(git reflog show | head -1 | awk '{print $1;}')" - id: extract_gitref -# - name: Use Node.js ${{ matrix.node-version }} -# uses: actions/setup-node@v1 -# with: -# node-version: ${{ matrix.node-version }} -# - run: npm ci -# # test code -# - run: npm run standard -# - run: npm run validate -# - run: npm run nyc -# # Test global install of the package -# - run: npm pack . -# - run: npm install -g solid-server-*.tgz - # Run the Solid test-suite - - run: bash test/surface/run-solid-test-suite.sh ${{ steps.extract_gitref.outputs.ref }} + # extract branch name + - if: github.event_name == 'pull_request' + run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV + - if: github.event_name != 'pull_request' + run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + + # print branch name + - name: Get branch name + run: echo 'The branch name is' $BRANCH_NAME From 5b48ca0412422a84b7566d7f636eaf43e6239c43 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:42:00 +0200 Subject: [PATCH 16/19] into Docker --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad8df1f2b..bc4a19987 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,3 +30,18 @@ jobs: # print branch name - name: Get branch name run: echo 'The branch name is' $BRANCH_NAME + +# - name: Use Node.js ${{ matrix.node-version }} +# uses: actions/setup-node@v1 +# with: +# node-version: ${{ matrix.node-version }} +# - run: npm ci +# # test code +# - run: npm run standard +# - run: npm run validate +# - run: npm run nyc +# # Test global install of the package +# - run: npm pack . +# - run: npm install -g solid-server-*.tgz +# # Run the Solid test-suite + - run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME From 72f8c7def0732658e74bab847b1067f299ec2700 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:45:25 +0200 Subject: [PATCH 17/19] Add some things back --- .github/workflows/ci.yml | 2 +- test/surface/docker/server/Dockerfile | 12 +++++- test/surface/run-solid-test-suite.sh | 56 +++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc4a19987..0594a917f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV # print branch name - - name: Get branch name + - name: Get branch name run: echo 'The branch name is' $BRANCH_NAME # - name: Use Node.js ${{ matrix.node-version }} diff --git a/test/surface/docker/server/Dockerfile b/test/surface/docker/server/Dockerfile index 34d20d675..da4c24609 100644 --- a/test/surface/docker/server/Dockerfile +++ b/test/surface/docker/server/Dockerfile @@ -5,4 +5,14 @@ RUN git clone https://github.com/solid/node-solid-server WORKDIR node-solid-server RUN git checkout ${BRANCH} RUN git status - +RUN npm install +RUN openssl req -new -x509 -days 365 -nodes \ + -out ./server.cert \ + -keyout ./server.key \ + -subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro" +EXPOSE 443 +ADD config.json . +ADD config ./config +ADD data ./data +ADD .db ./.db +CMD ./bin/solid-test start diff --git a/test/surface/run-solid-test-suite.sh b/test/surface/run-solid-test-suite.sh index f633e4cd4..4f4492ba3 100755 --- a/test/surface/run-solid-test-suite.sh +++ b/test/surface/run-solid-test-suite.sh @@ -6,5 +6,61 @@ function setup { echo Branch name: $1 docker network create testnet docker build -t server --build-arg BRANCH=$1 test/surface/docker/server + docker build -t cookie test/surface/docker/cookie + docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start - +config-file /node-solid-server/config.json + docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-t +st start --config-file /surface/thirdparty-config.json } +function teardown { + docker stop `docker ps --filter network=testnet -q` + docker rm `docker ps --filter network=testnet -qa` + docker network remove testnet +} + +function waitForNss { + docker pull solidtestsuite/webid-provider-tests + until docker run --rm --network=testnet solidtestsuite/webid-provider-tests curl -kI https://$1 2> /dev/null > /dev/null + do + echo Waiting for $1 to start, this can take up to a minute ... + docker ps -a + docker logs $1 + sleep 1 + done + + docker logs $1 + echo Getting cookie for $1... + export COOKIE_$1="`docker run --cap-add=SYS_ADMIN --network=testnet --env-file test/surface/$1-env.list cookie`" +} + +function runTests { + docker pull solidtestsuite/$1:$2 + + echo "Running $1 against server with cookie $COOKIE_server" + docker run --rm --network=testnet \ + --env COOKIE="$COOKIE_server" \ + --env COOKIE_ALICE="$COOKIE_server" \ + --env COOKIE_BOB="$COOKIE_thirdparty" \ + --env-file test/surface/$1-env.list solidtestsuite/$1:$2 +} + +# ... +teardown || true setup $1 +waitForNss server +runTests webid-provider-tests v2.0.3 +runTests solid-crud-tests nss-skips +waitForNss thirdparty +runTests web-access-control-tests v5.1.0 +teardown + +# To debug, e.g. running web-access-control-tests jest interactively, +# comment out `teardown` and uncomment this instead: +# env +# docker run -it --network=testnet \ +# --env COOKIE="$COOKIE_server" \ +# --env COOKIE_ALICE="$COOKIE_server" \ +# --env COOKIE_BOB="$COOKIE_thirdparty" \ +# --env-file test/surface/web-access-control-tests-env.list \ +# solidtestsuite/web-access-control-tests:latest /bin/bash + From 224ef5a956a68807b712865b1b58b592977fda49 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:45:51 +0200 Subject: [PATCH 18/19] uncomment --- .github/workflows/ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0594a917f..31e5c3000 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,17 +31,17 @@ jobs: - name: Get branch name run: echo 'The branch name is' $BRANCH_NAME -# - name: Use Node.js ${{ matrix.node-version }} -# uses: actions/setup-node@v1 -# with: -# node-version: ${{ matrix.node-version }} -# - run: npm ci -# # test code -# - run: npm run standard -# - run: npm run validate -# - run: npm run nyc -# # Test global install of the package -# - run: npm pack . -# - run: npm install -g solid-server-*.tgz -# # Run the Solid test-suite + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + # test code + - run: npm run standard + - run: npm run validate + - run: npm run nyc + # Test global install of the package + - run: npm pack . + - run: npm install -g solid-server-*.tgz + # Run the Solid test-suite - run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME From 38d9dd32d3c095aae667cc8f27deeaae0eebc586 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Tue, 17 Aug 2021 11:47:35 +0200 Subject: [PATCH 19/19] oops --- test/surface/run-solid-test-suite.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/surface/run-solid-test-suite.sh b/test/surface/run-solid-test-suite.sh index 4f4492ba3..8ac39b0f3 100755 --- a/test/surface/run-solid-test-suite.sh +++ b/test/surface/run-solid-test-suite.sh @@ -7,10 +7,8 @@ function setup { docker network create testnet docker build -t server --build-arg BRANCH=$1 test/surface/docker/server docker build -t cookie test/surface/docker/cookie - docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start - -config-file /node-solid-server/config.json - docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-t -st start --config-file /surface/thirdparty-config.json + docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start --config-file /node-solid-server/config.json + docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-test start --config-file /surface/thirdparty-config.json } function teardown { docker stop `docker ps --filter network=testnet -q`