Skip to content

ci: add test build for jam #1

ci: add test build for jam

ci: add test build for jam #1

name: arm64-rpi-test
concurrency:
group: arm64-rpi-test-${{ github.head_ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches: ["dev", "v1.10", "v1.11", "ci-test-dev"]
paths:
- "ci/arm64-rpi/**"
- "home.admin/config.scripts/bonus.jam.sh"
- "home.admin/config.scripts/bonus.joinmarket.sh"
pull_request:
branches: ["dev", "v1.10", "v1.11", "ci-test-dev"]
paths:
- "ci/arm64-rpi/**"
- "home.admin/config.scripts/bonus.jam.sh"
- "home.admin/config.scripts/bonus.joinmarket.sh"
jobs:
arm64-rpi-test:
runs-on: ubuntu-22.04
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 31000
temp-reserve-mb: 31000
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Display free space
run: |
df -h
du -hd1
- name: Checkout code
uses: actions/checkout@v4
- name: Set values
id: set_values
run: |
echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV
if [ -z "$GITHUB_HEAD_REF" ]; then
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
else
echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
fi
if [[ "${{github.event_name}}" == "pull_request" ]]; then
echo "GITHUB_USER=${{github.event.pull_request.head.repo.owner.login}}" >> $GITHUB_OUTPUT
else
echo "GITHUB_USER=$(echo ${{github.repository}} | cut -d'/' -f1)" >> $GITHUB_OUTPUT
fi
#- name: Get the last successful workflow run ID
# id: get-run-id
# run: |
# RUN_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/raspiblitz/raspiblitz/actions/workflows/arm64-rpi-fatpack-image.yml/runs?branch=base-image-with-stop" | jq -r '.workflow_runs[0].id')
# echo "RUN_ID=$RUN_ID" >> $GITHUB_OUTPUT
- name: Download base image
uses: actions/download-artifact@v4
with:
#name: raspiblitz-arm64-rpi-base-image-${{ env.BUILD_VERSION }}
name: raspiblitz-arm64-rpi-base-image-973bcda
path: ci/arm64-rpi
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: raspiblitz/raspiblitz
run-id: 8266174231
- name: Set the "image_checksum" variable
run: |
echo "IMAGE_CHECKSUM=$(cat ci/arm64-rpi/raspiblitz-arm64-rpi-base.img.sha256 | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Run the test
run: |
echo "Using the variables: --github_user ${{steps.set_values.outputs.GITHUB_USER}} --branch ${{env.BRANCH_NAME}}"
cd ci/arm64-rpi
docker run --rm --privileged \
-v /dev:/dev \
-v .:/build \
mkaczanowski/packer-builder-arm:1.0.9 build \
-var "github_user=${{steps.set_values.outputs.GITHUB_USER}}" \
-var "branch=${{env.BRANCH_NAME}}" \
-var "artifact=file:/build/raspiblitz-arm64-rpi-base.img" \
-var "image_checksum=${{env.IMAGE_CHECKSUM}}" \
build.arm64-rpi-test.pkr.hcl
- name: Compute checksum of the raw image
run: |
cd ci/arm64-rpi
sha256sum raspiblitz-arm64-rpi-test.img > raspiblitz-arm64-rpi-test.img.sha256
- name: Compress image
run: |
cd ci/arm64-rpi
gzip -v9 raspiblitz-arm64-rpi-test.img
- name: Compute checksum of the compressed image
run: |
cd ci/arm64-rpi
sha256sum raspiblitz-arm64-rpi-test.img.gz > raspiblitz-arm64-rpi-test.img.gz.sha256
- name: Upload the image and checksums
uses: actions/upload-artifact@v4
with:
name: raspiblitz-arm64-rpi-test-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}
path: |
${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-test.img.sha256
${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-test.img.gz
${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-test.img.gz.sha256