|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + tags: |
| 7 | + - v*.*.* |
| 8 | + pull_request: |
| 9 | + branches: [ master ] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: ${{ matrix.friendlyName }} |
| 14 | + env: |
| 15 | + DISPLAY: ":99.0" |
| 16 | + CC: "clang" |
| 17 | + CXX: "clang++" |
| 18 | + npm_config_clang: "1" |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + node-version: [15.x] |
| 23 | + os: [ubuntu-16.04, windows-latest, macos-latest] |
| 24 | + include: |
| 25 | + - os: ubuntu-16.04 |
| 26 | + friendlyName: Ubuntu |
| 27 | + - os: windows-latest |
| 28 | + friendlyName: Windows |
| 29 | + - os: macos-latest |
| 30 | + friendlyName: macOS |
| 31 | + |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v2 |
| 36 | + - name: Use Node.js ${{ matrix.node-version }} |
| 37 | + uses: actions/setup-node@v1 |
| 38 | + with: |
| 39 | + node-version: ${{ matrix.node-version }} |
| 40 | + |
| 41 | + - run: npm install |
| 42 | + name: Setup environment |
| 43 | + |
| 44 | + - run: npm test |
| 45 | + name: Run tests (Windows/macOS) |
| 46 | + |
| 47 | + - run: | |
| 48 | + npm run prebuild-node |
| 49 | + npm run prebuild-electron |
| 50 | + name: Prebuild (x64) |
| 51 | +
|
| 52 | + - run: | |
| 53 | + npm run prebuild-electron-arm64 |
| 54 | + npm run prebuild-node-ia32 |
| 55 | + npm run prebuild-electron-ia32 |
| 56 | + if: ${{ matrix.os == 'windows-latest' }} |
| 57 | + name: Prebuild (Windows x86 + ARM64) |
| 58 | +
|
| 59 | + - run: | |
| 60 | + mkdir -p prebuilds && chmod 777 prebuilds |
| 61 | + docker build -t node-fs-admin/i386 docker/i386 |
| 62 | + docker run --rm -v ${PWD}:/project node-fs-admin/i386 /bin/bash -c "cd /project && npm run prebuild-node-ia32 && npm run prebuild-electron-ia32 && rm -rf build" |
| 63 | + docker build -t node-fs-admin/arm64-cross-compile docker/arm64-cross-compile |
| 64 | + docker run --rm -v ${PWD}:/project node-fs-admin/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-electron-arm64" |
| 65 | + if: ${{ matrix.os == 'ubuntu-16.04' }} |
| 66 | + name: Prebuild (Linux x86 + ARM64) |
| 67 | +
|
| 68 | + - run: | |
| 69 | + ls prebuilds/ |
| 70 | + name: List prebuilds |
| 71 | +
|
| 72 | + - name: Upload prebuilds to GitHub |
| 73 | + run: npm run upload |
| 74 | + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 75 | + env: |
| 76 | + GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + |
| 78 | + # Separate step for publishing to NPM so we're sure that generating + uploading prebuilds worked on all platforms |
| 79 | + npm-publish: |
| 80 | + needs: build |
| 81 | + name: Publish to NPM |
| 82 | + runs-on: ubuntu-20.04 |
| 83 | + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 84 | + |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v2 |
| 87 | + - name: Use Node.js 15 |
| 88 | + uses: actions/setup-node@v1 |
| 89 | + with: |
| 90 | + node-version: 15.x |
| 91 | + registry-url: 'https://registry.npmjs.org' |
| 92 | + |
| 93 | + - run: sudo apt-get install libsecret-1-dev |
| 94 | + name: Install additional dependencies |
| 95 | + |
| 96 | + - run: npm install |
| 97 | + name: Setup environment |
| 98 | + |
| 99 | + - run: npm publish --access public |
| 100 | + name: Upload to NPM |
| 101 | + env: |
| 102 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
0 commit comments