Skip to content

Merge pull request #28 from soppelmann/makefileghworkflow #50

Merge pull request #28 from soppelmann/makefileghworkflow

Merge pull request #28 from soppelmann/makefileghworkflow #50

Workflow file for this run

name: Build
on:
push:
pull_request:
jobs:
build-linux-x86_64:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
OS_NAME: Linux
ARCH_NAME: x86_64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-linux-x86_64
RESULT_PATH: result-linux-x86_64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update
sudo apt-get install libtool automake
- name: Build
run: |
gcc -v
# Generate build system
libtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
- name: Verify static library
run: |
file .libs/$LIB_NAME
ls -lh .libs/$LIB_NAME
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
build-linux-aarch64:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
OS_NAME: Linux
ARCH_NAME: aarch64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-linux-aarch64
RESULT_PATH: result-linux-aarch64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Build on aarch64 (arm64)
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update -q -y
apt-get install -q -y build-essential automake libtool file
run: |
pwd
uname -a
gcc --version
# Generate build system
libtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
# Verify static library
file .libs/libasyncprocess.a
ls -lh .libs/libasyncprocess.a
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
build-osx-aarch64:
runs-on: macos-14 # macOS 14 runs on Apple Silicon (aarch64/arm64)
timeout-minutes: 90
env:
OS_NAME: Darwin
ARCH_NAME: aarch64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-osx-aarch64
RESULT_PATH: result-osx-aarch64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Install tools
run: |
brew install automake
brew install libtool
- name: Build
run: |
gcc -v
# Generate build system
glibtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
- name: Verify static library
run: |
file .libs/$LIB_NAME
ls -lh .libs/$LIB_NAME
lipo -info .libs/$LIB_NAME
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
build-osx-x86_64:
runs-on: macos-13 # macOS 13 runs on Intel (x86_64)
timeout-minutes: 90
env:
OS_NAME: Darwin
ARCH_NAME: x86_64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-osx-x86_64
RESULT_PATH: result-osx-x86_64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Install tools
run: |
brew install automake
brew install libtool
- name: Build
run: |
gcc -v
# Generate build system
glibtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
- name: Verify static library
run: |
file .libs/$LIB_NAME
ls -lh .libs/$LIB_NAME
lipo -info .libs/$LIB_NAME
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
release:
runs-on: ubuntu-latest
needs: [build-linux-x86_64, build-linux-aarch64, build-osx-aarch64, build-osx-x86_64]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release-files
echo "Finding all .a files in artifacts..."
find artifacts -name "*.a" -type f
echo ""
echo "Creating uniquely named release files..."
# Find and rename all library files with their arch and os
find artifacts -name "*.a" -type f | while read file; do
# Extract the directory structure to get arch and os
dir=$(dirname "$file")
arch=$(basename "$(dirname "$dir")")
os=$(basename "$dir")
# Normalize OS name to lowercase for consistency
os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
# Create a unique filename: libasyncprocess.{os}.{arch}.a
output_name="libasyncprocess.${os_lower}.${arch}.a"
echo " $file -> release-files/$output_name"
cp "$file" "release-files/$output_name"
done
echo ""
echo "Release files ready for upload:"
ls -lh release-files/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release-files/*