Skip to content

Commit d58842d

Browse files
committed
Add workflow to build and add a pre-built Zinc library for linux.
1 parent 489ee1c commit d58842d

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/osmesa-zinc.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
name: Build and Release Zinc C++ Library using OSMESA
3+
4+
on:
5+
# Allows you to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
inputs:
8+
release_tag:
9+
description: 'The git tag of the release to upload the build to (e.g., osmesa).'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
build-and-release-zinc-linux:
15+
name: Build Zinc using OSMESA for Linux and Upload to Release
16+
runs-on: ubuntu-24.04
17+
18+
steps:
19+
- name: 1. Checkout Zinc repository
20+
uses: actions/checkout@v4
21+
22+
- name: 2. Install build tools
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y build-essential cmake ninja-build
26+
27+
- name: 3. Download and Extract CMLibs Dependencies
28+
run: |
29+
# The name "Linux" is derived from the ubuntu runner as requested.
30+
DEPS_OS_NAME="linux"
31+
DEPS_URL="https://github.com/cmlibs-dependencies/prebuilt-library-cache/releases/download/cache/superbuild-osmesa-libs-${DEPS_OS_NAME}.tar.gz"
32+
33+
echo "Downloading dependencies from ${DEPS_URL}"
34+
curl -L -o dependencies.tar.gz "${DEPS_URL}"
35+
36+
echo "Extracting dependencies..."
37+
# We assume the tarball's root contains the 'install' directory needed by the build.
38+
tar -xzf dependencies.tar.gz
39+
40+
# Verify that the required 'install' directory exists after extraction.
41+
if [ ! -d "install" ]; then
42+
echo "Error: 'install' directory not found after extracting dependencies."
43+
exit 1
44+
fi
45+
echo "Dependencies successfully extracted to '${{ github.workspace }}/install'"
46+
47+
- name: 4. Configure Zinc build with CMake
48+
run: |
49+
# We use Ninja for faster, parallel builds.
50+
cmake -S zinc/ \
51+
-B build-zinc-release \
52+
-G "Ninja" \
53+
-DCMAKE_BUILD_TYPE=Release \
54+
-DZINC_USE_OSMESA=TRUE \
55+
-DCMLIBSDEPENDENCIES_DIR=${{ github.workspace }}/install
56+
57+
- name: 5. Build Zinc library
58+
run: |
59+
# Run the build using the number of available processor cores for speed.
60+
cmake --build build-zinc-release --config Release --parallel
61+
62+
- name: 6. Install Zinc library
63+
run: |
64+
# Create a clean directory for the installed library files.
65+
INSTALL_DIR=${{ github.workspace }}/zinc-install-osmesa
66+
67+
# Install the built artifacts into the specified prefix directory.
68+
cmake --install build-zinc-release --prefix ${INSTALL_DIR}
69+
70+
- name: 7. Package installed library
71+
id: package
72+
run: |
73+
INSTALL_DIR=${{ github.workspace }}/zinc-install-osmesa
74+
ARTIFACT_NAME="zinc-osmesa-linux.tar.gz"
75+
76+
# Create a tarball of the installed files.
77+
# The -C flag changes directory before archiving, ensuring clean paths in the tarball.
78+
tar -czf ${ARTIFACT_NAME} -C ${INSTALL_DIR} .
79+
80+
# Make the artifact name available to subsequent steps.
81+
echo "ARTIFACT_PATH=${{ github.workspace }}/${ARTIFACT_NAME}" >> $GITHUB_ENV
82+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
83+
84+
- name: 8. Add Archive to Cache
85+
uses: softprops/action-gh-release@v2
86+
with:
87+
files: ${{ env.ARTIFACT_PATH }}
88+
tag_name: osmesa
89+

0 commit comments

Comments
 (0)