diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..abd44054ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,96 @@ +name: CI +on: [push, pull_request] +jobs: + check: + name: "Check preconditions" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1.0.0 + - name: "Check that author is present in the NOTICE file" + run: | + AUTHOR=$(git log -1 --format="%aE") + if [ -z "$AUTHOR" ]; then + printf "\Cannot perform NOTICE check: Commit does not include an email address.\n" && + exit 1; + elif ! grep -q "$AUTHOR" NOTICE || false; then + printf "\nAuthor '$AUTHOR' does not appear to be listed in the NOTICE file, yet.\n" && + printf "Please see https://github.com/AssemblyScript/assemblyscript/blob/master/CONTRIBUTING.md\n" && + exit 1; + else + printf "\nOK: Author is present in the NOTICE file.\n"; + fi + - name: "If a PR, check that distribution files are unmodified" + if: github.event_name == 'pull_request' + run: | + if git --no-pager diff --name-only $(git rev-parse origin/${{ github.base_ref }})...${{ github.sha }} | grep -q "^dist/"; then + printf "\nThe pull request modifies distribution files, but it shouldn't.\n" && + printf "Please see https://github.com/AssemblyScript/assemblyscript/blob/master/CONTRIBUTING.md\n" && + exit 1; + else + printf "\nOK: Distributions files have not been modified.\n"; + fi + test: + name: "Test compiler on node: ${{ matrix.node_version }}" + runs-on: ubuntu-latest + needs: check + strategy: + matrix: + node_version: ["lts/*", "node"] + steps: + - uses: actions/checkout@v1.0.0 + - uses: dcodeIO/setup-node-nvm@v1.0.0 + with: + node-version: ${{ matrix.node_version }} + - name: Install dependencies + run: npm ci --no-audit + - name: Clean distribution files + run: npm run clean + - name: Test sources + run: npm test + - name: Build distribution files + run: npm run build + - name: Test distribution + run: npm test + test-canary: + name: "Test features on node: v8-canary" + runs-on: ubuntu-latest + needs: check + steps: + - uses: actions/checkout@v1.0.0 + - uses: dcodeIO/setup-node-nvm@v1.0.0 + with: + node-mirror: https://nodejs.org/download/v8-canary/ + - name: Install dependencies + run: npm ci --no-audit + - name: Clean distribution files + run: npm run clean + - name: Test experimental features + env: + ASC_FEATURES: mutable-globals,threads,reference-types,bigint-integration + run: | + npm run test:compiler rt/flags features/js-bigint-integration features/reference-types features/threads + test-runtime: + name: "Test runtimes on node: node" + runs-on: ubuntu-latest + needs: check + steps: + - uses: actions/checkout@v1.0.0 + - uses: dcodeIO/setup-node-nvm@v1.0.0 + with: + node-version: node + - name: Install dependencies + run: npm ci --no-audit + - name: Clean distribution files + run: npm run clean + - name: Test full runtime + run: | + cd tests/allocators/rt-full + npm run build + cd .. + npm test rt-full + - name: Test stub runtime + run: | + cd tests/allocators/rt-stub + npm run build + cd .. + npm test rt-stub diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 429f33eb86..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: node_js -notifications: - email: false -before_install: npm config set progress=false && npm i -g npm@latest --no-audit -install: npm ci --no-audit -jobs: - include: - - node_js: lts/* - script: - - if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_PULL_REQUEST_BRANCH" != "dev" ]; then ./scripts/check-pr.sh; fi - - npm run all - - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then - cd $TRAVIS_BUILD_DIR/tests/allocators/rt-full && npm run build && cd .. && npm test rt-full && - cd $TRAVIS_BUILD_DIR/tests/allocators/rt-stub && npm run build && cd .. && npm test rt-stub; - fi - env: Runs the tests on node.js LTS, also tests allocators - - node_js: node - script: - - npm run all - env: Runs the tests on node.js stable - - node_js: node - script: - - npm run clean && npm run test:compiler rt/flags threads - env: - - Runs experimental tests on node.js v8-canary using - - ASC_FEATURES="mutable-globals,simd,threads,reference-types,bigint-integration" - - NVM_NODEJS_ORG_MIRROR="https://nodejs.org/download/v8-canary/" diff --git a/README.md b/README.md index b15607624c..cab6d26d1f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![](https://avatars1.githubusercontent.com/u/28916798?s=64) AssemblyScript ================= -[![Build Status](https://travis-ci.org/AssemblyScript/assemblyscript.svg?branch=master)](https://travis-ci.org/AssemblyScript/assemblyscript) +[![Actions Status](https://github.com/AssemblyScript/assemblyscript/workflows/CI/badge.svg)](https://github.com/AssemblyScript/assemblyscript/actions) **AssemblyScript** compiles a strict subset of [TypeScript](http://www.typescriptlang.org) (basically JavaScript with types) to [WebAssembly](http://webassembly.org) using [Binaryen](https://github.com/WebAssembly/binaryen). It generates lean and mean WebAssembly modules while being just an `npm install` away. diff --git a/scripts/check-pr.sh b/scripts/check-pr.sh deleted file mode 100755 index 1657439c26..0000000000 --- a/scripts/check-pr.sh +++ /dev/null @@ -1,29 +0,0 @@ -# Distribution files should not be modified -STATUS=0 -if git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $TRAVIS_BRANCH) | grep -q "^dist/"; then - STATUS=1 && - printf "\n" && - printf "The pull request includes changes to distribution files, but it shouldn't.\n" && - printf "Please see https://github.com/AssemblyScript/assemblyscript/blob/master/CONTRIBUTING.md\n"; -else - printf "\n" && - printf "GOOD: The pull request does not include changes to distribution files.\n"; -fi - -# Authors should have added themself to the NOTICE file -AUTHOR=$(git log -1 --format="%aE") -if [ -z "$AUTHOR" ]; then - printf "\n" && - printf "Skipping NOTICE check: Commit does not include an email address.\n"; -else - if grep -q "$AUTHOR" NOTICE; then - printf "\n" && - printf "GOOD: Author is present in the NOTICE file.\n"; - else - printf "\n" && - printf "Author does not appear to be listed in the NOTICE file, yet.\n" && - printf "Please see https://github.com/AssemblyScript/assemblyscript/blob/master/CONTRIBUTING.md\n"; - fi -fi - -exit $STATUS