From 24840d1e9f5f6dd665d5a00d21b26c1fb3b82930 Mon Sep 17 00:00:00 2001 From: felix Date: Mon, 31 May 2021 18:21:31 +0200 Subject: [PATCH] Migrate to GitHub Actions --- .github/upload-key.id_rsa | 39 +++++++++ .github/workflows/ci.yml | 153 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 47 +++++++++++ .travis.yml | 42 ---------- .travis/deploy_key.enc | Bin 1680 -> 0 bytes README.md | 2 +- 6 files changed, 240 insertions(+), 43 deletions(-) create mode 100644 .github/upload-key.id_rsa create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml delete mode 100644 .travis/deploy_key.enc diff --git a/.github/upload-key.id_rsa b/.github/upload-key.id_rsa new file mode 100644 index 00000000..2efed091 --- /dev/null +++ b/.github/upload-key.id_rsa @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABC7v7wTRG +0X12QigBYhN1VqAAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQDWB7J+7gsf +iAJg+B7DhNSLAF2qoDIEYaSGjHyeO4qb+Rulf0McEsyM19jFuC+ZFyGe3F8h4Aqudmhj+M +j7LyNZH0Pc5CLI9hG6hIVJ1h3okLUjv0wl1SkiP5LUMX66Sq+xNTXlZO+TwjNu0SMo/scY +d5Vq6ROcfG0qTA6vVD0Zhg5m0Pagat8AWE177QWyLUE+eCbkcNaxSSb10UVqOQzx9njmM3 +MrMVBAPTu2vHNgFuFpuRtfLUM1wP7/fuQRzI94XwaDWcHnKPQ260zLGhF4iEnaTep1CVME +PuiH4O6EjADnGjYU+E7ZmGZCswUXP2pB8kPc5/IwXvI4Ig2b0aLwEHGCJjyVysroX8zMGT +dcrwnrD8EBRR2qp32TP2TbVj1+Q73euRGYqTwORupyD3Drn0D5+OfAIHxybM/rN918cMm7 +1tAHqTaJ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enTs5yaCXz+ztpVs/CGh/p29By34SwpqL3ohS/eVhK869Vb+fV +AQ/5CZ+8PevdDsNt5tdK/mQZAVY8KpI/WOljQNFO5iLIO0okfVAaFhVr+2Xk+FsnsOjncy +owTHtS82bG8VMOl3I5xeEp01GYd5J/EzHhEgjYmhINt/iynqGcw+rv9SBAtqj+knZUm6yx +hyJntOGpOlspslzSbz8snps9Th7WyxaL2xFbq4EoQ3M86J5Np/Ai361JaaOpyWox8grdRx +RgOdPCLApFEs1GBm3mWad2XlJZZ+y1dc7EvBUH/Hef3ZLzpxab1YoAZ9O9Rurd5VhZdjAO +3Yfthd8vtwu9DKO0ZeS9NirqWEbtVNFurXdhL+jkmUVL50jEGMgn8BX+N1llsREXT7DeGX +X4wNCm/FrJd+onnPRN3JRdAs3iI2pghWSD8/Ao47m+lxNHsIxPDf+fFr+mH+XRNLe4Cp9B +e0zyWog4YT3rN3ZqovZR9B+hXjdturuEUSDPaeOcHXeTmLtL4tMoEb1S/i4L2FOG8Rr+V5 +gHkuOw81F2u16Q4UdwdgobSIHuAg5ky9zBAvoZKnttRqicaLM1XhwlX1QsXzZTOBeECZtW +Xpu1VFR0CwsDTxTH0oegTAq1Ndzo86rhDbV8QkffboxLAw78dXKqVTNHBlR4Nv1I7CAWDS +sm+X85vdX91dvp7ZnAx7/jCTd15j/66X3k+hgNCGYvioW05HMWdqQzuL5h6+DQ4ZRNmu7f +musSnvpycKBn5bxpqIeE3okil3S64KeNhm7GbofMmN0zHSlxR8xqlBX2Ne6oXtoX00yXB5 +v0d5ovx8TlZo4sVGMUlGFci72y8THk9j1/Du159uEPSUCHNir/K89mtCr8mgidWNmc3/ir +ioU8U7ImPuL8ebn6kNQccW/0nfg= +-----END OPENSSH PRIVATE KEY----- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2760751f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,153 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + lint: + name: Linter + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 15.x + uses: actions/setup-node@v2 + with: + node-version: 15.x + - run: npm ci + - run: make lint complexity-analysis + + run-tests: + name: Testsuite + needs: lint + runs-on: ubuntu-latest + strategy: + matrix: + include: + - engine: ringojs + version: 2.0.0 + - engine: rhino + version: 1.7.13 + - engine: quickjs + version: '2020-09-06' + - engine: quickjs + version: '2020-11-08' + - engine: quickjs + version: '2021-03-27' + - engine: node.js + version: 10.x + - engine: node.js + version: 12.x + - engine: node.js + version: 14.x + - engine: node.js + version: 15.x + - engine: duktape + version: 2.4.0 + - engine: duktape + version: 2.5.0 + - engine: duktape + version: 2.6.0 + + steps: + - uses: actions/checkout@v2 + + # Duktape + - name: Install Duktape ${{ matrix.version }} + if: ${{ matrix.engine == 'duktape' }} + run: | + PACKAGE="duktape-${{ matrix.version }}" + cd /opt + wget "https://duktape.org/$PACKAGE.tar.xz" + tar xf "$PACKAGE.tar.xz" + make -C "$PACKAGE/" -f Makefile.cmdline DEFINES=-DDUK_CMDLINE_FILEIO + sudo install -Dm755 "$PACKAGE/duk" /usr/local/bin/duk + rm -rf "$PACKAGE.tar.xz" "$PACKAGE/" + - name: Run tests + if: ${{ matrix.engine == 'duktape' }} + run: cd test; duk runner.js + + # Node.js + - name: Install Node.js ${{ matrix.version }} + if: ${{ matrix.engine == 'node.js' }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.version }} + - run: node test/runner.js --console + if: ${{ matrix.engine == 'node.js' }} + + # QuickJS + - name: Install QuickJS ${{ matrix.version }} + if: ${{ matrix.engine == 'quickjs' }} + run: | + cd /opt + git clone --bare 'https://gitlab.com/felix.s-git-mirrors/quickjs.git' + git --git-dir=quickjs.git worktree add quickjs "${{ matrix.version }}" + make -C quickjs qjs + sudo install -Dm755 quickjs/qjs /usr/local/bin/qjs + rm -rf quickjs.git quickjs + - name: Run tests + if: ${{ matrix.engine == 'quickjs' }} + # XXX: The default QuickJS stack size limit is 256 KiB; + # QuickJS likes to throw stack overflow errors when running the test suite at that limit, + # so we increase it to 8 MiB. The issue is intermittent and non-deterministic; + # it may or may not be an engine bug + run: cd test; qjs --stack-size 8388608 --std runner.js + + # Rhino + - name: Download Rhino ${{ matrix.version }} + if: ${{ matrix.engine == 'rhino' }} + run: | + VERSION="${{ matrix.version }}" + wget "https://github.com/mozilla/rhino/releases/download/Rhino${VERSION//./_}_Release/rhino-$VERSION.jar" -O /opt/rhino.jar + - name: Run tests + if: ${{ matrix.engine == 'rhino' }} + run: cd test; java -jar /opt/rhino.jar -opt -1 runner.js + + # RingoJS + - name: Download and unpack RingoJS ${{ matrix.version }} + if: ${{ matrix.engine == 'ringojs' }} + run: | + VERSION="${{ matrix.version }}" + wget "https://github.com/ringo/ringojs/releases/download/v${VERSION}/ringojs-${VERSION}.zip" + unzip "ringojs-${VERSION}.zip" -d /opt/ + rm "ringojs-${VERSION}.zip" + - name: Install RingoJS ${{ matrix.version }} + if: ${{ matrix.engine == 'ringojs' }} + run: | + VERSION="${{ matrix.version }}" + sed -i -e '/-jar/ i \ -Dringo.classpath="$RINGO_HOME/lib/**" \\' "/opt/ringojs-${VERSION}/bin/ringo" + sudo ln -s "/opt/ringojs-${VERSION}/bin/ringo" /usr/local/bin/ringo + sudo chmod +x /usr/local/bin/ringo + - name: Run tests + if: ${{ matrix.engine == 'ringojs' }} + run: ringo -o -1 test/runner.js 2>&1 + + check-coverage: + name: Coverage analysis + needs: run-tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - run: npm ci + - run: make coverage-analysis + + update-docs: + name: Update documentation + if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} + needs: check-coverage + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - run: | + git clone --depth=1 --branch gh-pages git@github.com:fstirlitz/luaparse.git gh-pages + cd gh-pages + make + git add . + git commit --message "build documentation" + git push origin gh-pages diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5722b85c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Upload release + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d20399c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: node_js -node_js: - - '10' -before_install: - - npm install -g bower - - sudo chown "$USER:" /opt - - sudo apt-get update -qq - - sudo apt-get install -qq make gcc - - PACKAGE=duktape-2.4.0; ( cd /opt && wget "https://duktape.org/$PACKAGE.tar.xz" && tar xf "$PACKAGE.tar.xz" && make -C "$PACKAGE/" -f Makefile.cmdline DEFINES=-DDUK_CMDLINE_FILEIO && sudo install -Dm755 "$PACKAGE/duk" /usr/local/bin/duk && rm -rf "$PACKAGE.tar.xz" "$PACKAGE/" ) - - PACKAGE=quickjs; VERSION=2020-07-05; ( cd /opt && git clone --bare 'https://gitlab.com/felix.s-git-mirrors/quickjs.git' && git --git-dir=quickjs.git worktree add "$PACKAGE/" "$VERSION" && make -C "$PACKAGE/" qjs && sudo install -Dm755 "$PACKAGE/qjs" /usr/local/bin/qjs && rm -rf "quickjs.git" "$PACKAGE/" ) - - PACKAGE=Rhino1_7R4_RELEASE; wget https://github.com/mozilla/rhino/archive/$PACKAGE.zip && unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip - - PACKAGE=Rhino1_7R4_RELEASE; echo -e '#!/bin/sh\njava -jar /opt/Rhino1_7R4_RELEASE/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino - - PACKAGE=ringojs-0.9; wget http://ringojs.org/downloads/$PACKAGE.zip && unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip - - PACKAGE=ringojs-0.9; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo -before_deploy: - - make build -deploy: - - provider: npm - email: public@oxy.fi - api_key: - secure: c1xVoKfBO4ZGplOkwugeWs9qtC2NQAXLS6ntUAhdk+aeFrxQBMR5oUQ721IM8V9hYhuNv8qJZowoJNyzGNr/43uh9ZSCohddX6OIyVc1Lu84JEQAt1W/WgKF8j0d/p9+WFD3EZOyvf4eotAjamJbsXkGN4GlsD0f2TKOKlt0/YY= - on: - tags: true - all_branches: true - - provider: releases - api_key: - secure: GGN5c5EDpUwBduAiXefBvQjcKH8HKRvMaAHLEIvIm547sR7YUz/vynkNd7uInPG8ZCD73GHxZVxOk335TsHg7XR6Tz+mm3PmyMmqHcCMqSG+hR+s++oCiC2R04q/yM0LsaWlKPr/xzSg6dZynJsW0hy7AinXlK4g4B3kI5wtGls= - file: - - dist/luaparse.js - - dist/luaparse.min.js - skip_cleanup: true - on: - tags: true - all_branches: true -after_success: - - '[ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ] && BUILD_DOCS=true || BUILD_DOCS=false' - - '[ "$BUILD_DOCS" = "true" ] && openssl aes-256-cbc -K $encrypted_ce12c8d20fd6_key -iv $encrypted_ce12c8d20fd6_iv -in .travis/deploy_key.enc -out .travis/deploy_key -d' - - '[ "$BUILD_DOCS" = "true" ] && chmod 600 .travis/deploy_key && eval `ssh-agent -s` && ssh-add .travis/deploy_key' - - '[ "$BUILD_DOCS" = "true" ] && git clone --branch gh-pages git@github.com:fstirlitz/luaparse.git gh-pages && cd gh-pages' - - '[ "$BUILD_DOCS" = "true" ] && make' - - '[ "$BUILD_DOCS" = "true" ] && git config user.name "Travis" && git config user.email "public@oxy.fi"' - - '[ "$BUILD_DOCS" = "true" ] && git add . && git commit --message "build documentation" && git push origin gh-pages' diff --git a/.travis/deploy_key.enc b/.travis/deploy_key.enc deleted file mode 100644 index 7ceadafa60016270a0e5f15839550911f0533159..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1680 zcmV;B25&4QnQRlA@)eCr628I8-~Ze8v)h#ppI7;@)1M1P~dy5iUf}u zw9B#4{UwNa1lX2?g92j4+;cNUv?cCdGzBvXYrmn)m8!uJAt&ej)dyx-5lvk8baSmN6kq5AKKD$K*pzC%w&0!GaIbn z-)`ei8=YY&vzbJ(?H)cSZ#VDW8d}od5z`_7>clU%h`ez4&`fD>ovI8G>ob^871JlR zsKmZ^%va}U=g8*lbT&yAV7)6gDCEnI6{~_SgR;vSbJm<7NzrlugY_93-^ZDk%Xy=K z``L+mA?%reH!cxlY7~-u+Z4>8OqiFC=CXHL^Q^QRYPHy8ihy_h@=~&9Cr-#XD~tTy zbEZ}YfCO(<7=)oFr0#4%!N=F&l}Cv3EFQvZHNMI@kkx#=NVY?$NL!TD8(=cwUdTEG zMbs-bU-tq|R(7yj>T;UuPXd`vC$OkVL`esCv?vUXIbJZQ{qfBwHZo5m!!(rs{j(sI z?EDk>(<21w((aAuCg+Ih%hbyFYn@eVzb9f0iOA@-rMJdV#}XdIJ-ECZlV|VEFE^^# zt)0+lWtoZ|?#wb){N_T>@lx&7HzB(%!PM@|T;#R;m4!|ws{0CKSogeap+@(WGO+|o zGlNnHTk}3hZVyTW5Lc`roLA+DOo!h&#mNlXDf6A9Liwevl{i+svMrr!O$QcvfNRz~ zCF$kU-)cM}J&LZYA?*76)yiZ9F#^$qaoUFK5qQkiw}E)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