aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-14 22:25:33 +0000
committerGitHub <noreply@github.com>2021-03-15 06:25:33 +0800
commit4fb54b066fc590ea7bd161ba8afa5fc1d4b34d2e (patch)
tree025b0a62d5b90b3f91e3f7e96da74d5204a3fcbf
parente124ef57e34190205534aa3ab856a7fcb6caaab5 (diff)
downloadtracifyjs-4fb54b066fc590ea7bd161ba8afa5fc1d4b34d2e.tar.gz
tracifyjs-4fb54b066fc590ea7bd161ba8afa5fc1d4b34d2e.zip
improve Node.js setup on GitHub Actions (#4775)
-rw-r--r--.github/workflows/build.yml17
-rw-r--r--.github/workflows/ci.yml17
-rw-r--r--.github/workflows/ufuzz.yml25
-rwxr-xr-xtest/release/install.sh33
4 files changed, 36 insertions, 56 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7ef68a71..10cef9d6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -36,20 +36,5 @@ jobs:
- name: Perform uglify, build & test
shell: bash
run: |
- git clone --branch v1.6.0 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
- while ! timeout 60 bash -c '. ~/.nvs/nvs.sh add $NODE && nvs use $NODE'; do
- cd ~/.nvs
- while !(git clean -xdf); do echo "'git clean' failed - retrying..."; done
- cd -
- done
- . ~/.nvs/nvs.sh --version
- nvs use $NODE
- node --version
- npm config set audit false
- npm config set optional false
- npm config set save false
- npm config set strict-ssl false
- npm config set update-notifier false
- npm --version
- while !(npm install); do echo "'npm install' failed - retrying..."; done
+ . ./test/release/install.sh
./test/release/$SCRIPT $OPTIONS
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 60db779c..b1bbd93b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -29,20 +29,5 @@ jobs:
- name: Perform tests
shell: bash
run: |
- git clone --branch v1.6.0 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
- while ! timeout 60 bash -c '. ~/.nvs/nvs.sh add $NODE && nvs use $NODE'; do
- cd ~/.nvs
- while !(git clean -xdf); do echo "'git clean' failed - retrying..."; done
- cd -
- done
- . ~/.nvs/nvs.sh --version
- nvs use $NODE
- node --version
- npm config set audit false
- npm config set optional false
- npm config set save false
- npm config set strict-ssl false
- npm config set update-notifier false
- npm --version
- while !(npm install); do echo "'npm install' failed - retrying..."; done
+ . ./test/release/install.sh
node test/$TYPE
diff --git a/.github/workflows/ufuzz.yml b/.github/workflows/ufuzz.yml
index 910dbd5a..285d046e 100644
--- a/.github/workflows/ufuzz.yml
+++ b/.github/workflows/ufuzz.yml
@@ -30,33 +30,10 @@ jobs:
NODE: ${{ matrix.node }}
steps:
- uses: actions/checkout@v2
- - name: Install GNU Core Utilities
- if: ${{ startsWith(matrix.os, 'macos') }}
- env:
- HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
- HOMEBREW_NO_INSTALL_CLEANUP: 1
- shell: bash
- run: |
- while !(brew install coreutils); do echo "'brew install' failed - retrying..."; done
- name: Perform fuzzing
shell: bash
run: |
- git clone --branch v1.6.0 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
- while ! timeout 60 bash -c '. ~/.nvs/nvs.sh add $NODE && nvs use $NODE'; do
- cd ~/.nvs
- while !(git clean -xdf); do echo "'git clean' failed - retrying..."; done
- cd -
- done
- . ~/.nvs/nvs.sh --version
- nvs use $NODE
- node --version
- npm config set audit false
- npm config set optional false
- npm config set save false
- npm config set strict-ssl false
- npm config set update-notifier false
- npm --version
- while !(npm install); do echo "'npm install' failed - retrying..."; done
+ . ./test/release/install.sh
if [[ $CAUSE == "schedule" ]]; then
node test/ufuzz/job $BASE_URL $TOKEN $RUN_NUM
else
diff --git a/test/release/install.sh b/test/release/install.sh
new file mode 100755
index 00000000..2c5f4d3b
--- /dev/null
+++ b/test/release/install.sh
@@ -0,0 +1,33 @@
+if command -v timeout &> /dev/null; then NATIVE=1; fi
+timeout() {
+ T=$1
+ shift
+ shift
+ shift
+ expect <<EOF
+set timeout $T
+spawn -noecho sh -c "$@"
+expect timeout { exit 124 } eof
+catch wait ret
+exit [lindex \$ret 3]
+EOF
+ return $?
+}
+if [ $NATIVE ]; then unset -f timeout; fi
+
+git clone --branch v1.6.0 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
+while ! timeout 60 bash -c ". ~/.nvs/nvs.sh add $NODE && nvs use $NODE"; do
+ cd ~/.nvs
+ while !(git clean -xdf); do echo "'git clean' failed - retrying..."; done
+ cd -
+done
+. ~/.nvs/nvs.sh --version
+nvs use $NODE
+node --version
+npm config set audit false
+npm config set optional false
+npm config set save false
+npm config set strict-ssl false
+npm config set update-notifier false
+npm --version
+while !(npm install); do echo "'npm install' failed - retrying..."; done