Skip to content

Commit

Permalink
WIP nightly build script
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Sep 14, 2022
1 parent db85c26 commit 9bc9e21
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 21 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: nightly
on:
# schedule:
# - cron: '0 7 * * *'
workflow_dispatch:
jobs:
# checks:
# runs-on: ubuntu-latest
# name: check for recent changes
# outputs:
# no_changes: ${{ steps.has_changes.outputs.no_changes }}
# steps:
# - uses: actions/checkout@v3
# - name: print latest commit
# run: echo ${{ github.sha }}
# - id: has_changes
# continue-on-error: true
# name: check for recent changes
# if: ${{ github.event_name == 'schedule' }}
# run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=no_changes::true"
windows:
# needs: checks
# if: ${{ needs.checks.outputs.no_changes != 'true' }}
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: install dependencies
run: yarn install --ignore-scripts
- name: build windows binaries
run: yarn workspace @esfx/equatable run package-node-win32-x64
- name: upload build artifacts
uses: actions/upload-artifact@v2.2.4
with:
name: windows-artifacts
path: |
packages/equatable/build/stage/
linux:
# needs: checks
# if: ${{ needs.checks.outputs.no_changes != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
- name: install dependencies
run: yarn install --ignore-scripts
- name: build linux binaries
run: yarn workspace @esfx/equatable run package-node-linux-x64
- name: upload build artifacts
uses: actions/upload-artifact@v2.2.4
with:
name: linux-artifacts
path: |
packages/equatable/build/stage/
macos:
# needs: checks
# if: ${{ needs.checks.outputs.no_changes != 'true' }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
- name: install dependencies
run: yarn install --ignore-scripts
- name: build macos binaries
run: yarn workspace @esfx/equatable run package-node-darwin-x64
- name: upload build artifacts
uses: actions/upload-artifact@v2.2.4
with:
name: macos-artifacts
path: |
packages/equatable/build/stage/
js:
# needs: checks
# if: ${{ needs.checks.outputs.no_changes != 'true' }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
- name: install dependencies
run: yarn install --ignore-scripts
- name: link workspace
run: lerna link
- name: prebuild
run: yarn workspace @esfx/canceltoken run prebuild
- name: build packages
run: gulp ci --no-prebuild
225 changes: 225 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: publish
on:
workflow_dispatch:
inputs:
version:
description: Version number to publish
required: true
type: string
default: 1.0.0-pre.37
force_publish:
description: Whether to force publication of all packages
required: false
type: boolean
default: false
prerelease:
description: Whether the associated GitHub Release should be marked as a prerelease
required: false
type: boolean
default: true
draft:
description: Whether the associated GitHub Release should be marked as a draft
required: false
type: boolean
default: true
jobs:
# Apply version information for packages we are about to publish
version:
runs-on: ubuntu-latest
outputs:
changed_packages: ${{ fromJSON(steps.changed_packages.outputs.changed_packages) }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: yarn install
run: yarn install --ignore-scripts
- name: lerna version
run: lerna version ${{ github.event.inputs.version }} --no-git-tag-version --no-push --yes $([ ${{github.event.inputs.force_publish }} == true ] && echo "--force-publish")
- name: upload version artifacts
uses: actions/upload-artifact@v3
with:
name: version-artifacts
path: |
internal/*/package*.json
packages/*/package*.json
package.json
lerna.json
yarn.lock
- name: capture changed packages
id: changed_packages
run: |
echo "::set-output name=changed_packages::$(CHANGED_PACKAGE_LIST=$(git status --porcelain -- internal/*/package.json packages/*/package.json | cut -c 4-) node -e 'process.stdout.write(JSON.stringify(process.env.CHANGED_PACKAGE_LIST.split(/\n/g).filter(Boolean).reduce((obj, path) => ({ ...obj, [path]: true }), {})))')";
js:
runs-on: ubuntu-latest
needs:
- version
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: sync version
uses: actions/download-artifact@v3
with:
name: version-artifacts
path: ${{ github.workspace }}
- name: yarn install
run: yarn install --ignore-scripts --frozen-lockfile --non-interactive
- name: lerna link
run: lerna link
- name: build
run: yarn run build-js
- name: test
run: yarn run test
- name: upload build artifacts
uses: actions/upload-artifact@v3
with:
name: js-artifacts
path: |
internal/*/dist/**
packages/*/dist/**
windows:
# TODO: Do not build for windows if binary packages not included in changed packages
# TODO: Test windows binaries
runs-on: windows-2019
needs:
- version
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: sync version
uses: actions/download-artifact@v3
with:
name: version-artifacts
path: ${{ github.workspace }}
- name: yarn install
run: yarn install --ignore-scripts --frozen-lockfile --non-interactive
- name: build windows binaries
run: yarn run build-windows
- name: upload build artifacts
uses: actions/upload-artifact@v3
with:
name: windows-artifacts
path: packages/equatable/build/stage/**
linux:
# TODO: Do not build for linux if binary packages not included in changed packages
# TODO: Test linux binaries
runs-on: ubuntu-latest
needs:
- version
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
- name: sync version
uses: actions/download-artifact@v3
with:
name: version-artifacts
path: ${{ github.workspace }}
- name: yarn install
run: yarn install --ignore-scripts --frozen-lockfile --non-interactive
- name: build linux binaries
run: yarn run build-linux
- name: upload build artifacts
uses: actions/upload-artifact@v3
with:
name: linux-artifacts
path: |
packages/equatable/build/stage/**
macos:
# TODO: Do not build for macos if binary packages not included in changed packages
# TODO: Test macos binaries
runs-on: macos-latest
needs:
- version
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
- name: sync version
uses: actions/download-artifact@v3
with:
name: version-artifacts
path: ${{ github.workspace }}
- name: yarn install
run: yarn install --ignore-scripts --frozen-lockfile --non-interactive
- name: build macos binaries
run: yarn run build-macos
- name: upload build artifacts
uses: actions/upload-artifact@v3
with:
name: macos-artifacts
path: |
packages/equatable/build/stage/**
# TODO: Build docs on windows
package:
runs-on: ubuntu-latest
needs:
- js
- windows
- linux
- macos
steps:
- uses: actions/checkout@v3
- name: use node v16
uses: actions/setup-node@v3
with:
node-version: 16
- name: sync version
uses: actions/download-artifact@v3
with:
name: version-artifacts
path: ${{ github.workspace }}
- name: yarn install
run: yarn install --ignore-scripts --frozen-lockfile --non-interactive
- name: lerna link
run: lerna link
- name: download js build artifacts
uses: actions/download-artifact@v3
with:
name: js-artifacts
path: ${{ github.workspace }}
- name: download windows build artifacts
uses: actions/download-artifact@v3
with:
name: windows-artifacts
path: packages/equatable/build/stage
- name: download linux build artifacts
uses: actions/download-artifact@v3
with:
name: linux-artifacts
path: packages/equatable/build/stage
- name: download macos build artifacts
uses: actions/download-artifact@v3
with:
name: macos-artifacts
path: packages/equatable/build/stage
- name: verify packages with prepack # NOTE: this is temporary and will be removed
run: yarn workspaces run prepack
- name: verify binaries # NOTE: this is temporary and will be removed
run: |
test -f packages/equatable/build/stage/${{ github.event.inputs.version }}/hashCodeNative-v${{ github.event.inputs.version }}-node-v102-win32-x64.tar.gz || (echo "missing windows binary" && exit 1)
test -f packages/equatable/build/stage/${{ github.event.inputs.version }}/hashCodeNative-v${{ github.event.inputs.version }}-node-v102-linux-x64.tar.gz || (echo "missing linux binary" && exit 1)
test -f packages/equatable/build/stage/${{ github.event.inputs.version }}/hashCodeNative-v${{ github.event.inputs.version }}-node-v102-darwin-x64.tar.gz || (echo "missing macos binary" && exit 1)
- name: list outputs # NOTE: this is temporary and will be removed
run: |
find internal/*/dist/** packages/*/dist/** packages/*/build/stage/** -type f
# TODO: Create git commit
# TODO: Tag release
# TODO: Publish release on GitHub
# TODO: Publish binaries to GitHub Release
# TODO: Publish to NPM
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"url": "https://github.com/esfx/esfx.git"
},
"scripts": {
"test": "gulp test"
"test": "gulp test",
"prebuild-js": "yarn workspace @esfx/canceltoken run prebuild && yarn workspace @esfx/equatable run prebuild",
"build-js": "gulp ci --no-prebuild",
"build-windows": "yarn workspace @esfx/equatable run package-node-win32-x64",
"build-linux": "yarn workspace @esfx/equatable run package-node-linux-x64",
"build-macos": "yarn workspace @esfx/equatable run package-node-darwin-x64"
},
"bugs": {
"url": "https://github.com/esfx/esfx/issues"
Expand Down
2 changes: 1 addition & 1 deletion packages/equatable/.npmfiles
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lib/hashCodeNative.js
lib/hashCode.cpp
lib/hashCode.h
lib/package.json
# binding.gyp
binding.gyp
LICENSE
package.json
README.md
3 changes: 1 addition & 2 deletions packages/equatable/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
.vscode
.npmfiles
__tests__
__perf__
binding.gyp_
__perf__
File renamed without changes.
Loading

0 comments on commit 9bc9e21

Please sign in to comment.