Skip to content

Commit

Permalink
Fix BUILD_DIR in CI
Browse files Browse the repository at this point in the history
The authoritative build machine use `/home/user/cadr-build`, not
`/home/user/cadr-build/build`. This was probably source of
non-determinism.
  • Loading branch information
Kixunil committed Jul 19, 2024
1 parent 3538adf commit 5207dfb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ on:

env:
USER_NAME: user
REPO_DIR: /home/user/cryptoanarchy-deb-repo-builder
BUILD_DIR: /home/user/cadr-build
IMAGE_NAME: cadr/cadr
CONTAINER_NAME: cadr
CI_SCRIPT: ci/build.sh
PODMAN_CMD: "sudo -E XDG_RUNTIME_DIR= podman"
SPAWN_CONTAINER: "$PODMAN_CMD run --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro --privileged --systemd=true -d -v $PWD:$BUILD_DIR --name=$CONTAINER_NAME $IMAGE_NAME"
SPAWN_CONTAINER: "$PODMAN_CMD run --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro --privileged --systemd=true -d -v $PWD:$REPO_DIR --name=$CONTAINER_NAME $IMAGE_NAME"
EXECUTE_CMD: "$PODMAN_CMD exec -u $USER_NAME -i $CONTAINER_NAME"

jobs:
Expand Down Expand Up @@ -71,7 +72,7 @@ jobs:
- name: Get cache key
id: get-cache-key
run: |
eval $EXECUTE_CMD bash "${BUILD_DIR}/ci/get_cache_key.sh" "${{ matrix.source }}" >> $GITHUB_OUTPUT
eval $EXECUTE_CMD bash "${REPO_DIR}/ci/get_cache_key.sh" "${{ matrix.source }}" >> $GITHUB_OUTPUT
- name: Fetch package cache
id: cache-packages
uses: actions/cache@v3
Expand All @@ -83,17 +84,16 @@ jobs:
- name: Build packages
if: steps.cache-packages.outputs.cache-hit != 'true'
run: |
eval $EXECUTE_CMD bash "${BUILD_DIR}/$CI_SCRIPT" "${{ matrix.source }}"
sudo mkdir -p -m 777 packages
sudo mv -n build/*.deb packages
eval $EXECUTE_CMD bash "${REPO_DIR}/$CI_SCRIPT" "${{ matrix.source }}"
- name: Upload Debian Packages Just Built to Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.source }}
path: packages
- name: Check SHA256
run: |
sudo chown -R $USER build
sudo chown -R $USER packages
cd packages
for file in *.deb
do
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
- uses: actions/checkout@v2
- name: Setup Test Prefix
run: |
echo "TEST_PREFIX=sudo chown -R $USER_NAME $BUILD_DIR && cd $BUILD_DIR && make BUILD_DIR=$BUILD_DIR/build" >> $GITHUB_ENV
echo "TEST_PREFIX=sudo chown -R $USER_NAME $REPO_DIR && cd $REPO_DIR && make BUILD_DIR=$REPO_DIR/packages" >> $GITHUB_ENV
- name: Prepare Podman Container Running Environment
run: |
sudo apt-get update
Expand All @@ -158,7 +158,7 @@ jobs:
- name: Test CADR Basic
run: |
mkdir -p build
mv packages/*/*.deb build/
mv packages/*/*.deb packages/
eval $SPAWN_CONTAINER
eval $EXECUTE_CMD bash -c "\"$TEST_PREFIX test-here-basic-${{ matrix.package }}\""
$PODMAN_CMD rm -f $CONTAINER_NAME
Expand All @@ -180,7 +180,7 @@ jobs:
- uses: actions/checkout@v2
- name: Setup Test Prefix
run: |
echo "TEST_PREFIX=sudo chown -R $USER_NAME $BUILD_DIR && cd $BUILD_DIR && make BUILD_DIR=$BUILD_DIR/build" >> $GITHUB_ENV
echo "TEST_PREFIX=sudo chown -R $USER_NAME $REPO_DIR && cd $REPO_DIR && make BUILD_DIR=$REPO_DIR/packages" >> $GITHUB_ENV
- name: Prepare Podman Container Running Environment
run: |
sudo apt-get update
Expand All @@ -204,8 +204,7 @@ jobs:
path: packages
- name: Test multi-package CADR integration
run: |
mkdir -p build
mv packages/*/*.deb build/
mv packages/*/*.deb packages
eval $SPAWN_CONTAINER
eval $EXECUTE_CMD bash -c "\"$TEST_PREFIX test-here-multi-package-${{ matrix.test }}\""
$PODMAN_CMD rm -f $CONTAINER_NAME
Expand Down
8 changes: 5 additions & 3 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
set -ex

BUILD_DIR=/home/user/cadr-build
REPO_DIR=/home/user/cryptoanarchy-deb-repo-builder
sudo apt-get update
sudo chown -R user $BUILD_DIR
cd $BUILD_DIR
MKCMD="make SOURCES="$1" BUILD_DIR=${BUILD_DIR}/build"
sudo chown -R user "$REPO_DIR"
cd "$REPO_DIR"
MKCMD="make SOURCES="$1" BUILD_DIR=${BUILD_DIR}"
$MKCMD build-dep
$MKCMD all
mv "$BUILD_DIR"/*.deb "$REPO_DIR/packages"
2 changes: 1 addition & 1 deletion ci/get_cache_key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

cd /home/user/cadr-build
cd /home/user/cryptoanarchy-deb-repo-builder

dep="$1"
src="build_rules/$dep.yaml"
Expand Down

0 comments on commit 5207dfb

Please sign in to comment.