trigger_daily_build #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Create Daily Build' | |
# concurrency: | |
# group: ${{ github.workflow }}-${{ github.ref_name }} | |
# cancel-in-progress: true | |
on: | |
repository_dispatch: | |
types: [trigger_daily_build] | |
workflow_dispatch: | |
inputs: | |
date: | |
type: string | |
description: "Date to build packages for (YYYYMMDD)" | |
required: false | |
jobs: | |
DailyBuildVariables: | |
runs-on: ["self-hosted"] | |
outputs: | |
mage_version: ${{ steps.compute.outputs.mage_version }} | |
memgraph_version: ${{ steps.compute.outputs.memgraph_version }} | |
memgraph_commit: ${{ steps.compute.outputs.memgraph_commit }} | |
build_date: ${{ steps.compute.outputs.build_date }} | |
binary_name_base: ${{ steps.compute.outputs.binary_name_base }} | |
steps: | |
- name: Set up repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Compute variables using Python script | |
id: compute | |
run: | | |
# Pass the client payload (as JSON) to the Python script. | |
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then | |
payload='${{ toJson(github.event.client_payload) }}' | |
else | |
# Check if the 'date' input is empty; if so, compute today's date in YYYYMMDD format. | |
if [ -z "${{ github.event.inputs.date }}" ]; then | |
build_date=$(date +'%Y%m%d') | |
else | |
build_date="${{ github.event.inputs.date }}" | |
fi | |
# now reformat it as JSON | |
payload="{\"date\": ${build_date}}" | |
fi | |
echo "Received payload: $payload" | |
read mage_version memgraph_version memgraph_commit build_date < <(python3 daily_build_vars.py "$payload") | |
echo "mage_version=${mage_version}" >> $GITHUB_OUTPUT | |
echo "memgraph_version=${memgraph_version}" >> $GITHUB_OUTPUT | |
echo "memgraph_commit=${memgraph_commit}" >> $GITHUB_OUTPUT | |
echo "build_date=${build_date}" >> $GITHUB_OUTPUT | |
binary_name_base=$(python3 -c "import urllib.parse; print(urllib.parse.quote('memgraph_' + '$memgraph_version' + '-1'))") | |
echo "binary_name_base=${binary_name_base}" >> $GITHUB_OUTPUT | |
# Print to console for debugging: | |
echo "DEBUG: mage_version=${mage_version}" | |
echo "DEBUG: memgraph_version=${memgraph_version}" | |
echo "DEBUG: memgraph_commit=${memgraph_commit}" | |
echo "DEBUG: build_date=${build_date}" | |
echo "DEBUG: binary_name_base=memgraph_${memgraph_version}-1" | |
DailyBuildArtifact: | |
needs: [DailyBuildVariables] | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: ["Release", "RelWithDebInfo"] | |
build_arch: ["amd64", "arm64"] | |
malloc: [false] | |
include: | |
- build_type: "RelWithDebInfo" | |
rwid_ext: "-relwithdebinfo" | |
- build_arch: "arm64" | |
arm_ext: "-aarch64" | |
- build_type: "Release" | |
build_arch: "amd64" | |
malloc: true | |
uses: ./.github/workflows/reusable_package_mage.yaml | |
with: | |
arch: "${{ matrix.build_arch }}" | |
mage_version: "${{ needs.DailyBuildVariables.outputs.mage_version }}" | |
mage_build_type: "${{ matrix.build_type }}" | |
memgraph_version: "${{ needs.DailyBuildVariables.outputs.memgraph_version }}" | |
memgraph_download_link: "https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/daily-build/memgraph/${{ needs.DailyBuildVariables.outputs.build_date }}/ubuntu-24.04${{ matrix.arm_ext }}${{ matrix.rwid_ext }}${{ matrix.malloc && '-malloc' || '' }}/${{ needs.DailyBuildVariables.outputs.binary_name_base }}_${{ matrix.build_arch }}.deb" | |
shorten_tag: "false" | |
force_release: "true" | |
push_to_dockerhub: "false" | |
push_to_s3: "true" | |
s3_dest_bucket: "deps.memgraph.io" | |
s3_dest_dir: "daily-build/mage/${{ needs.DailyBuildVariables.outputs.build_date }}" | |
malloc: ${{ matrix.malloc }} | |
secrets: inherit | |
TestMAGE: | |
needs: [DailyBuildVariables] | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: ["amd64","arm64"] | |
uses: ./.github/workflows/reusable_test.yml | |
with: | |
arch: "${{ matrix.arch }}" | |
memgraph_version: "${{ needs.DailyBuildVariables.outputs.memgraph_version }}" | |
memgraph_download_link: "https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/daily-build/memgraph/${{ needs.DailyBuildVariables.outputs.build_date }}/ubuntu-24.04${{ matrix.arch == 'arm64' && '-aarch64' || '' }}/${{ needs.DailyBuildVariables.outputs.binary_name_base }}_${{ matrix.arch }}.deb" | |
memgraph_ref: "${{ needs.DailyBuildVariables.outputs.memgraph_commit }}" | |
memgraph_ref_update: "true" | |
secrets: inherit | |
AggregateBuildTests: | |
if: always() | |
needs: [DailyBuildVariables,DailyBuildArtifact,TestMAGE] | |
runs-on: [self-hosted] | |
steps: | |
- name: Set up repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Aggregate Test Results and Builds | |
env: | |
TEST_RESULT: ${{ needs.TestMAGE.result == 'success' && 'pass' || 'fail' }} | |
CURRENT_BUILD_DATE: ${{ needs.DailyBuildVariables.outputs.build_date }} | |
run: | | |
echo "TEST_RESULT: $TEST_RESULT" | |
echo "Package Date: $CURRENT_BUILD_DATE" | |
echo "BUILD_TEST_RESULTS=$(python3 aggregate_build_tests.py)" >> $GITHUB_ENV | |
- name: Trigger Daily Builds Page Update | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_PAT }} | |
run: | | |
payload="${BUILD_TEST_RESULTS}" | |
echo "Payload: $payload" | |
# Send the dispatch request | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/repos/memgraph/daily-builds/dispatches \ | |
-d "$payload" | |