From a575fbda3724736f40b3147314c40765419ca503 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Sun, 23 Jun 2024 12:07:51 +0900 Subject: [PATCH] Add aarch64 debian build for action/workflow Also minor fixes. --- .forgejo/workflows/build_releases.yaml | 64 ++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/build_releases.yaml b/.forgejo/workflows/build_releases.yaml index d70269c..9932c0d 100644 --- a/.forgejo/workflows/build_releases.yaml +++ b/.forgejo/workflows/build_releases.yaml @@ -22,6 +22,7 @@ jobs: -H "Authorization: token ${GITHUB_TOKEN}" \ -H 'Content-Type: application/json' \ -d "{ + \"body\": \"SHA256SUMS\", \"name\": \"break_interval version ${GITHUB_REF_NAME}\", \"tag_name\": \"${GITHUB_REF_NAME}\" }" 2>/dev/null > "${THE_ACTION_WORKING_DIRECTORY}/release_${GITHUB_REF_NAME}_create.json" fi @@ -66,7 +67,7 @@ jobs: -H 'Content-Type: application/json' \ -d "{ \"body\": \"$(jq .body < "${THE_ACTION_WORKING_DIRECTORY}/current_release_info.json" | sed -e 's/^"//' -e 's/"$//') - SHA256SUM $(find "${THE_ACTION_WORKING_DIRECTORY}" -maxdepth 1 -name "*${BUILD_ASSET_NAME}" -execdir sha256sum '{}' ';')\" + $(find "${THE_ACTION_WORKING_DIRECTORY}" -maxdepth 1 -name "*${BUILD_ASSET_NAME}" -execdir sha256sum '{}' ';')\" }" >&/dev/null curl --fail-with-body -X POST \ "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")/assets" \ @@ -118,7 +119,7 @@ jobs: -H 'Content-Type: application/json' \ -d "{ \"body\": \"$(jq .body < "${THE_ACTION_WORKING_DIRECTORY}/current_release_info.json" | sed -e 's/^"//' -e 's/"$//') - SHA256SUM $(find "${THE_ACTION_WORKING_DIRECTORY}" -maxdepth 1 -name "*${BUILD_ASSET_NAME}" -execdir sha256sum '{}' ';')\" + $(find "${THE_ACTION_WORKING_DIRECTORY}" -maxdepth 1 -name "*${BUILD_ASSET_NAME}" -execdir sha256sum '{}' ';')\" }" >&/dev/null curl --fail-with-body -X POST \ "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")/assets" \ @@ -151,6 +152,7 @@ jobs: for asset in $(jq '.assets[].name' < release_info.json | tr -d '"'); do if [[ "$asset" == "$BUILD_ASSET_NAME" ]]; then touch asset_exists + break fi done - name: Build and publish if asset does not exist @@ -173,7 +175,63 @@ jobs: -H 'Content-Type: application/json' \ -d "{ \"body\": \"$(jq .body < release_info.json | sed -e 's/^"//' -e 's/"$//') - SHA256SUM $(sha256sum "${BUILD_ASSET_NAME}")\" + $(sha256sum "${BUILD_ASSET_NAME}")\" + }" >&/dev/null + + curl --fail-with-body -X POST \ + "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < release_info.json)/assets" \ + -H 'accept: application/json' \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + -H 'Content-Type: multipart/form-data' \ + -F "attachment=@${BUILD_ASSET_NAME};type=application/zstd" > attach.json 2>/dev/null + fi + push-build-aarch64_debian: + if: ${{ always() }} + needs: push-build-x86_64_debian + concurrency: + group: push-build-group + runs-on: aarch64_docker_debian_bookworm + env: + BUILD_ASSET_NAME: "break_interval_aarch64_debian_${{ github.ref_name }}.zstd" + steps: + - name: Update and upgrade with apt + run: apt-get --yes update && apt-get --yes upgrade + - name: Get necessary packages + run: apt-get --yes install gcc g++ jq curl cmake make zstd sed git + - name: Get release info + run: | + curl -X GET \ + "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/${GITHUB_REF_NAME}" \ + -H 'accept: application/json' -o release_info.json + - name: Check if asset exists + run: | + for asset in $(jq '.assets[].name' < release_info.json | tr -d '"'); do + if [[ "$asset" == "$BUILD_ASSET_NAME" ]]; then + touch asset_exists + break + fi + done + - name: Build and publish if asset does not exist + run: | + if ! [[ -e ./asset_exists ]]; then + git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/break_interval.git break_interval_clone + pushd break_interval_clone >&/dev/null + + git checkout "${GITHUB_REF_NAME}" + cmake -S . -B buildRelease -DCMAKE_BUILD_TYPE=Release + make -C buildRelease + + popd >&/dev/null + zstd --ultra -20 break_interval_clone/buildRelease/break_interval -o "${BUILD_ASSET_NAME}" + + curl --fail-with-body -X PATCH \ + "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < release_info.json)" \ + -H 'accept: application/json' \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + -H 'Content-Type: application/json' \ + -d "{ + \"body\": \"$(jq .body < release_info.json | sed -e 's/^"//' -e 's/"$//') + $(sha256sum "${BUILD_ASSET_NAME}")\" }" >&/dev/null curl --fail-with-body -X POST \