Skip to content

Commit

Permalink
ci: build for macis arm64 and x64
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Sep 2, 2024
1 parent 4c21447 commit f8b5a80
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_158a.zip --output steamworks_sdk.zip -L
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
- name: Build protobuf
Expand All @@ -43,10 +43,7 @@ jobs:

build-macos-arm64:
name: Build macOS ARM64
runs-on: macos-latest-xlarge
# TODO enable it when RM64 runners are free for public repos and adjsut the rest of the workflow
# https://github.com/actions/runner-images/issues/8439#issuecomment-1755601587
if: false
runs-on: macos-latest

steps:
- name: Checkout repository
Expand All @@ -57,7 +54,7 @@ jobs:
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_158a.zip --output steamworks_sdk.zip -L
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
brew install automake autoconf libtool
Expand Down Expand Up @@ -91,27 +88,34 @@ jobs:

- name: Install deps
run: |
/usr/bin/arch -x86_64 /bin/zsh --login <<'EOF'
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_158a.zip --output steamworks_sdk.zip -L
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
brew install automake
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install automake autoconf libtool
EOF
- name: Build protobuf
run: |
/usr/bin/arch -x86_64 /bin/zsh --login <<'EOF'
cd protobuf
./autogen.sh
./configure CXXFLAGS="-DNDEBUG"
make -j$(sysctl -n hw.physicalcpu)
sudo make install
cd ..
EOF
- name: Build boiler-writter
run: |
/usr/bin/arch -x86_64 /bin/zsh --login <<'EOF'
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
mkdir tmp && cp -r bin tmp && rm -rf bin && mv tmp bin
EOF
- uses: actions/upload-artifact@v4
with:
Expand All @@ -131,7 +135,7 @@ jobs:
curl https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.zip -L --output protobuf.zip
unzip -q protobuf.zip
mv protobuf-3.20.3 protobuf
curl https://partner.steamgames.com/downloads/steamworks_sdk_158a.zip --output steamworks_sdk.zip -L
curl https://partner.steamgames.com/downloads/steamworks_sdk_160.zip --output steamworks_sdk.zip -L
unzip -q steamworks_sdk.zip -d steamworks_sdk
sudo apt-get install build-essential autoconf gcc gcc-multilib g++-multilib libtool -y
Expand Down Expand Up @@ -160,8 +164,7 @@ jobs:
name: Publish release
runs-on: ubuntu-latest
needs:
[build-windows-x64, build-macos-x64, build-linux-x64]
# [build-windows-x64, build-macos-arm64, build-macos-x64, build-linux-x64]
[build-windows-x64, build-macos-arm64, build-macos-x64, build-linux-x64]

steps:
- name: Checkout repository
Expand All @@ -171,6 +174,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Download artifacts
uses: actions/download-artifact@v4
Expand All @@ -187,22 +191,22 @@ jobs:
cd windows-x64 && zip -r ../"boiler-writter-win-$VERSION.zip" bin && cd -
chmod +x macos-x64/bin/boiler-writter
cd macos-x64 && zip -r ../"boiler-writter-mac-$VERSION.zip" bin && cd -
chmod +x macos-arm64/bin/boiler-writter
cd macos-arm64 && zip -r ../"boiler-writter-mac-arm64-$VERSION.zip" bin && cd -
chmod +x linux-x64/bin/boiler-writter
cd linux-x64 && zip -r ../"boiler-writter-linux-$VERSION.zip" bin && cd -
# chmod +x macos-arm64/bin/boiler-writter
# cd macos-arm64 && zip -r ../"boiler-writter-mac-arm64-$VERSION.zip" bin && cd -
- name: Publish NPM
run: |
mkdir -p dist/bin/{darwin-arm64,darwin-x64,linux-x64,win32-x64}
cp windows-x64/bin/* dist/bin/win32-x64
cp macos-x64/bin/* dist/bin/darwin-x64
cp macos-arm64/bin/* dist/bin/darwin-arm64
cp linux-x64/bin/* dist/bin/linux-x64
zip -r "dist-npm.zip" dist
# cp macos-arm64/bin/* dist/bin/darwin-arm64
# npm publish --dry-run
npm publish --access public --registry https://registry.npmjs.org
env:
NPM_GITHUB_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}

- name: GitHub Release
Expand All @@ -214,5 +218,5 @@ jobs:
replacesArtifacts: true
artifacts: "boiler-writter-*.zip,dist-npm.zip"

# - name: Push the tag to GitHub
# run: git push origin main --tags
- name: Push the tag to GitHub
run: git push origin main --tags

0 comments on commit f8b5a80

Please sign in to comment.