Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Refactor #180

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 52 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ on:
pull_request:

jobs:
build:
name: ${{ format('Build ({0}, {1}, {2})', matrix.mysql, matrix.distribution, matrix.ruby) }}
linux-test:
name: ${{ format('{0} (Ruby {1}, MySQL {2})', matrix.distribution, matrix.ruby, matrix.mysql) }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mysql: ["5.7", "8.0"]
distribution: ["debian:buster", "ubuntu:focal", "ubuntu:bionic"]
ruby: ["3.3"]
ruby: ["3.3.0"]
include:
- mysql: "5.7"
distribution: "debian:buster"
ruby: "2.7.8"
steps:
- uses: actions/checkout@v4
- name: docker login
- name: Docker login
run: echo $GITHUB_TOKEN | docker login ghcr.io --username trilogy --password-stdin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -34,3 +34,51 @@ jobs:
DISTRIBUTION: ${{ matrix.distribution }}
RUBY_VERSION: ${{ matrix.ruby }}
run: script/cibuild
macos-test:
name: ${{ format('macOS (MySQL {0})', matrix.mysql) }}
runs-on: macos-latest
strategy:
matrix:
mysql: ["5.7", "8.0"]
steps:
- uses: actions/checkout@v4
- name: Setup MySQL
run: |
brew install mysql@${{ matrix.mysql }}
(unset CI; brew postinstall mysql@${{ matrix.mysql }})
brew services start mysql@${{ matrix.mysql }}
sleep 5
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot -e 'CREATE DATABASE test'
- name: Build
run: CFLAGS="-I$(brew --prefix [email protected])/include" LDFLAGS="-L$(brew --prefix [email protected])/lib" make all test/test
- name: test
run: test/test
macos-test-ruby:
name: ${{ format('macOS Ruby (MySQL {0})', matrix.mysql) }}
runs-on: macos-latest
strategy:
matrix:
mysql: ["5.7", "8.0"]
steps:
- uses: actions/checkout@v4
- name: Setup MySQL
env:
MYSQL_VERSION: ${{ matrix.mysql }}
run: |
brew install mysql@${{ matrix.mysql }}
(unset CI; brew postinstall mysql@${{ matrix.mysql }})
brew services start mysql@${{ matrix.mysql }}
sleep 5
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot -e 'CREATE DATABASE test'
[[ "$MYSQL_VERSION" == "8.0" ]] && $(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/caching_sha2_password_user.sql
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/native_password_user.sql
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/x509_user.sql
$(brew --prefix mysql@${{ matrix.mysql }})/bin/mysql -uroot < test/mysql/docker-entrypoint-initdb.d/cleartext_user.sql
- name: Install dependencies
run: |
cd contrib/ruby
bundle --without benchmark
- name: Run tests
run: |
cd contrib/ruby
bundle exec rake
58 changes: 0 additions & 58 deletions .github/workflows/macos.yml

This file was deleted.

58 changes: 49 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,59 @@
ARG DISTRIBUTION=ubuntu:jammy

FROM ${DISTRIBUTION}
LABEL maintainer="[email protected]"
ARG RUBY_VERSION=3.2
# Make all apt-get commands non-interactive. Setting this as an ARG will apply to the entire
# build phase, but not leak into the final image and run phase.
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y build-essential ca-certificates wget libssl-dev default-libmysqlclient-dev clang clang-tools llvm valgrind netcat
# Install system dependencies.
RUN apt-get update --quiet=2 \
&& apt-get install --quiet --yes \
apt-transport-https \
ca-certificates \
curl \
gnupg

RUN update-ca-certificates
# Install Ruby dependencies.
RUN apt-get update --quiet=2 \
&& apt-get install --yes --no-install-recommends \
autoconf \
bison \
patch \
build-essential \
rustc \
libssl-dev \
libyaml-dev \
libreadline-dev \
zlib1g-dev \
libgmp-dev \
libncurses-dev \
libffi-dev \
libgdbm-dev \
libdb-dev \
uuid-dev \
# Other dependencies...
default-libmysqlclient-dev \
clang \
clang-tools \
llvm \
valgrind \
netcat

RUN wget https://github.com/postmodern/ruby-install/releases/download/v0.9.0/ruby-install-0.9.0.tar.gz && \
tar -xzvf ruby-install-0.9.0.tar.gz && \
cd ruby-install-0.9.0/ && \
make install
RUN update-ca-certificates

ARG RUBY_VERSION=3.2
RUN ruby-install --system ruby ${RUBY_VERSION}
RUN ruby --version
RUN if which ruby >/dev/null 2>&1; then \
echo "Ruby is already installed: $(ruby --version)"; \
else \
curl --location \
"https://github.com/rbenv/ruby-build/archive/refs/tags/$(basename $(curl --location --silent --output /dev/null --write-out %{url_effective} https://github.com/rbenv/ruby-build/releases/latest)).tar.gz" \
| tar --extract --gzip \
&& PREFIX=/usr/local ./ruby-build-*/install.sh \
&& rm -rf ./ruby-build-*/install.sh \
&& ruby-build ${RUBY_VERSION} /usr/local \
&& echo "Installed Ruby: $(ruby --version)"; \
fi

WORKDIR /app
COPY . .
Expand Down
1 change: 1 addition & 0 deletions test/mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ RUN set -eux \
# This is the final stage inwhich we copy the plugins from the test stage. Doing it this way allows
# us to not have to install the test package in the final image since we only need the plugins.
FROM mysql:${MYSQL_VERSION}-debian
LABEL maintainer="[email protected]"
COPY --from=0 /usr/lib/mysql/plugin/ /usr/lib/mysql/plugin/
Loading