From a85ab9aea317510c658bfe30804561470e7a917c Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 1 May 2021 22:22:19 +0200 Subject: [PATCH] [ci] Use GitHub Actions --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 66 ----------------------------------- README.md | 4 +-- appveyor.yml | 15 -------- package.json | 3 +- 5 files changed, 79 insertions(+), 84 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc8cdb8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: + - push + - pull_request + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + node: + - 10 + - 12 + - 14 + os: + - macOS-latest + - ubuntu-16.04 + - windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - run: npm install + - run: npm test + - run: npm run prebuild + if: matrix.node == 14 && startsWith(github.ref, 'refs/tags/') + - run: npm run prebuild-ia32 + if: + matrix.node == 14 && matrix.os == 'windows-latest' && + startsWith(github.ref, 'refs/tags/') + - run: npm run prebuild-linux-arm + if: + matrix.node == 14 && matrix.os == 'ubuntu-16.04' && + startsWith(github.ref, 'refs/tags/') + - uses: actions/upload-artifact@v2 + if: matrix.node == 14 && startsWith(github.ref, 'refs/tags/') + with: + name: ${{ matrix.os }} + path: prebuilds + release: + if: startsWith(github.ref, 'refs/tags/') + needs: test + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + path: prebuilds + - run: echo ::set-output name=version::$(git describe --tags) + id: get_version + - run: + tar -cvf "${{ steps.get_version.outputs.version }}-darwin-x64.tar" -C + "prebuilds/macOS-latest" . + - run: + tar -cvf "${{ steps.get_version.outputs.version }}-linux-arm.tar" -C + "prebuilds/ubuntu-16.04" linux-arm + - run: + tar -cvf "${{ steps.get_version.outputs.version }}-linux-arm64.tar" -C + "prebuilds/ubuntu-16.04" linux-arm64 + - run: + tar -cvf "${{ steps.get_version.outputs.version }}-linux-x64.tar" -C + "prebuilds/ubuntu-16.04" linux-x64 + - run: + tar -cvf "${{ steps.get_version.outputs.version }}-win32-ia32.tar" -C + "prebuilds/windows-latest" win32-ia32 + - run: + tar -cvf "${{ steps.get_version.outputs.version }}-win32-x64.tar" -C + "prebuilds/windows-latest" win32-x64 + - uses: softprops/action-gh-release@v1 + with: + files: ${{ steps.get_version.outputs.version }}-*.tar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 91dd1f4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,66 +0,0 @@ -language: node_js -jobs: - include: - - os: linux - node_js: 10 - env: - - TEST=1 - - os: linux - node_js: 12 - env: - - TEST=1 - - os: linux - node_js: 14 - env: - - TEST=1 - - BUILD_NAME=linux-x64 - - os: osx - node_js: 10 - env: - - TEST=1 - - os: osx - node_js: 12 - env: - - TEST=1 - - os: osx - node_js: 14 - env: - - TEST=1 - - BUILD_NAME=darwin-x64 - - os: linux - node_js: 10 - arch: arm64 - env: - - TEST=1 - - os: linux - node_js: 12 - arch: arm64 - env: - - TEST=1 - - os: linux - node_js: 14 - arch: arm64 - env: - - TEST=1 - - BUILD_NAME=linux-arm64 - - os: linux - node_js: 14 - env: - - BUILD_NAME=linux-arm - - BUILD_SCRIPT=prebuild-linux-arm - if: tag is present -script: - - if [ -n "$TEST" ]; then npm run test; fi -before_deploy: - - ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$BUILD_NAME.tar" - - if [ -n "$BUILD_SCRIPT" ]; then npm run $BUILD_SCRIPT; else npm run prebuild; fi - - tar -cvf "$ARCHIVE_NAME" -C prebuilds . -deploy: - provider: releases - token: - secure: FzxCOALZjPUUCE0pdV6xoeUwcpUG92A6cgeZjUrU8iSsneCLSBfj3i1Zpsz+1A8pPCy4FmWRSqCxkEwMVluYXsUpqT54nvX0yQZHeXTDnVYg1EIvEuKgkysEVUQJ6VplTilE6lrRWYEkOOoQPeIEe4kW8EyGzpV9zeHrpdYsdc0= - file: $ARCHIVE_NAME - skip_cleanup: true - on: - tags: true - condition: -n "$BUILD_NAME" diff --git a/README.md b/README.md index 2c0bfcc..88af3a5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # utf-8-validate [![Version npm](https://img.shields.io/npm/v/utf-8-validate.svg)](https://www.npmjs.com/package/utf-8-validate) -[![Build Status](https://travis-ci.com/websockets/utf-8-validate.svg?branch=master)](https://travis-ci.com/websockets/utf-8-validate) -[![Windows Build](https://ci.appveyor.com/api/projects/status/github/websockets/utf-8-validate?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/utf-8-validate) +[![Build Status](https://img.shields.io/github/workflow/status/websockets/utf-8-validate/CI/master?label=build)](https://github.com/websockets/utf-8-validate/actions?query=workflow%3ACI+branch%3Amaster) +[![Windows x86 Build](https://ci.appveyor.com/api/projects/status/github/websockets/utf-8-validate?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/utf-8-validate) Check if a buffer contains valid UTF-8 encoded text. diff --git a/appveyor.yml b/appveyor.yml index 5696264..b69149b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,6 @@ environment: - nodejs_version: "10" platform: - x86 - - x64 matrix: fast_finish: true install: @@ -17,17 +16,3 @@ test_script: - node --version - npm --version - npm test -after_test: - - ps: If ($env:nodejs_version -eq "14") { npm run prebuild } - - ps: $env:ARTIFACT_NAME_PREFIX = if (Test-Path env:APPVEYOR_REPO_TAG_NAME) { $env:APPVEYOR_REPO_TAG_NAME } else { 'latest' } -artifacts: - - path: prebuilds - name: $(ARTIFACT_NAME_PREFIX)-win-$(PLATFORM) -deploy: - - provider: GitHub - artifact: /.*\.zip/ - auth_token: - secure: hU+EdxPa5CzNrTpFfcx3DoA8ja+xfRq56JD0sEpt5f0ctd3Az8WSI9h+MgRXjlms - on: - appveyor_repo_tag: true - nodejs_version: "14" diff --git a/package.json b/package.json index d6ae3c1..7bc046f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "install": "node-gyp-build", "prebuild": "prebuildify --napi --strip", - "prebuild-linux-arm": "prebuildify-cross -i linux-armv6 -i linux-armv7 --napi --strip", + "prebuild-ia32": "prebuildify --arch=ia32 --napi --strip", + "prebuild-linux-arm": "prebuildify-cross -i linux-armv6 -i linux-armv7 -i linux-arm64 --napi --strip", "test": "mocha" }, "repository": {