From dd327d77bac77bdb93934d706caccb712cbcc194 Mon Sep 17 00:00:00 2001 From: kxtzownsu Date: Fri, 20 Dec 2024 01:03:35 -0500 Subject: [PATCH] fix workflow build process (hopefully) TEST=none --- .cargo/config.toml | 2 +- .github/workflows/build.yaml | 44 ++++++++++++++++++++++++++++++++++++ .github/workflows/kvg.yaml | 22 ------------------ .github/workflows/kvs.yaml | 22 ------------------ Makefile | 16 ++++++------- 5 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/kvg.yaml delete mode 100644 .github/workflows/kvs.yaml diff --git a/.cargo/config.toml b/.cargo/config.toml index 15c6ad8..ba98dd4 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [target.aarch64-unknown-linux-musl] -linker = "aarch64-linux-musl-gcc" +linker = "rust-lld" [target.armv7-unknown-linux-musleabihf] linker = "rust-lld" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..a36a2d2 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,44 @@ +name: build all + +on: + push: + branches: [ "2.0" ] + pull_request: + branches: [ "2.0" ] + +jobs: + build: + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + + # step 0: bootstrap rustup + - name: init rustup + run: rustup default stable + + # step 1: install deps + - name: install x86_64 rust toolchain + run: rustup target add x86_64-unknown-linux-musl + - name: install aarch64 rust toolchain + run: rustup target add aarch64-unknown-linux-musl + - name: install armv7 rust toolchain + run: rustup target add armv7-unknown-linux-musl + - name: install packages + run: sudo apt install gcc make musl-tools musl-dev gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu + + # step 2: build project + - name: build x86_64 bins + run: make all + - name: build aarch64 bins + run: ARCH=aarch64 make all + - name: build armv7 bins + run: CC=arm-linux-gnueabihf-gcc ARCH=armv7 make all + + # step 3: upload + - name: Upload build files + uses: actions/upload-artifact@v4 + with: + name: KV(S/G) binaries + path: build/ diff --git a/.github/workflows/kvg.yaml b/.github/workflows/kvg.yaml deleted file mode 100644 index 4d51c2d..0000000 --- a/.github/workflows/kvg.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: build kvg - -on: - push: - branches: [ "2.0" ] - pull_request: - branches: [ "2.0" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: build - run: make kvg - - name: upload - uses: actions/upload-artifact@v4 - with: - name: kvg-binary - path: build/bin/kvg diff --git a/.github/workflows/kvs.yaml b/.github/workflows/kvs.yaml deleted file mode 100644 index b1bdd1d..0000000 --- a/.github/workflows/kvs.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: build kvs - -on: - push: - branches: [ "2.0" ] - pull_request: - branches: [ "2.0" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: build - run: make kvs - - name: upload - uses: actions/upload-artifact@v4 - with: - name: kvs-binary - path: build/bin/kvs diff --git a/Makefile b/Makefile index 72d9783..82618ee 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ CC := aarch64-linux-gnu-gcc endif ifeq ($(ARCH), armv7) -CC := armv7-linux-gnu-gcc +CC ?= armv7-linux-gnu-gcc TOOLCHAIN := musleabihf endif @@ -28,20 +28,20 @@ TARGET = ${ARCH}-unknown-linux-${TOOLCHAIN} all: clean build kvs kvg -kvs: build build/bin/kvs -kvg: build build/bin/kvg +kvs: build build/bin/kvs-$(ARCH) +kvg: build build/bin/kvg-$(ARCH) kvg-c: build build/bin/kvg-c build: $(shell mkdir -p build/bin) -build/bin/kvs: src/KVS/main.c - $(CC) $(KVSFLIST) -o build/bin/kvs $(CFLAGS) - chmod +rx build/bin/kvs +build/bin/kvs-$(ARCH): src/KVS/main.c + $(CC) $(KVSFLIST) -o build/bin/kvs-$(ARCH) $(CFLAGS) + chmod +rx build/bin/kvs-$(ARCH) -build/bin/kvg: src/KVG/main.rs +build/bin/kvg-$(ARCH): src/KVG/main.rs cargo build --bin KVG --target=$(TARGET) --release - cp target/$(TARGET)/release/KVG build/bin/kvg + cp target/$(TARGET)/release/KVG build/bin/kvg-$(ARCH) # The C version of KVS, not normally built. # Also guaranteed to be out-of-date.