<fix> Created separate status check file and streamlined release process
This commit was merged in pull request #18.
This commit is contained in:
@@ -12,25 +12,10 @@ name: Build Multi-Platform Binaries
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: "Branch to build from"
|
||||
required: false
|
||||
default: "main"
|
||||
type: string
|
||||
jobs:
|
||||
description: "Comma-separated jobs to run (e.g., build-windows,build-debian,build-arch,build-rhel)"
|
||||
required: true
|
||||
default: "build-windows,build-debian,build-arch,build-rhel"
|
||||
DO_RELEASE:
|
||||
description: "Set to 'true' to create a GitHub release after successful builds"
|
||||
required: false
|
||||
default: "false"
|
||||
UPLOAD_S3:
|
||||
description: "Set to 'true' to upload build artifacts to S3 after builds"
|
||||
required: false
|
||||
default: "false"
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -43,20 +28,64 @@ env:
|
||||
CI_CD: true
|
||||
|
||||
jobs:
|
||||
merge-develop-to-main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Fast-forward main to develop
|
||||
run: |
|
||||
set -e
|
||||
git fetch origin main develop
|
||||
|
||||
# Verify develop is ahead of main
|
||||
MERGE_BASE=$(git merge-base origin/main origin/develop)
|
||||
MAIN_SHA=$(git rev-parse origin/main)
|
||||
|
||||
if [ "$MERGE_BASE" != "$MAIN_SHA" ]; then
|
||||
echo "::error::Main branch has commits not in develop. Cannot fast-forward."
|
||||
echo "::error::Please merge or rebase main into develop first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure develop is actually ahead
|
||||
DEVELOP_SHA=$(git rev-parse origin/develop)
|
||||
if [ "$MAIN_SHA" = "$DEVELOP_SHA" ]; then
|
||||
echo "Main is already up to date with develop. Nothing to merge."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Fast-forward merge develop into main
|
||||
git checkout main
|
||||
git merge origin/develop --ff-only
|
||||
|
||||
echo "Successfully fast-forwarded main to develop"
|
||||
git log origin/main..HEAD --oneline
|
||||
|
||||
git push origin main
|
||||
|
||||
run-unit-tests-linux:
|
||||
needs: [merge-develop-to-main]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Display build information
|
||||
run: |
|
||||
echo "Event: ${{ github.event_name }}"
|
||||
echo "Branch: ${{ github.event.inputs.branch || github.head_ref || github.ref }}"
|
||||
echo "Jobs to run: ${{ github.event.inputs.jobs || 'build-windows,build-debian,build-arch,build-rhel' }}"
|
||||
echo "Create release: ${{ github.event.inputs.DO_RELEASE || 'false' }}"
|
||||
echo "Upload to S3: ${{ github.event.inputs.UPLOAD_S3 || 'false' }}"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
@@ -75,11 +104,12 @@ jobs:
|
||||
poetry run pytest tests/ -v
|
||||
|
||||
run-unit-tests-windows:
|
||||
needs: [merge-develop-to-main]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
@@ -109,13 +139,13 @@ jobs:
|
||||
poetry run pytest tests/ -v
|
||||
build-windows:
|
||||
needs: [run-unit-tests-linux, run-unit-tests-windows]
|
||||
if: ${{ github.event_name == 'pull_request' || contains(github.event.inputs.jobs, 'build-windows') }}
|
||||
if: ${{ contains(github.event.inputs.jobs, 'build-windows') }}
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
@@ -155,7 +185,7 @@ jobs:
|
||||
|
||||
build-debian:
|
||||
needs: [run-unit-tests-linux, run-unit-tests-windows]
|
||||
if: ${{ github.event_name == 'pull_request' || contains(github.event.inputs.jobs, 'build-debian') }}
|
||||
if: ${{ contains(github.event.inputs.jobs, 'build-debian') }}
|
||||
env:
|
||||
DISTRO_TYPE: debian
|
||||
runs-on: ubuntu-latest
|
||||
@@ -176,7 +206,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
@@ -242,7 +272,7 @@ jobs:
|
||||
|
||||
build-arch:
|
||||
needs: [run-unit-tests-linux, run-unit-tests-windows]
|
||||
if: ${{ github.event_name == 'pull_request' || contains(github.event.inputs.jobs, 'build-arch') }}
|
||||
if: ${{ contains(github.event.inputs.jobs, 'build-arch') }}
|
||||
env:
|
||||
DISTRO_TYPE: arch
|
||||
runs-on: ubuntu-latest
|
||||
@@ -263,7 +293,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
@@ -322,7 +352,7 @@ jobs:
|
||||
|
||||
build-rhel:
|
||||
needs: [run-unit-tests-linux, run-unit-tests-windows]
|
||||
if: ${{ github.event_name == 'pull_request' || contains(github.event.inputs.jobs, 'build-rhel') }}
|
||||
if: ${{ contains(github.event.inputs.jobs, 'build-rhel') }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
@@ -335,7 +365,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Build RHEL package
|
||||
run: |
|
||||
@@ -376,52 +406,14 @@ jobs:
|
||||
|
||||
|
||||
do-release:
|
||||
needs: [run-unit-tests-linux, run-unit-tests-windows, build-windows, build-debian, build-arch, build-rhel]
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.DO_RELEASE == 'true' && needs.build-windows.result == 'success' && needs.build-debian.result == 'success' && needs.build-arch.result == 'success' && needs.build-rhel.result == 'success' }}
|
||||
needs: [build-windows, build-debian, build-arch, build-rhel]
|
||||
if: ${{ needs.build-windows.result == 'success' && needs.build-debian.result == 'success' && needs.build-arch.result == 'success' && needs.build-rhel.result == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Fast-forward main to develop
|
||||
run: |
|
||||
set -e
|
||||
git fetch origin main develop
|
||||
|
||||
# Verify develop is ahead of main
|
||||
MERGE_BASE=$(git merge-base origin/main origin/develop)
|
||||
MAIN_SHA=$(git rev-parse origin/main)
|
||||
|
||||
if [ "$MERGE_BASE" != "$MAIN_SHA" ]; then
|
||||
echo "::error::Main branch has commits not in develop. Cannot fast-forward."
|
||||
echo "::error::Please merge or rebase main into develop first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure develop is actually ahead
|
||||
DEVELOP_SHA=$(git rev-parse origin/develop)
|
||||
if [ "$MAIN_SHA" = "$DEVELOP_SHA" ]; then
|
||||
echo "Main is already up to date with develop. Nothing to merge."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Fast-forward merge develop into main
|
||||
git checkout main
|
||||
git merge origin/develop --ff-only
|
||||
|
||||
echo "Successfully fast-forwarded main to develop"
|
||||
git log origin/main..HEAD --oneline
|
||||
|
||||
git push origin main
|
||||
ref: main
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
@@ -456,14 +448,14 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
upload-s3:
|
||||
needs: [run-unit-tests-linux, run-unit-tests-windows, build-windows, build-debian, build-arch, build-rhel]
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.UPLOAD_S3 == 'true' || contains(github.event.inputs.jobs, 'upload-s3')) }}
|
||||
needs: [build-windows, build-debian, build-arch, build-rhel]
|
||||
if: ${{ needs.build-windows.result == 'success' && needs.build-debian.result == 'success' && needs.build-arch.result == 'success' && needs.build-rhel.result == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
|
||||
ref: main
|
||||
|
||||
- name: Install AWS CLI
|
||||
run: |
|
||||
@@ -498,5 +490,5 @@ jobs:
|
||||
if: always() && needs.do-release.result == 'success'
|
||||
uses: ./.github/workflows/sync-wiki.yml
|
||||
with:
|
||||
branch: ${{ github.event.inputs.branch || github.ref }}
|
||||
branch: main
|
||||
secrets: inherit
|
||||
Reference in New Issue
Block a user