Linux #770
This file contains hidden or 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: Linux | |
| on: | |
| push: | |
| paths: | |
| - "**/*.cpp" | |
| - "**/*.h" | |
| - "**/*.hpp" | |
| - "**/CMakeLists.txt" | |
| - "**/Makefile.am" | |
| - ".github/workflows/linux.yml" | |
| - "configure.ac" | |
| - "doc/**" | |
| - "mysql-test/**" | |
| - "packages/**" | |
| - "version_*" | |
| pull_request: | |
| paths: | |
| - "**/*.cpp" | |
| - "**/*.h" | |
| - "**/*.hpp" | |
| - "**/CMakeLists.txt" | |
| - "**/Makefile.am" | |
| - ".github/workflows/linux.yml" | |
| - "configure.ac" | |
| - "doc/**" | |
| - "mysql-test/**" | |
| - "packages/**" | |
| - "version_*" | |
| schedule: | |
| - cron: | | |
| 0 0 * * * | |
| concurrency: | |
| group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| source: | |
| name: Source | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3 | |
| - name: Install dependencies | |
| run: | | |
| sed \ | |
| -e 's/^Types: deb/Types: deb-src/' \ | |
| /etc/apt/sources.list.d/ubuntu.sources | \ | |
| sudo tee /etc/apt/sources.list.d/ubuntu-sources.sources | |
| ./setup.sh | |
| python -m pip install -U pip | |
| - name: Install Sphinx | |
| run: | | |
| python -m pip install -r doc/requirements.txt | |
| - name: Download MySQL source | |
| run: | | |
| mkdir -p ../mysql | |
| cd ../mysql | |
| apt source mysql-server | |
| ln -s $(find . -maxdepth 1 -type d | sort | tail -1) mysql | |
| - name: Generate configure | |
| run: | | |
| ./autogen.sh | |
| - name: Configure for archive | |
| run: | | |
| ./configure \ | |
| --enable-document \ | |
| --with-mysql-source=../mysql/mysql | |
| - name: Build archive | |
| run: | | |
| make dist | |
| # Artifact | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-source | |
| path: mroonga-*.tar.gz | |
| build: | |
| name: Build | |
| needs: source | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # MariaDB 10.6 | |
| - os: almalinux-8 | |
| package: mariadb-10.6 | |
| test-image: "images:almalinux/8" | |
| - os: almalinux-9 | |
| package: mariadb-10.6 | |
| test-image: "images:almalinux/9" | |
| - os: ubuntu-jammy | |
| package: mariadb-10.6 | |
| test-image: "images:ubuntu/22.04" | |
| # MariaDB 10.11 | |
| - os: almalinux-8 | |
| package: mariadb-10.11 | |
| test-image: "images:almalinux/8" | |
| - os: almalinux-9 | |
| package: mariadb-10.11 | |
| test-image: "images:almalinux/9" | |
| - os: debian-bookworm | |
| package: mariadb-10.11 | |
| test-image: "images:debian/12" | |
| - os: ubuntu-noble | |
| package: mariadb-10.11 | |
| test-image: "images:ubuntu/24.04" | |
| # MariaDB 11.4 | |
| - os: almalinux-8 | |
| package: mariadb-11.4 | |
| test-image: "images:almalinux/8" | |
| - os: almalinux-9 | |
| package: mariadb-11.4 | |
| test-image: "images:almalinux/9" | |
| # MySQL 8.0 | |
| - os: ubuntu-jammy | |
| package: mysql-8.0 | |
| test-image: "images:ubuntu/22.04" | |
| - os: ubuntu-noble | |
| package: mysql-8.0 | |
| test-image: "images:ubuntu/24.04" | |
| # MySQL community 8.0 | |
| - os: almalinux-8 | |
| package: mysql-community-8.0 | |
| test-image: "images:almalinux/8" | |
| - os: almalinux-9 | |
| package: mysql-community-8.0 | |
| test-image: "images:almalinux/9" | |
| - os: debian-bookworm | |
| package: mysql-community-8.0 | |
| test-image: "images:debian/12" | |
| - os: ubuntu-jammy | |
| package: mysql-community-8.0 | |
| test-image: "images:ubuntu/22.04" | |
| - os: ubuntu-noble | |
| package: mysql-community-8.0 | |
| test-image: "images:ubuntu/24.04" | |
| # MySQL community 8.4 | |
| - os: almalinux-8 | |
| package: mysql-community-8.4 | |
| test-image: "images:almalinux/8" | |
| - os: almalinux-9 | |
| package: mysql-community-8.4 | |
| test-image: "images:almalinux/9" | |
| - os: debian-bookworm | |
| package: mysql-community-8.4 | |
| test-image: "images:debian/12" | |
| - os: ubuntu-jammy | |
| package: mysql-community-8.4 | |
| test-image: "images:ubuntu/22.04" | |
| - os: ubuntu-noble | |
| package: mysql-community-8.4 | |
| test-image: "images:ubuntu/24.04" | |
| # MySQL community minimal 8.0 | |
| - os: almalinux-9 | |
| package: mysql-community-minimal-8.0 | |
| test-image: "images:almalinux/9" | |
| # MySQL community minimal 8.4 | |
| - os: almalinux-9 | |
| package: mysql-community-minimal-8.4 | |
| test-image: "images:almalinux/9" | |
| # Percona Server 8.0 | |
| - os: almalinux-8 | |
| package: percona-server-8.0 | |
| test-image: "images:almalinux/8" | |
| - os: almalinux-9 | |
| package: percona-server-8.0 | |
| test-image: "images:almalinux/9" | |
| # Percona Server 8.4 | |
| - os: almalinux-9 | |
| package: percona-server-8.4 | |
| test-image: "images:almalinux/9" | |
| env: | |
| APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow | |
| GROONGA_REPOSITORY: ${{ github.workspace }}/groonga | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Prepare environment variables | |
| run: | | |
| case ${{ matrix.os }} in | |
| debian-*|ubuntu-*) | |
| echo "PACKAGE_TYPE=apt" >> ${GITHUB_ENV} | |
| ;; | |
| *) | |
| echo "PACKAGE_TYPE=yum" >> ${GITHUB_ENV} | |
| ;; | |
| esac | |
| - uses: actions/checkout@v5 | |
| - uses: actions/checkout@v5 | |
| with: | |
| path: groonga | |
| repository: groonga/groonga | |
| submodules: recursive | |
| - uses: actions/checkout@v5 | |
| with: | |
| path: apache-arrow | |
| repository: apache/arrow | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ruby | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: release-source | |
| - name: Update version | |
| if: | | |
| github.ref_type != 'tag' && | |
| !startsWith(github.ref_name, 'maintenance/') | |
| run: | | |
| case ${{ matrix.os }} in | |
| debian-*|ubuntu-*) | |
| cd packages | |
| rake version:update | |
| ;; | |
| esac | |
| - 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.package }}-mroonga/${{ env.PACKAGE_TYPE }}/build/${{ matrix.os }}/ccache | |
| key: package-${{ matrix.os }}-${{ matrix.package }}-ccache-${{ hashFiles('*.cpp', '*.hpp', '*.h', 'lib/*.cpp', 'lib/*.hpp') }} | |
| restore-keys: package-${{ matrix.os }}-${{ matrix.package }}-ccache- | |
| - name: Build with Docker | |
| run: | | |
| cd packages/${{ matrix.package }}-mroonga | |
| if [ "${{ github.event_name }}" != "schedule" ]; then | |
| rake docker:pull || : | |
| fi | |
| exit_status=0 | |
| for i in {1..3}; do | |
| set +e | |
| rake ${PACKAGE_TYPE}:build BUILD_DIR=build | |
| exit_status=$? | |
| set -e | |
| if [ ${exit_status} -eq 0 ]; then | |
| break | |
| fi | |
| done | |
| rake docker:push || : | |
| exit ${exit_status} | |
| env: | |
| APT_TARGETS: ${{ matrix.os }} | |
| YUM_TARGETS: ${{ matrix.os }} | |
| # Artifact | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages-${{ matrix.package }}-${{ matrix.os }} | |
| path: packages/${{ matrix.package }}-mroonga/${{ env.PACKAGE_TYPE }}/repositories/ | |
| - name: Install Incus | |
| run: | | |
| 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: Prepare container | |
| run: | | |
| set -x | |
| sudo incus admin init --auto | |
| sudo incus launch ${{ matrix.test-image }} target | |
| sudo incus config device add target host disk source=$PWD path=/host | |
| # Ideally, we would use systemctl is-system-running --wait to ensure all services are fully operational. | |
| # However, this option doesn't work in AlmaLinux 8 and results in an error. | |
| # As a workaround, we introduced a 10-second sleep delay to allow network services time to stabilize, | |
| # preventing DNS resolution errors when attempting to dnf install command. | |
| # ref: https://discuss.linuxcontainers.org/t/network-issue-with-almalinux-8-9-on-github-actions-using-incus/20046 | |
| sleep 10 | |
| - name: Run test | |
| run: | | |
| sudo incus exec target \ | |
| -- \ | |
| /host/packages/${PACKAGE_TYPE}/test.sh \ | |
| ${{ matrix.package }}-mroonga \ | |
| ${GITHUB_REF_TYPE} | |
| - name: Delete container | |
| run: | | |
| sudo incus stop target | |
| sudo incus delete target | |
| docs: | |
| name: Documents | |
| needs: source | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| BUNDLER_GEMFILE: doc/Gemfile | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: release-source | |
| - name: Extract | |
| run: | | |
| tar -xf mroonga-*.tar.gz --strip-components 1 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ruby | |
| bundler-cache: true | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3 | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| pip install -r doc/requirements.txt | |
| - name: Build | |
| run: | | |
| version=$(cat version_full) | |
| rake \ | |
| release:document:update \ | |
| MROONGA_ORG_DIR=documents-${version} | |
| tar -czf documents-${version}.tar.gz documents-${version} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-documents | |
| path: documents-*.tar.gz | |
| prepare-release: | |
| name: Prepare for release | |
| needs: | |
| - build | |
| - docs | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| path: packages | |
| pattern: packages-* | |
| - name: Group by distribution and version | |
| run: | | |
| for packages_path in packages/packages-*; do | |
| # packages/packages-mysql-community-8.4-almalinux-9 -> | |
| # almalinux-9 | |
| os=$(echo ${packages_path} | \ | |
| grep -E -o '(almalinux|debian|ubuntu)-[^-]+$') | |
| mkdir -p release/${os}/ | |
| # packages/packages-mysql-community-8.4-almalinux-9/almalinux/9/source/ -> | |
| # release/almalinux-9/almalinux/9/source/ | |
| rsync -a ${packages_path}/ release/${os}/ | |
| done | |
| for release_os_path in release/*; do | |
| # release/almalinux-9 -> | |
| # almalinux-9 | |
| os=$(basename ${release_os_path}) | |
| # release/almalinux-9/almalinux/9/source/ -> | |
| # almalinux-9/almalinux/9/source/ | |
| 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" |