123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- name: CI
- env:
- DEBUG: 'napi:*'
- on:
- push:
- branches: [master, develop]
- tags-ignore:
- - '**'
- pull_request:
- jobs:
- build:
- if: "!contains(github.event.head_commit.message, 'skip ci')"
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
- name: stable - ${{ matrix.os }} - node@12
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v2
- - name: Setup node
- uses: actions/setup-node@v1
- with:
- node-version: 12
- - name: Set platform name
- run: |
- export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
- echo "::set-env name=PLATFORM_NAME::$NODE_PLATFORM_NAME"
- shell: bash
- - name: Install llvm
- if: matrix.os == 'windows-latest'
- run: choco install -y llvm
- - name: Set llvm path
- if: matrix.os == 'windows-latest'
- uses: allenevans/set-env@v1.0.0
- with:
- LIBCLANG_PATH: 'C:\\Program Files\\LLVM\\bin'
- - name: Install
- uses: actions-rs/toolchain@v1
- with:
- toolchain: stable
- profile: minimal
- override: true
- - name: Generate Cargo.lock
- uses: actions-rs/cargo@v1
- with:
- command: generate-lockfile
- - name: Cache cargo registry
- uses: actions/cache@v1
- with:
- path: ~/.cargo/registry
- key: stable-${{ matrix.os }}-node@12-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- - name: Cache cargo index
- uses: actions/cache@v1
- with:
- path: ~/.cargo/git
- key: stable-${{ matrix.os }}gnu-node@12-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- - name: Cache NPM dependencies
- uses: actions/cache@v1
- with:
- path: node_modules
- key: npm-cache-${{ matrix.os }}-node@12-${{ hashFiles('yarn.lock') }}
- restore-keys: |
- npm-cache-
- - name: 'Install dependencies'
- run: yarn install --frozen-lockfile --registry https://registry.npmjs.org
- - name: 'Build'
- if: matrix.os != 'macos-latest'
- run: yarn build
- - name: 'Build'
- if: matrix.os == 'macos-latest'
- run: yarn build
- env:
- MACOSX_DEPLOYMENT_TARGET: '10.13'
- - name: Upload artifact
- uses: actions/upload-artifact@v2
- with:
- name: bindings-${{ env.PLATFORM_NAME }}
- path: package-template.${{ env.PLATFORM_NAME }}.node
- - name: Clear the cargo caches
- run: |
- cargo install cargo-cache --no-default-features --features ci-autoclean
- cargo-cache
- test_binding:
- name: Test bindings on ${{ matrix.os }} - node@${{ matrix.node }}
- needs:
- - build
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
- node: ['10', '12', '14']
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v2
- - name: Setup node
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node }}
- - name: Set platform name
- run: |
- export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())")
- echo "::set-env name=PLATFORM_NAME::$NODE_PLATFORM_NAME"
- shell: bash
- # Do not cache node_modules, or yarn workspace links broken
- - name: 'Install dependencies'
- run: yarn install --frozen-lockfile --registry https://registry.npmjs.org
- - name: Download artifacts
- uses: actions/download-artifact@v2
- with:
- name: bindings-${{ env.PLATFORM_NAME }}
- path: .
- - name: List packages
- run: ls -R .
- shell: bash
- - name: Test bindings
- run: yarn test
- dependabot:
- needs:
- - test_binding
- runs-on: ubuntu-latest
- steps:
- - name: auto-merge
- uses: ridedott/dependabot-auto-merge-action@master
- with:
- GITHUB_LOGIN: dependabot[bot]
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- publish:
- name: Publish
- runs-on: ubuntu-latest
- needs: test_binding
- steps:
- - uses: actions/checkout@v2
- - name: Setup node
- uses: actions/setup-node@v1
- with:
- node-version: 12
- - name: Cache NPM dependencies
- uses: actions/cache@v1
- with:
- path: node_modules
- key: npm-cache-ubuntu-latest-${{ hashFiles('yarn.lock') }}
- restore-keys: |
- npm-cache-
- - name: 'Install dependencies'
- run: yarn install --frozen-lockfile --registry https://registry.npmjs.org
- - name: Download all artifacts
- uses: actions/download-artifact@v2
- with:
- path: artifacts
- - name: Move artifacts
- run: yarn artifacts
- - name: List packages
- run: ls -R .
- shell: bash
- - name: Publish
- run: |
- if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
- then
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- npm publish
- else
- echo "Not a release, skipping publish"
- fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|