From d295861a7dbdcf8673a280c5cec14ec78903f804 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sun, 28 Feb 2021 22:18:27 +1300 Subject: [PATCH 1/4] repo: dont error if we cannot access piston_api --- repo/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh index bd958ab..6f917d7 100755 --- a/repo/entrypoint.sh +++ b/repo/entrypoint.sh @@ -7,4 +7,4 @@ done cd /repo ./mkindex.sh -curl -s http://piston_api:6969/repos -XPOST -d "slug=local&url=file:///repo/index.yaml" +curl -s http://piston_api:6969/repos -XPOST -d "slug=local&url=file:///repo/index.yaml" || echo "WARNING: Could not add repository" From d86dc4bbb3355211d5ac18f7435c32d2973bef4a Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sun, 28 Feb 2021 22:20:23 +1300 Subject: [PATCH 2/4] ci(package-pr): check OK is included in STDOUT --- .github/workflows/package-pr.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index daf23e8..d5c317b 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -65,7 +65,8 @@ jobs: echo Testing ${PKG_SLUG} (using ${PKG_SLUG}.tf) TEST_FILE=$(cat ${PKG_SLUG}.tf) TEST_JSON=`jq -C '.language = "${PKG_NAME}" | .version = "${PKG_VERSION}" | .files=[] | .files[0]={} | .files[0].name="test" | .files[0].name.content="${TEST_FILE}" | .main = "test" | .args = [] | .stdin = "" | .compile_timeout = 10000 | .run_timeout = 3000' <<< '{}'` - curl -sXPOST http://127.0.0.1:6969/jobs -H 'Content-Type: application/json' -d "$TEST_JSON" + curl -sXPOST http://127.0.0.1:6969/jobs -H 'Content-Type: application/json' -d "$TEST_JSON" > ${PKG_SLUG}.tr + jq '.run.stdout' ${PKG_SLUG}.tr | grep "OK" || exit 1 done From f85c430869667839962c049e664baf98f0a86c71 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sun, 28 Feb 2021 22:25:23 +1300 Subject: [PATCH 3/4] ci(package-pr): dont endlessly hang --- .github/workflows/package-pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index d5c317b..dc3d9fd 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -49,9 +49,9 @@ jobs: - name: Run tests run: | - docker run -dp 6969:6969 -v $(pwd)'/repo:/repo' --privileged --name api piston_api + docker run -p 6969:6969 -v $(pwd)'/repo:/repo' --privileged --name api piston_api & echo Waiting for API to start.. - bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:6969/runtimes)" != "200" ]]; do sleep 5; done' + while [[ "$(curl -s -w '%{http_code}' http://127.0.0.1:6969/runtimes)" != "200" ]]; do sleep 5; done echo Adding local repo curl -s http://127.0.0.1:6969/repos -XPOST -d "slug=local&url=file:///repo/index.yaml" echo Testing packages From e82f019d0ec62a48d61eff1d31d64fbd1302d99c Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sun, 28 Feb 2021 22:30:07 +1300 Subject: [PATCH 4/4] ci(package-pr): mount piston directory into api --- .github/workflows/package-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index dc3d9fd..245e81a 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -49,7 +49,7 @@ jobs: - name: Run tests run: | - docker run -p 6969:6969 -v $(pwd)'/repo:/repo' --privileged --name api piston_api & + docker run -p 6969:6969 -v $(pwd)'/data:/piston' -v $(pwd)'/repo:/repo' --privileged --name api piston_api & echo Waiting for API to start.. while [[ "$(curl -s -w '%{http_code}' http://127.0.0.1:6969/runtimes)" != "200" ]]; do sleep 5; done echo Adding local repo