From 503023cd53c89154c7624b761193354bf99bda98 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 19 Nov 2023 20:31:41 +0000 Subject: [PATCH] chore(build): refactor build workflow --- .github/workflows/_build.yml | 5 +- .github/workflows/build.yml | 89 +++++++++++++++++++++++++--- .github/workflows/monthly-master.yml | 29 +++++++++ .github/workflows/nightly-master.yml | 28 ++------- 4 files changed, 117 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/monthly-master.yml diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml index 22194ae..e164177 100644 --- a/.github/workflows/_build.yml +++ b/.github/workflows/_build.yml @@ -64,6 +64,10 @@ on: TAP_REPO_TOKEN: description: Homebrew Tap Token required: true + outputs: + package_created: + description: "Whether or not a package was created" + value: ${{ jobs.package.result == 'success' }} jobs: prepare: @@ -202,7 +206,6 @@ jobs: package: runs-on: ${{ inputs.os }} needs: [prepare, plan, build] - # Only run if check for existing release and asset failed. steps: - uses: actions/setup-python@v4 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2c7036..a148c52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,26 +22,95 @@ on: description: 'Runner OS ("macos-11", "macos-12", or "macos-latest")' required: true default: "macos-11" - build_os: - description: "Build OS used to build Emacs" + test_build_name: + description: "Test build name" + required: false + default: "" + test_release_type: + description: "prerelease or draft" + required: false + default: "" + x86_64: + description: "Build x86_64 version of Emacs" + required: false + default: true + type: boolean + arm64: + description: "Build arm64 version of Emacs" required: false + default: false + type: boolean + workflow_call: + inputs: + git_ref: + description: Emacs git ref to build + required: true + default: "master" + type: string + git_sha: + description: Override Emacs git commit SHA to build + required: false + type: string + builder_ref: + description: "Git ref to checkout of build-emacs-for-macos" + required: true + default: "master" + type: string + builder_args: + description: Custom arguments passed to build script + required: false + default: "" + type: string + os: + description: 'Runner OS ("macos-11", "macos-12", or "macos-latest")' + required: true default: "macos-11" + type: string test_build_name: description: "Test build name" required: false default: "" + type: string test_release_type: description: "prerelease or draft" required: false default: "" + type: string x86_64: description: "Build x86_64 version of Emacs" required: false - default: "true" + default: true + type: boolean arm64: description: "Build arm64 version of Emacs" required: false - default: "false" + default: false + type: boolean + secrets: + APPLE_DEVELOPER_CERTIFICATE_P12_BASE64: + description: Base64 encoded Apple Developer Certificate + required: true + APPLE_DEVELOPER_CERTIFICATE_PASSWORD: + description: Password for Apple Developer Certificate + required: true + KEYCHAIN_PASSWORD: + description: Password to use for temporary local keychain on runner + required: true + AC_USERNAME: + description: Apple Connect Username + required: true + AC_PASSWORD: + description: Apple Connect Password + required: true + AC_PROVIDER: + description: Apple Connect Provider + required: true + AC_SIGN_IDENTITY: + description: Apple Connect Signing Identify + required: true + TAP_REPO_TOKEN: + description: Homebrew Tap Token + required: true jobs: prepare: @@ -60,11 +129,11 @@ jobs: build_x86_64: name: Build (x86_64) if: ${{ github.event.inputs.x86_64 == 'true' }} - needs: [prepare] uses: ./.github/workflows/_build.yml + needs: [prepare] with: os: ${{ github.event.inputs.os }} - build_os: ${{ github.event.inputs.build_os }} + build_os: "macos-11" artifact_prefix: "x86_64-" git_ref: ${{ github.event.inputs.git_ref }} git_sha: ${{ github.event.inputs.git_sha }} @@ -83,8 +152,9 @@ jobs: release_x86_64: name: Release (x86_64) - needs: [build_x86_64] uses: ./.github/workflows/_release.yml + needs: [build_x86_64] + if: ${{ needs.build_x86_64.outputs.package_created }} with: os: ${{ github.event.inputs.os }} plan_artifact: x86_64-build-plan @@ -100,8 +170,8 @@ jobs: build_arm64: name: Build (arm64) if: ${{ github.event.inputs.arm64 == 'true' }} - needs: [prepare] uses: ./.github/workflows/_build.yml + needs: [prepare] with: os: ${{ github.event.inputs.os }} build_os: "macos-13-xlarge" # Only macos-13-xlarge has arm64 support. @@ -123,8 +193,9 @@ jobs: release_arm64: name: Release (arm64) - needs: [build_arm64] uses: ./.github/workflows/_release.yml + needs: [build_arm64] + if: ${{ needs.build_arm64.outputs.package_created }} with: os: ${{ github.event.inputs.os }} plan_artifact: arm64-build-plan diff --git a/.github/workflows/monthly-master.yml b/.github/workflows/monthly-master.yml new file mode 100644 index 0000000..bac201b --- /dev/null +++ b/.github/workflows/monthly-master.yml @@ -0,0 +1,29 @@ +--- +name: Monthly (master) +on: + schedule: + - cron: "0 23 1 * *" + workflow_dispatch: + inputs: + git_sha: + description: Override Emacs git commit SHA to build + required: false + +jobs: + build: + name: Build + uses: ./.github/workflows/build.yml + with: + git_ref: master + git_sha: ${{ github.event.inputs.git_sha }} + x86_64: true + arm64: true + secrets: + APPLE_DEVELOPER_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} + APPLE_DEVELOPER_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + AC_USERNAME: ${{ secrets.AC_USERNAME }} + AC_PASSWORD: ${{ secrets.AC_PASSWORD }} + AC_PROVIDER: ${{ secrets.AC_PROVIDER }} + AC_SIGN_IDENTITY: ${{ secrets.AC_SIGN_IDENTITY }} + TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }} diff --git a/.github/workflows/nightly-master.yml b/.github/workflows/nightly-master.yml index eb65fe1..4f0d0d4 100644 --- a/.github/workflows/nightly-master.yml +++ b/.github/workflows/nightly-master.yml @@ -2,7 +2,7 @@ name: Nightly (master) on: schedule: - - cron: "0 23 * * *" + - cron: "0 23 2-31 * *" workflow_dispatch: inputs: git_sha: @@ -10,23 +10,14 @@ on: required: false jobs: - prepare: - name: Prepare - uses: ./.github/workflows/_prepare.yml - with: - os: macos-11 - secrets: - TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }} - build: name: Build - needs: [prepare] - uses: ./.github/workflows/_build.yml + uses: ./.github/workflows/build.yml with: - os: macos-11 git_ref: master git_sha: ${{ github.event.inputs.git_sha }} - build_args: --native-comp + x86_64: true + arm64: false secrets: APPLE_DEVELOPER_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} APPLE_DEVELOPER_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} @@ -36,14 +27,3 @@ jobs: AC_PROVIDER: ${{ secrets.AC_PROVIDER }} AC_SIGN_IDENTITY: ${{ secrets.AC_SIGN_IDENTITY }} TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }} - - release: - name: Release - needs: [build] - uses: ./.github/workflows/_release.yml - with: - os: macos-11 - plan_artifact: build-plan - dmg_artifact: dmg - secrets: - TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}