Run builds in parallel, build linux-x86_64 for alpine (#16) #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: librandomy pipeline | |
on: push | |
jobs: | |
build-mac: | |
strategy: | |
matrix: | |
config: | |
- {os: macos-13, path: darwin-x86_64, arch: x86_64} | |
- {os: macos-latest, path: darwin-arm64, arch: arm64} | |
runs-on: ${{ matrix.config.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build & Test | |
run: | | |
uname -m | |
mkdir build && cd build && cmake -DCMAKE_OSX_ARCHITECTURES=${{ matrix.config.arch }} .. && make -j$(sysctl -n hw.ncpu) && ./randomx-tests | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.config.path }} | |
path: build/librandomx.a | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Win | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: mingw64 | |
update: true | |
install: > | |
mingw-w64-x86_64-make | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-gcc | |
- name: Build & Test | |
shell: msys2 {0} | |
run: | | |
mkdir build && cd build && cmake .. -G "MinGW Makefiles" && mingw32-make -j$(echo $NUMBER_OF_PROCESSORS) && ./randomx-tests | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-x86_64 | |
path: build/librandomx.a | |
build-alpine: | |
strategy: | |
matrix: | |
config: | |
- {arch: x86_64, branch: latest-stable} | |
- {arch: aarch64, branch: latest-stable} | |
- {arch: riscv64, branch: edge} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Alpine Linux | |
uses: jirutka/setup-alpine@v1 | |
with: | |
arch: ${{ matrix.config.arch }} | |
branch: ${{ matrix.config.branch }} | |
- name: Install deps | |
shell: alpine.sh --root {0} | |
run: apk add git cmake gcc g++ make | |
- name: Build | |
run: mkdir build && cd build && cmake .. && make -j$(nproc) && ./randomx-tests | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-${{ matrix.config.arch }} | |
path: build/librandomx.a | |
release: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
needs: [build-mac, build-windows, build-alpine] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Linux x86_64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-x86_64 | |
path: linux-x86_64 | |
- name: Linux aarch64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-aarch64 | |
path: linux-aarch64 | |
- name: Linux riscv64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux-riscv64 | |
path: linux-riscv64 | |
- name: Darwin x86_64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: darwin-x86_64 | |
path: darwin-x86_64 | |
- name: Darwin arm64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: darwin-arm64 | |
path: darwin-arm64 | |
- name: Win x86_64 | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows-x86_64 | |
path: windows-x86_64 | |
- name: Create zip | |
run: | | |
zip -r librandomy linux-x86_64 linux-aarch64 linux-riscv64 darwin-arm64 darwin-x86_64 windows-x86_64 | |
- name: Bump version | |
id: version_bump | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: "patch" | |
RELEASE_BRANCHES: "master" | |
WITH_V: true | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.version_bump.outputs.tag }} | |
release_name: librandomy ${{ steps.version_bump.outputs.tag }} | |
draft: false | |
prerelease: false | |
- name: Upload release assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: librandomy.zip | |
asset_name: librandomy.zip | |
asset_content_type: application/zip |