packages ubuntu: support for Ubuntu 24.04 arm64 (#24) #536
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
# Copyright (C) 2023 Sutou Kouhei <[email protected]> | |
# | |
# This library is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU Lesser General Public | |
# License as published by the Free Software Foundation; either | |
# version 2.1 of the License, or (at your option) any later version. | |
# | |
# This library is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
# Lesser General Public License for more details. | |
# | |
# You should have received a copy of the GNU Lesser General Public | |
# License along with this library; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
name: Package | |
on: | |
push: | |
pull_request: | |
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: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build archive | |
run: | | |
rake dist | |
# Artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: release-source | |
path: | | |
groonga-nginx-*.tar.gz | |
build: | |
name: Build | |
needs: source | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- id: debian-bookworm-amd64 | |
task-namespace: apt | |
test-image: "images:debian/12" | |
- id: debian-bookworm-arm64 | |
task-namespace: apt | |
test-image: "images:debian/12/arm64" | |
- id: ubuntu-noble-amd64 | |
task-namespace: apt | |
test-image: "images:ubuntu/24.04" | |
- id: ubuntu-noble-arm64 | |
task-namespace: apt | |
test-image: "images:ubuntu/24.04/arm64" | |
runs-on: >- | |
${{ contains(matrix.id, 'arm64') && 'ubuntu-24.04-arm' || | |
'ubuntu-latest' }} | |
timeout-minutes: 20 | |
env: | |
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow | |
GROONGA_REPOSITORY: ${{ github.workspace }}/groonga | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
path: apache-arrow | |
repository: apache/arrow | |
- uses: actions/checkout@v4 | |
with: | |
repository: groonga/groonga | |
path: groonga | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y -V \ | |
devscripts \ | |
qemu-user-static \ | |
ruby | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release-source | |
- name: Update version | |
if: | | |
!startsWith(github.ref, 'refs/tags/') | |
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/${{ matrix.task-namespace }}/build/${{ matrix.id }}/ccache | |
key: package-${{ matrix.id }}-ccache-${{ hashFiles('*.c') }} | |
restore-keys: package-${{ matrix.id }}-ccache- | |
- name: Prepare target | |
run: | | |
target=$(echo ${{ matrix.id }} | sed -e 's/-amd64$//g') | |
echo "APT_TARGETS=${target}" >> $GITHUB_ENV | |
echo "YUM_TARGETS=${target}" >> $GITHUB_ENV | |
- name: Build with docker | |
run: | | |
cd packages | |
rake docker:pull || : | |
rake ${{ matrix.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/${{ matrix.task-namespace }}/repositories/ | |
# Test | |
- name: Install test dependencies | |
run: | | |
# We can use the official Ubuntu APT repository when | |
# ubuntu-latest is Ubuntu 24.04. | |
sudo curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc | |
cat <<SOURCES | sudo tee /etc/apt/sources.list.d/zabbly-incus-stable.sources | |
Enabled: yes | |
Types: deb | |
URIs: https://pkgs.zabbly.com/incus/stable | |
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME}) | |
Components: main | |
Architectures: $(dpkg --print-architecture) | |
Signed-By: /etc/apt/keyrings/zabbly.asc | |
SOURCES | |
sudo apt update | |
sudo apt install -y -V incus | |
- name: Allow egress network traffic flows for Incus | |
# https://linuxcontainers.org/incus/docs/main/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-incus-and-docker | |
run: | | |
sudo iptables -I DOCKER-USER -i incusbr0 -j ACCEPT | |
sudo iptables -I DOCKER-USER -o incusbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
- name: Test | |
run: | | |
sudo incus admin init --auto | |
sudo incus --quiet launch ${{ matrix.test-image }} target | |
sudo incus config device add target host disk source=$PWD path=/host | |
sudo incus exec target -- adduser --uid 10000 groonga-nginx | |
sudo incus exec target -- \ | |
sh -c "echo 'groonga-nginx ALL=(ALL:ALL) NOPASSWD:ALL' | \ | |
EDITOR='tee -a' visudo -f /etc/sudoers.d/groonga-nginx-nopasswd" | |
sudo incus exec target \ | |
--cwd /home/groonga-nginx \ | |
--user 10000 \ | |
--group 10000 \ | |
-- \ | |
/host/packages/${{ matrix.task-namespace }}/test.sh | |
sudo incus stop target | |
sudo incus delete target | |
prepare-release: | |
name: Prepare for release | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: packages | |
pattern: packages-* | |
- name: Group by distribution and version | |
run: | | |
set -x | |
for packages_path in packages/packages-*; do | |
# packages/packages-ubuntu-noble-amd64 -> | |
# ubuntu-noble | |
os=$(echo ${packages_path} | \ | |
grep -E -o '(debian|ubuntu)-[^-]+') | |
mkdir -p release/${os}/ | |
# packages/packages-ubuntu-noble-amd64/ubuntu/pool/noble/ -> | |
# release/ubuntu-noble/ubuntu/pool/noble/ | |
rsync -a ${packages_path}/ release/${os}/ | |
done | |
for release_os_path in release/*; do | |
# release/ubuntu-noble -> | |
# ubuntu-noble | |
os=$(basename ${release_os_path}) | |
# release/ubuntu-noble/ubuntu/pool/noble/ -> | |
# ubuntu-noble/ubuntu/pool/noble/ | |
tar czf ${os}.tar.gz -C $(dirname ${release_os_path}) ${os} | |
done | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: release-linux-packages | |
path: "*.tar.gz" | |
release: | |
if: | | |
github.ref_type == 'tag' | |
name: Release | |
needs: prepare-release | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: release-artifacts | |
pattern: release-* | |
merge-multiple: true | |
- name: Extract release note | |
run: | | |
ruby \ | |
-e 'print("## groonga-nginx "); \ | |
puts(ARGF.read.split(/^## /)[1]. \ | |
gsub(/ {.+?}/, ""). \ | |
gsub(/\[(.+?)\]\[.+?\]/) {$1})' \ | |
NEWS.md > release-note.md | |
- name: Upload to release | |
run: | | |
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 Announcements \ | |
--notes-file release-note-without-version.md \ | |
--title "${title}" \ | |
release-artifacts/*/* | |
env: | |
GH_TOKEN: ${{ github.token }} |