From e9b11bec0a4778cc60895b70042e89c808b55efe Mon Sep 17 00:00:00 2001 From: agnik Date: Wed, 2 Oct 2024 19:07:27 +0530 Subject: [PATCH] rewrite becasue wrong bazel link --- .github/workflows/release-fedora.yml | 9 +++--- build.sh | 43 ++++++++++------------------ 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release-fedora.yml b/.github/workflows/release-fedora.yml index d2f0041..d1a6602 100644 --- a/.github/workflows/release-fedora.yml +++ b/.github/workflows/release-fedora.yml @@ -7,7 +7,7 @@ on: jobs: build: - runs-on: ubuntu-latest # Using Ubuntu, but we'll simulate Fedora with Docker + runs-on: ubuntu-latest # Using Ubuntu as the host runner, simulating Fedora with Docker steps: - name: Checkout stone-prover repository @@ -20,11 +20,10 @@ jobs: - name: Install dependencies inside Fedora container run: | - docker exec -i fedora-build bash -c "dnf update -y && dnf install -y rpm-build gcc make python3-pip" + docker exec -i fedora-build bash -c "dnf update -y && dnf install -y rpm-build gcc make python3-pip wget git" - name: Install Bazelisk in Fedora container run: | - docker exec -i fedora-build bash -c "dnf install -y wget git" docker exec -i fedora-build bash -c "wget https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-amd64" docker exec -i fedora-build bash -c "chmod +x bazelisk-linux-amd64 && mv bazelisk-linux-amd64 /usr/local/bin/bazelisk" @@ -37,12 +36,12 @@ jobs: docker exec -i fedora-build bash -c "chmod +x /build.sh && /build.sh" # Run build.sh inside container - name: Copy stone-prover.spec into Fedora container - run: docker cp ./stone-prover.spec fedora-build:/stone-prover.spec # Copy the .spec file to the Fedora container + run: docker cp ./stone-prover.spec fedora-build:/stone-prover.spec # Copy .spec file into the container - name: Package RPM inside Fedora container run: | docker exec -i fedora-build bash -c "mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}" - docker exec -i fedora-build bash -c "mv /stone-prover.spec ~/rpmbuild/SPECS/stone-prover.spec" + docker exec -i fedora-build bash -c "cp /stone-prover.spec ~/rpmbuild/SPECS/stone-prover.spec" docker exec -i fedora-build bash -c "rpmbuild -ba ~/rpmbuild/SPECS/stone-prover.spec --define '_topdir $HOME/rpmbuild'" - name: Verify RPM creation diff --git a/build.sh b/build.sh index d2499c1..12df64f 100644 --- a/build.sh +++ b/build.sh @@ -7,41 +7,28 @@ set -e os=$(uname | tr '[:upper:]' '[:lower:]') arch=$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) -# Install dependencies based on the OS -if [ "$os" == "linux" ]; then - export DEBIAN_FRONTEND=noninteractive - - # Check for Fedora or Debian-based Linux - if [ -f /etc/fedora-release ]; then - echo "Detected Fedora" - sudo dnf clean all - sudo dnf update -y - sudo dnf install -y clang gcc-c++ libstdc++-devel libcxx libcxx-devel ncurses-compat-libs elfutils-devel gmp-devel python3-devel wget git - - else - echo "Detected Debian-based Linux" - sudo apt-get update -y - sudo apt-get install -y clang gcc g++ libtinfo5 libdw-dev libgmp3-dev python3-dev wget git - fi +# Fedora-specific installation +if [ "$os" == "linux" ] && [ -f /etc/fedora-release ]; then + echo "Detected Fedora" + + # Clean and update Fedora packages + sudo dnf clean all + sudo dnf update -y + + # Install dependencies + sudo dnf install -y clang gcc-c++ libstdc++-devel libcxx libcxx-devel \ + ncurses-compat-libs elfutils-devel gmp-devel python3-devel wget git # Install Python dependencies pip install cpplint pytest numpy sympy==1.12.1 cairo-lang==0.12.0 # Install Bazelisk (Bazel wrapper) - wget "https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-$os-$arch" - chmod 755 "bazelisk-$os-$arch" - sudo mv "bazelisk-$os-$arch" /bin/bazelisk - -elif [ "$os" == "darwin" ]; then - # macOS dependencies - echo "Detected macOS" - brew install gmp - - # Install Python dependencies - python3 -m pip install cpplint pytest numpy sympy==1.12.1 cairo-lang==0.12.0 --break-system-packages + wget "https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-amd64" + chmod 755 "bazelisk-linux-amd64" + sudo mv "bazelisk-linux-amd64" /bin/bazelisk else - echo "$os/$arch is not supported" + echo "$os is either not Fedora or not supported." exit 1 fi