Skip to content

Commit

Permalink
feat(build): refactor nightly workflow to just reuse the build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jimeh committed Dec 1, 2024
1 parent 37475a0 commit dcb135c
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 171 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,6 @@ on:
type: string
required: false
default: "prerelease"
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
outputs:
package_created:
description: "Whether or not a package was created"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/_prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ on:
inputs:
builder_ref:
description: Git ref to checkout of build-emacs-for-macos
required: false
required: true
type: string
default: "v0.6.52"
outputs:
builder_sha:
description: Git SHA of build-emacs-for-macos at builder_ref
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/_update-casks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
type: string
required: false
default: "ubuntu-latest"
secrets:
TAP_REPO_TOKEN:
description: Personal Access Token for Homebrew Tap repo
required: true

jobs:
emacs-builds:
Expand Down
89 changes: 57 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,74 @@ on:
required: false
default: true
type: boolean
workflow_call:
inputs:
git_ref:
description: Emacs git ref to build
required: true
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: false
default: "v0.6.52"
type: string
builder_args:
description: Custom arguments passed to build script
required: false
default: ""
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
type: boolean
arm64:
description: "Build arm64 version of Emacs"
required: false
default: true
type: boolean

jobs:
prepare:
name: Prepare
uses: ./.github/workflows/_prepare.yml
with:
builder_ref: ${{ github.event.inputs.builder_ref }}
builder_ref: ${{ inputs.builder_ref }}

# ----------------------------------------------------------------------------
# Build x86_64 version of Emacs
# ----------------------------------------------------------------------------

build_x86_64:
name: Build (x86_64)
if: github.event.inputs.x86_64 == 'true'
if: inputs.x86_64 == 'true'
uses: ./.github/workflows/_build.yml
needs: [prepare]
with:
builder_ref: ${{ needs.prepare.outputs.builder_sha }}
os: "macos-13"
build_os: "macos-13" # Only macos-13 and earlier are x86_64.
artifact_prefix: "x86_64-"
git_ref: ${{ github.event.inputs.git_ref }}
git_sha: ${{ github.event.inputs.git_sha }}
build_args: ${{ github.event.inputs.builder_args }}
test_build_name: ${{ github.event.inputs.test_build_name }}
test_release_type: ${{ github.event.inputs.test_release_type }}
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 }}
git_ref: ${{ inputs.git_ref }}
git_sha: ${{ inputs.git_sha }}
build_args: ${{ inputs.builder_args }}
test_build_name: ${{ inputs.test_build_name }}
test_release_type: ${{ inputs.test_release_type }}
secrets: inherit

release_x86_64:
name: Release (x86_64)
Expand All @@ -96,27 +129,20 @@ jobs:

build_arm64:
name: Build (arm64)
if: github.event.inputs.arm64 == 'true'
if: inputs.arm64 == 'true'
uses: ./.github/workflows/_build.yml
needs: [prepare]
with:
builder_ref: ${{ needs.prepare.outputs.builder_sha }}
os: "macos-14"
build_os: "macos-14" # Only macos-14 and later are ARM64.
artifact_prefix: "arm64-"
git_ref: ${{ github.event.inputs.git_ref }}
git_sha: ${{ github.event.inputs.git_sha }}
build_args: ${{ github.event.inputs.builder_args }}
test_build_name: ${{ github.event.inputs.test_build_name }}
test_release_type: ${{ github.event.inputs.test_release_type }}
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 }}
git_ref: ${{ inputs.git_ref }}
git_sha: ${{ inputs.git_sha }}
build_args: ${{ inputs.builder_args }}
test_build_name: ${{ inputs.test_build_name }}
test_release_type: ${{ inputs.test_release_type }}
secrets: inherit

release_arm64:
name: Release (arm64)
Expand Down Expand Up @@ -149,8 +175,7 @@ jobs:
needs: [release_x86_64, release_arm64]
if: >-
always() &&
github.event.inputs.test_build_name == '' &&
inputs.test_build_name == '' &&
contains(needs.*.result, 'success') &&
!contains(needs.*.result, 'failure')
secrets:
TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}
secrets: inherit
126 changes: 15 additions & 111 deletions .github/workflows/nightly-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,126 +2,30 @@
name: Nightly (master)
on:
schedule:
- cron: "0 23 1 * *"
- cron: "0 23 2-31 * *"
- cron: "0 23 * * *"
workflow_dispatch:
inputs:
git_sha:
description: Override Emacs git commit SHA to build
required: false
x86_64:
description: "Build x86_64 version of Emacs"
required: false
default: true
type: boolean
arm64:
description: "Build arm64 version of Emacs?"
description: "Build arm64 version of Emacs"
required: false
default: false
default: true
type: boolean

jobs:
prepare:
name: Prepare
uses: ./.github/workflows/_prepare.yml
secrets:
TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}

# ----------------------------------------------------------------------------
# Build x86_64 version of Emacs
# ----------------------------------------------------------------------------

build_x86_64:
name: Build (x86_64)
uses: ./.github/workflows/_build.yml
needs: [prepare]
with:
build_os: "macos-13"
artifact_prefix: "x86_64-"
git_ref: "master"
git_sha: ${{ github.event.inputs.git_sha }}
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 }}

release_x86_64:
name: Release (x86_64)
uses: ./.github/workflows/_release.yml
# Depend on both build_x86_64 and build_arm64, but only run if build_x86_64
# was successful and a package was created. This ensure wait for all builds
# to complete before running any release jobs.
needs: [build_x86_64, build_arm64]
if: |
always() &&
needs.build_x86_64.result == 'success' &&
needs.build_x86_64.outputs.package_created &&
needs.build_arm64.result != 'failure'
build:
name: Build
uses: ./.github/workflows/build.yml
with:
plan_artifact: x86_64-build-plan
dmg_artifact: x86_64-dmg
secrets:
TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}

# ----------------------------------------------------------------------------
# Build arm64 version of Emacs
# ----------------------------------------------------------------------------

build_arm64:
name: Build (arm64)
if: >-
github.event.inputs.arm64 == 'true' ||
github.event.schedule == '0 23 1 * *'
uses: ./.github/workflows/_build.yml
needs: [prepare]
with:
build_os: "macos-13-xlarge" # Only macos-13-xlarge has arm64 support.
artifact_prefix: "arm64-"
git_ref: "master"
git_sha: ${{ github.event.inputs.git_sha }}
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 }}

release_arm64:
name: Release (arm64)
uses: ./.github/workflows/_release.yml
# Depend on both build_arm64 and build_x86_64, but only run if build_arm64
# was successful and a package was created. This ensure wait for all builds
# to complete before running any release jobs.
needs: [build_arm64, build_x86_64]
if: |
always() &&
needs.build_arm64.result == 'success' &&
needs.build_arm64.outputs.package_created &&
needs.build_x86_64.result != 'failure'
with:
plan_artifact: arm64-build-plan
dmg_artifact: arm64-dmg
secrets:
TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}

# ----------------------------------------------------------------------------
# Trigger update casks workflow in homebrew tap
# ----------------------------------------------------------------------------

update_casks:
name: Update Casks
uses: ./.github/workflows/_update-casks.yml
# Depend on both release jobs, but only run if either of them was
# successful. This ensures we only run this job once all release jobs have
# been completed.
needs: [release_x86_64, release_arm64]
if: >-
always() &&
github.event.inputs.test_build_name == '' &&
contains(needs.*.result, 'success') &&
!contains(needs.*.result, 'failure')
secrets:
TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}
git_sha: ${{ inputs.git_sha }}
x86_64: ${{ inputs.x86_64 }}
arm64: ${{ inputs.arm64 }}
secrets: inherit

0 comments on commit dcb135c

Please sign in to comment.