Skip to content

Update GitHub Actions to use Node 20 #452

Update GitHub Actions to use Node 20

Update GitHub Actions to use Node 20 #452

Workflow file for this run

name: Release
on:
pull_request:
branches:
- '*' # must quote since "*" is a YAML reserved character; we want a string
paths-ignore:
- '.github/workflows/quarto-render.yml'
- '_quarto.yml'
- 'quarto-materials/*'
- '**/.md'
- 'tiledb/doxygen/source/*'
- 'tiledb/sm/c_api/tiledb_version.h'
push:
branches:
- dev
- 'release-*'
tags:
- '*'
jobs:
Build-Release:
strategy:
fail-fast: false
matrix:
platform: [macos-arm64, macos-x86_64, linux-x86_64, linux-x86_64-noavx2, windows-x86_64]
include:
- platform: windows-x86_64
os: windows-2019
triplet: x64-windows-release
- platform: linux-x86_64
os: ubuntu-20.04
manylinux: true
triplet: x64-linux-release
- platform: linux-x86_64-noavx2
os: ubuntu-20.04
cmake_args: -DCOMPILER_SUPPORTS_AVX2=OFF
triplet: x64-linux-release
manylinux: true
- platform: macos-x86_64
os: macos-12
MACOSX_DEPLOYMENT_TARGET: 11
triplet: x64-osx-release
- platform: macos-arm64
os: macos-12
cmake_args: -DCMAKE_OSX_ARCHITECTURES=arm64
MACOSX_DEPLOYMENT_TARGET: 11
triplet: arm64-osx-release
runs-on: ${{ matrix.os }}
container: ${{ matrix.manylinux && 'quay.io/pypa/manylinux2014_x86_64:2023-11-13-f6b0c51' || '' }}
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MACOSX_DEPLOYMENT_TARGET }}
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
# v4 uses node 20 which is incompatible with the libc version of the manylinux image
- name: Checkout TileDB (Node 16)
uses: actions/checkout@v3
if: matrix.manylinux
- name: Checkout TileDB
uses: actions/checkout@v4
if: ${{ !matrix.manylinux }}
- name: 'Homebrew setup'
run: brew install automake pkg-config
if: ${{ startsWith(matrix.os, 'macos-') == true }}
# v7 uses node 20 which is incompatible with the libc version of the manylinux image
- name: Export GitHub Actions cache variables (Node 16)
uses: actions/github-script@v6
if: matrix.manylinux
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Export GitHub Actions cache variables
uses: actions/github-script@v7
if: ${{ !matrix.manylinux }}
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Set variables
id: get-values
run: |
release_hash=$( echo ${{ github.sha }} | cut -c-7 - )
ref=${{ github.head_ref || github.ref_name }}
echo "release_hash=$release_hash" >> $GITHUB_OUTPUT
echo "archive_name=tiledb-${{ matrix.platform }}-${ref##*/}-$release_hash" >> $GITHUB_OUTPUT
shell: bash
- name: Install manylinux prerequisites
if: matrix.manylinux
run: |
set -e pipefail
yum install -y redhat-lsb-core centos-release-scl devtoolset-7
echo "source /opt/rh/devtoolset-7/enable" >> ~/.bashrc
- name: Configure TileDB
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=./dist \
-DTILEDB_INSTALL_LIBDIR=lib \
-DTILEDB_S3=ON \
-DTILEDB_AZURE=ON \
-DTILEDB_GCS=ON \
-DTILEDB_HDFS=${{ startsWith(matrix.platform, 'windows') && 'OFF' || 'ON' }} \
-DTILEDB_SERIALIZATION=ON \
-DTILEDB_WEBP=ON \
-DTILEDB_TESTS=OFF \
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
${{ matrix.cmake_args }}
shell: bash
- name: Build TileDB
run: cmake --build build --config Release
- name: Install TileDB
run: cmake --build build --config Release --target install-tiledb
- name: Archive installed artifacts (non-Windows)
if: ${{ !startsWith(matrix.platform, 'windows') }}
run: |
tar -czf ${{ steps.get-values.outputs.archive_name }}.tar.gz -C dist .
- name: Archive installed artifacts (Windows)
if: startsWith(matrix.platform, 'windows')
run: |
Compress-Archive -Path dist\* -DestinationPath ${{ steps.get-values.outputs.archive_name }}.zip
shell: pwsh
# v4 uses node 20 which is incompatible with the libc version of the manylinux image
- name: Upload release artifacts (Node 16)
uses: actions/upload-artifact@v3
if: matrix.manylinux
with:
name: tiledb-dist
path: ${{ steps.get-values.outputs.archive_name }}.*
- name: Upload release artifacts
uses: actions/upload-artifact@v4
if: ${{ !matrix.manylinux }}
with:
name: tiledb-dist
path: ${{ steps.get-values.outputs.archive_name }}.*
- name: Archive build directory
run: |
tar -czf build-${{ matrix.platform }}.tar.gz -C build .
# v4 uses node 20 which is incompatible with the libc version of the manylinux image
- name: Upload build directory (Node 16)
uses: actions/upload-artifact@v3
if: matrix.manylinux
with:
name: tiledb-build
path: build-${{ matrix.platform }}.tar.gz
- name: Upload build directory
uses: actions/upload-artifact@v4
if: ${{ !matrix.manylinux }}
with:
name: tiledb-build
path: build-${{ matrix.platform }}.tar.gz
- name: "Print log files (failed build only)"
run: |
source $GITHUB_WORKSPACE/scripts/ci/print_logs.sh
if: failure() # only run this job if the build step failed
Test-Release-Artifacts:
needs: Build-Release
runs-on: ubuntu-latest
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
name: tiledb-dist
path: dist
- name: Test names of release artifacts
run: |
if [ ls dist/ | grep -Ev -- '^tiledb-(linux|macos|windows)+-(x86_64|arm64)(-noavx2)?-.+-[0-9a-f]{7}\.(zip|tar\.gz)$' ]; then
echo "Some release artifact names do not match expected pattern"
exit 1
fi
Publish-Release:
needs: Test-Release-Artifacts
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
name: tiledb-dist
path: dist
- name: Publish release artifacts
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const repo = context.repo;
const release = await github.rest.repos.getReleaseByTag({
owner: repo.owner,
repo: repo.repo,
tag: "${{ github.ref_name }}"
});
const globber = await glob.create('dist/*');
for await (const file of globber.globGenerator()) {
await github.rest.repos.uploadReleaseAsset({
owner: repo.owner,
repo: repo.repo,
release_id: release.data.id,
headers: {
'content-type': 'application/octet-stream',
'content-length': fs.statSync(file).size
},
name: path.basename(file),
data: fs.readFileSync(file)
});
}