From 1012458e54a112ec204e1331139ce82af6630abc Mon Sep 17 00:00:00 2001 From: Eugene Cheah Date: Mon, 29 Jan 2024 14:13:05 -0800 Subject: [PATCH 1/2] Update build.yml - to include the M1 github runners https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners --- .github/workflows/build.yml | 69 +++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db0831f..e732db8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,7 +111,9 @@ jobs: path: | rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip - macOS-latest-cmake: + macOS-x86_64-cmake: + # If macOS-latest gets auto updated to the M1 architecture + # consider switching to macos-12 or macos-13 runs-on: macOS-latest continue-on-error: true @@ -134,7 +136,67 @@ jobs: run: | mkdir build cd build - cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" .. + cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64" .. + cmake --build . --config Release + + - name: Test + id: cmake_test + run: | + cd build + ctest --verbose + + - name: Get commit hash + id: commit + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: pr-mpt/actions-commit-hash@v2 + + - name: Fetch system info + id: system-info + run: | + echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" + echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT" + echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT" + echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" + + - name: Pack artifacts + id: pack_artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + run: | + zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.dylib + + - name: Upload artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v3 + with: + path: | + rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip + + macOS-arm64-cmake: + # Currently macos arm, is only on v14 + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners + runs-on: macos-14 + + continue-on-error: true + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Dependencies + id: depends + run: | + brew install zip + + - name: Build + id: cmake_build + # FMA disabled because it gives "Illegal instruction" in GitHub Actions runner + run: | + mkdir build + cd build + cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF -DCMAKE_OSX_ARCHITECTURES="arm64" .. cmake --build . --config Release - name: Test @@ -281,7 +343,8 @@ jobs: needs: - ubuntu-latest-cmake - - macOS-latest-cmake + - macOS-x86_64-cmake + - macOS-arm64-cmake - windows-latest-cmake steps: From 3d5218d49f3d08d579e16451e0f15d12fbe3715f Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 30 Jan 2024 14:14:27 +0500 Subject: [PATCH 2/2] Update build.yml --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e732db8..26cade2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,8 +112,7 @@ jobs: rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip macOS-x86_64-cmake: - # If macOS-latest gets auto updated to the M1 architecture - # consider switching to macos-12 or macos-13 + # If macOS-latest gets auto updated to the M1 architecture, consider switching to macos-12 or macos-13. runs-on: macOS-latest continue-on-error: true @@ -172,7 +171,7 @@ jobs: rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip macOS-arm64-cmake: - # Currently macos arm, is only on v14 + # Currently, MacOS ARM is only on v14. # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners runs-on: macos-14