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 7b2c33c commit 941f986
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
18 changes: 9 additions & 9 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,17 @@ 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 }}"
sudo mv -n ${BUILD_DIR}/*.deb packages
- 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 /home/user
cd packages
for file in *.deb
do
Expand Down Expand Up @@ -133,7 +134,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 Down Expand Up @@ -180,7 +181,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=$BUILD_DIR" >> $GITHUB_ENV
- name: Prepare Podman Container Running Environment
run: |
sudo apt-get update
Expand All @@ -204,8 +205,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 941f986

Please sign in to comment.