Skip to content

Commit

Permalink
fix: Repository for Surface Tests
Browse files Browse the repository at this point in the history
Picks the repository from where the PR branch exists.
  • Loading branch information
CxRes committed Sep 9, 2024
1 parent 8021633 commit e0ebc31
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,25 @@ jobs:

steps:
- uses: actions/checkout@v4

# extract repository name
- if: github.event_name == 'pull_request'
run: echo "REPO_NAME=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV

- if: github.event_name != 'pull_request'
run: echo "REPO_NAME=${GITHUB_REPOSITORY}" >> $GITHUB_ENV

# 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 repository name
- name: Get repository name
run: echo 'The repository name is' $REPO_NAME

# print branch name
- name: Get branch name
run: echo 'The branch name is' $BRANCH_NAME
Expand All @@ -45,7 +58,7 @@ jobs:
- 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 $BRANCH_NAME $REPO_NAME

# TODO: The pipeline should automate publication to npm, so that the docker build gets the correct version
# This job will only dockerize solid-server@latest / solid-server@<tag-name> from npmjs.com!
Expand Down
3 changes: 2 additions & 1 deletion test/surface/docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM node:latest
ARG BRANCH=main
ARG REPO=nodeSolidServer/node-solid-server
RUN echo Testing branch ${BRANCH} of NSS
RUN git clone https://github.com/nodeSolidServer/node-solid-server
RUN git clone https://github.com/${REPO}
WORKDIR node-solid-server
RUN git checkout ${BRANCH}
RUN git status
Expand Down
8 changes: 4 additions & 4 deletions test/surface/run-solid-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ set -e

function setup {
echo Branch name: $1
echo Repoitory: $2
docker network create testnet
docker build -t server --build-arg BRANCH=$1 test/surface/docker/server
docker build -t server --build-arg BRANCH=$1 --build-arg REPO=$2 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
Expand Down Expand Up @@ -32,7 +33,7 @@ function waitForNss {

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" \
Expand All @@ -54,7 +55,7 @@ function runTestsFromGit {

# ...
teardown || true
setup $1
setup $1 $2
waitForNss server
runTests webid-provider-tests v2.0.3
runTestsFromGit solid-crud-tests v6.0.0-issue#1743
Expand All @@ -72,4 +73,3 @@ teardown
# --env COOKIE_BOB="$COOKIE_thirdparty" \
# --env-file test/surface/web-access-control-tests-env.list \
# solidtestsuite/web-access-control-tests:latest /bin/bash

0 comments on commit e0ebc31

Please sign in to comment.