Skip to content

Commit c06c23d

Browse files
Run test suite on branch (#1610)
* Use https://stackoverflow.com/a/58034787/680454 * try out some other ways * try out git branch * git reflog show | head -1 | awk '{print ;}' * Re-add git branch --show-current * Try out https://github.com/EthanSK/git-branch-name-action * https://stackoverflow.com/a/68814421/680454 * fix * https://stackoverflow.com/a/63387088/680454 * combine * close expression * Pass arg into function * testing * ARG after FROM * with safe env * into Docker * Add some things back * uncomment * oops
1 parent 53dde07 commit c06c23d

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v2
24+
# extract branch name
25+
- if: github.event_name == 'pull_request'
26+
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
27+
- if: github.event_name != 'pull_request'
28+
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
29+
30+
# print branch name
31+
- name: Get branch name
32+
run: echo 'The branch name is' $BRANCH_NAME
33+
2434
- name: Use Node.js ${{ matrix.node-version }}
2535
uses: actions/setup-node@v1
2636
with:
@@ -34,4 +44,4 @@ jobs:
3444
- run: npm pack .
3545
- run: npm install -g solid-server-*.tgz
3646
# Run the Solid test-suite
37-
- run: bash test/surface/run-solid-test-suite.sh
47+
- run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME

test/surface/docker/server/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
FROM node:latest
2+
ARG BRANCH=main
3+
RUN echo Testing branch ${BRANCH} of NSS
24
RUN git clone https://github.com/solid/node-solid-server
35
WORKDIR node-solid-server
4-
RUN git checkout main
6+
RUN git checkout ${BRANCH}
7+
RUN git status
58
RUN npm install
69
RUN openssl req -new -x509 -days 365 -nodes \
710
-out ./server.cert \

test/surface/run-solid-test-suite.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
22
set -e
33

4+
45
function setup {
6+
echo Branch name: $1
57
docker network create testnet
6-
docker build -t server test/surface/docker/server
8+
docker build -t server --build-arg BRANCH=$1 test/surface/docker/server
79
docker build -t cookie test/surface/docker/cookie
810
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
911
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
@@ -42,7 +44,7 @@ function runTests {
4244

4345
# ...
4446
teardown || true
45-
setup
47+
setup $1
4648
waitForNss server
4749
runTests webid-provider-tests v2.0.3
4850
runTests solid-crud-tests nss-skips
@@ -59,3 +61,4 @@ teardown
5961
# --env COOKIE_BOB="$COOKIE_thirdparty" \
6062
# --env-file test/surface/web-access-control-tests-env.list \
6163
# solidtestsuite/web-access-control-tests:latest /bin/bash
64+

0 commit comments

Comments
 (0)