Package #308
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: Package | |
on: | |
push: | |
paths: | |
- '**/*.cmake' | |
- '**/*.cmake.in' | |
- '**/CMakeLists.txt' | |
- '**/Makefile.am' | |
- '.github/workflows/package.yml' | |
- 'configure.ac' | |
- 'cmake/**' | |
- 'doc/**' | |
- 'include/**/*.h' | |
- 'include/**/*.h.in' | |
- 'include/**/*.hpp' | |
- 'lib/**/*.c' | |
- 'lib/**/*.cpp' | |
- 'lib/**/*.h' | |
- 'lib/**/*.hpp' | |
- 'lib/**/*.rb' | |
- 'packages/**' | |
- 'plugins/**/*.c' | |
- 'plugins/**/*.cpp' | |
- 'plugins/**/*.h' | |
- 'plugins/**/*.rb' | |
- 'src/**/*.c' | |
- 'src/**/*.h' | |
- 'test/command/**' | |
- 'vendor/mruby/**' | |
pull_request: | |
paths: | |
- '**/*.cmake' | |
- '**/*.cmake.in' | |
- '**/CMakeLists.txt' | |
- '**/Makefile.am' | |
- '.github/workflows/package.yml' | |
- 'configure.ac' | |
- 'cmake/**' | |
- 'doc/**' | |
- 'include/**/*.h' | |
- 'include/**/*.h.in' | |
- 'include/**/*.hpp' | |
- 'lib/**/*.c' | |
- 'lib/**/*.cpp' | |
- 'lib/**/*.h' | |
- 'lib/**/*.rb' | |
- 'lib/**/*.rb' | |
- 'packages/**' | |
- 'plugins/**/*.c' | |
- 'plugins/**/*.cpp' | |
- 'plugins/**/*.h' | |
- 'plugins/**/*.rb' | |
- 'src/**/*.c' | |
- 'src/**/*.h' | |
- 'test/command/**' | |
- 'vendor/mruby/**' | |
schedule: | |
- cron: | | |
0 0 * * * | |
concurrency: | |
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
source: | |
if: >- | |
github.event_name != 'schedule' || | |
(github.event_name == 'schedule' && | |
github.repository_owner == 'groonga') | |
name: Source | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
sudo apt update -o="APT::Acquire::Retries=3" | |
sudo apt install -y -V -o="APT::Acquire::Retries=3" \ | |
autoconf-archive \ | |
devscripts \ | |
ruby \ | |
zip | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3 | |
- name: Install Sphinx | |
run: | | |
pip3 install -r doc/requirements.txt | |
- name: Clone dependencies | |
run: | | |
cd .. | |
git clone --depth 1 https://github.com/groonga/groonga.org.git | |
git clone --depth 1 https://github.com/clear-code/cutter.git | |
- name: Generate configure | |
run: | | |
./autogen.sh | |
- name: Configure for archive | |
run: | | |
./configure \ | |
--enable-document \ | |
--enable-mruby \ | |
--with-cutter-source-path=../cutter \ | |
--with-groonga-org-path=../groonga.org \ | |
--with-ruby | |
- name: Build archive | |
run: | | |
make dist | |
- name: Create zip | |
run: | | |
version=$(cat base_version) | |
tar xzf groonga-${version}.tar.gz | |
pushd groonga-${version}/vendor | |
ruby download_lz4.rb | |
ruby download_mecab.rb | |
ruby download.rb | |
popd | |
zip -r groonga-${version}.zip groonga-${version} | |
rm -rf groonga-${version} | |
# Artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: source | |
path: | | |
groonga-*.tar.gz | |
groonga-*.zip | |
# Release | |
- name: Upload to release | |
if: | | |
startsWith(github.ref, 'refs/tags/') | |
run: | | |
(cd doc/source/news && \ | |
ruby \ | |
-e 'print("## Groonga "); \ | |
puts(ARGF.read.split(/^## Release /)[1]. \ | |
gsub(/^\(.+\)=$/, ""). \ | |
gsub(/{doc}`(.+?)`/) { \ | |
id = $1; \ | |
title = id.split("\/").last; \ | |
path = id.delete_prefix("/"); \ | |
url = "https://groonga.org/docs/#{path}.html"; \ | |
"[#{title}](#{url})"; \ | |
}. \ | |
gsub(/{ref}`(.+?)`/) {$1}. | |
strip)' \ | |
$(ls *.md | sort --human-numeric-sort | tail -n1)) > \ | |
release-note.md | |
echo "" >> release-note.md | |
echo "### Translations" >> release-note.md | |
echo "" >> release-note.md | |
version=${GITHUB_REF_NAME#v} | |
major_version=${version%%.*} | |
version_hyphen=$(echo ${version} | tr . -) | |
echo " * [Japanese](https://groonga.org/ja/docs/news/${major_version}.html#release-${version_hyphen})" >> release-note.md | |
title="$(head -n1 release-note.md | sed -e 's/^## //')" | |
tail -n +2 release-note.md > release-note-without-version.md | |
gh release create ${GITHUB_REF_NAME} \ | |
--discussion-category Releases \ | |
--notes-file release-note-without-version.md \ | |
--title "${title}" \ | |
groonga-*.tar.gz \ | |
groonga-*.zip | |
env: | |
GH_TOKEN: ${{ github.token }} | |
build: | |
name: Build | |
needs: source | |
strategy: | |
fail-fast: false | |
matrix: | |
id: | |
- debian-bookworm-amd64 | |
- debian-bookworm-arm64 | |
# simdjson removed from testing: | |
# https://github.com/groonga/groonga/pull/1871 | |
# | |
# We can enable this again when simdjson is added to testing again. | |
# - debian-trixie-amd64 | |
# - debian-trixie-arm64 | |
- ubuntu-focal-amd64 | |
- ubuntu-focal-arm64 | |
- ubuntu-jammy-amd64 | |
- ubuntu-jammy-arm64 | |
- ubuntu-noble-amd64 | |
- ubuntu-noble-arm64 | |
- almalinux-8-x86_64 | |
- almalinux-8-aarch64 | |
- almalinux-9-x86_64 | |
- almalinux-9-aarch64 | |
- amazon-linux-2023-x86_64 | |
# This is too slow. | |
# | |
# We can enable this again when GitHub Actions arm runner is | |
# available. | |
# - amazon-linux-2023-aarch64 | |
include: | |
- id: debian-bookworm-arm64 | |
timeout-minutes: 60 | |
# - id: debian-trixie-arm64 | |
# timeout-minutes: 120 | |
- id: ubuntu-focal-arm64 | |
timeout-minutes: 60 | |
- id: ubuntu-jammy-arm64 | |
timeout-minutes: 60 | |
- id: ubuntu-noble-arm64 | |
timeout-minutes: 120 | |
- id: almalinux-8-aarch64 | |
timeout-minutes: 60 | |
- id: almalinux-9-aarch64 | |
timeout-minutes: 120 | |
# - id: amazon-linux-2023-aarch64 | |
# timeout-minutes: 120 | |
env: | |
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow | |
runs-on: ubuntu-latest | |
timeout-minutes: ${{ matrix.timeout-minutes || 30 }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/checkout@v4 | |
with: | |
path: apache-arrow | |
repository: apache/arrow | |
- name: Prepare environment variables | |
run: | | |
id=${{ matrix.id }} | |
os_version=${id%-*} | |
os=${os_version%-*} | |
version=${os_version##*-} | |
architecture=${id##*-} | |
if [ "${os}" = "debian" ] || [ "${os}" = "ubuntu" ]; then | |
TASK_NAMESPACE=apt | |
if [ "${architecture}" = "amd64" ]; then | |
TARGET="${os_version}" | |
TEST_DOCKER_IMAGE="${os}:${version}" | |
else | |
TARGET="${id}" | |
TEST_DOCKER_IMAGE="arm64v8/${os}:${version}" | |
fi | |
else | |
TASK_NAMESPACE=yum | |
# amazon-linux -> amazonlinux | |
docker_os=${os/-/} | |
if [ "${architecture}" = "x86_64" ]; then | |
TARGET="${os_version}" | |
TEST_DOCKER_IMAGE="${docker_os}:${version}" | |
else | |
TARGET="${id}" | |
TEST_DOCKER_IMAGE="arm64v8/${docker_os}:${version}" | |
fi | |
fi | |
echo "TASK_NAMESPACE=${TASK_NAMESPACE}" >> ${GITHUB_ENV} | |
echo "TARGET=${TARGET}" >> ${GITHUB_ENV} | |
echo "APT_TARGETS=${TARGET}" >> ${GITHUB_ENV} | |
echo "YUM_TARGETS=${TARGET}" >> ${GITHUB_ENV} | |
echo "TEST_DOCKER_IMAGE=${TEST_DOCKER_IMAGE}" >> ${GITHUB_ENV} | |
- name: Install dependencies | |
run: | | |
sudo apt update -o="APT::Acquire::Retries=3" | |
sudo apt install -y -V -o="APT::Acquire::Retries=3" \ | |
devscripts \ | |
qemu-user-static \ | |
ruby | |
- uses: actions/download-artifact@v4 | |
with: | |
name: source | |
- name: Update version | |
if: | | |
!startsWith(github.ref, 'refs/tags/') && | |
!startsWith(github.ref, 'refs/heads/maintenance/') | |
run: | | |
cd packages | |
rake version:update RELEASE_DATE=$(date +%Y-%m-%d) | |
- name: Login to GitHub Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: packages/${{ env.TASK_NAMESPACE }}/build/${{ env.TARGET }}/ccache | |
key: package-${{ matrix.id }}-ccache-${{ hashFiles('lib/**', 'src/**', 'plugins/**', 'include/**') }} | |
restore-keys: package-${{ matrix.id }}-ccache- | |
- name: Build with docker | |
run: | | |
cd packages | |
rake docker:pull || : | |
rake ${TASK_NAMESPACE}:build BUILD_DIR=build | |
- name: Push the built Docker image | |
continue-on-error: true | |
run: | | |
cd packages | |
rake docker:push | |
# Artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-${{ matrix.id }} | |
path: packages/${{ env.TASK_NAMESPACE }}/repositories/ | |
# Release | |
- name: Create assets | |
if: | | |
startsWith(github.ref, 'refs/tags/') | |
run: | | |
tar czf ${{ matrix.id }}.tar.gz packages/${TASK_NAMESPACE}/repositories/ | |
- name: Upload to release | |
if: | | |
startsWith(github.ref, 'refs/tags/') | |
run: | | |
gh release upload ${GITHUB_REF_NAME} \ | |
${{ matrix.id }}.tar.gz | |
env: | |
GH_TOKEN: ${{ github.token }} | |
# Test | |
- name: Test | |
run: | | |
case "${TEST_DOCKER_IMAGE}" in | |
arm64v8/*) | |
platform=linux/arm64 | |
;; | |
*) | |
platform=linux/amd64 | |
;; | |
esac | |
docker run \ | |
--platform ${platform} \ | |
--rm \ | |
--volume ${PWD}:/groonga:ro \ | |
${TEST_DOCKER_IMAGE} \ | |
/groonga/packages/${TASK_NAMESPACE}/test.sh |