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: update runtime environments #1299

Merged
merged 1 commit into from
Jan 21, 2023

Conversation

sodabrew
Copy link
Collaborator

@sodabrew sodabrew commented Dec 28, 2022

Reduces CI time and sidesteps the failure at #1297

@sodabrew sodabrew force-pushed the macos-images-have-openssl branch from 891a5fa to d4469e4 Compare December 28, 2022 01:51
@sodabrew
Copy link
Collaborator Author

Bah, fails for the MySQL on MacOS build with

ld: warning: directory not found for option '-L/usr/local/opt/openssl@3/lib'

@junaruga
Copy link
Contributor

junaruga commented Dec 28, 2022

I debugged this behavior. The CI log is here.

Currently the extconf.rb gets the openssl library path from brew --prefix openssl.

openssl_location = `brew --prefix openssl`.strip

However the behavior of openssl un-versioned package name gets the openssl version 3 on the OSX image.

$ brew --prefix openssl
/usr/local/opt/openssl@3

But the actual directory exists for only openssl 1.1.

$ ls -ld /usr/local/opt/openssl*
lrwxr-xr-x  1 runner  admin  36 Dec 16 00:42 /usr/local/opt/openssl -> /usr/local/Cellar/[email protected]/1.1.1s
lrwxr-xr-x  1 runner  admin  28 Dec 16 00:25 /usr/local/opt/[email protected] -> ../Cellar/[email protected]/1.1.1s

And this is intended behavior by the openssl brew package maintainer Homebrew/brew#12879 , and he suggested using the brew --prefix [email protected] instead of that.

$ brew --prefix [email protected]
/usr/local/opt/[email protected]

@sodabrew
Copy link
Collaborator Author

IIRC, the libmysqlclient can be built against openssl 1.1 or 3, so the question isn't as much "what's installed on this system?" as it is "what matches the client library we'll be linking with / loading at runtime?"

@sodabrew sodabrew force-pushed the macos-images-have-openssl branch from 5ab712e to 451663e Compare December 29, 2022 20:49
@junaruga
Copy link
Contributor

junaruga commented Jan 2, 2023

Yes, I understand your point. The mysql2 should work with both openssl 1.1 and 3 if we can link the runtime library. I meant we could access to the openssl 1.1 library to make mysql2 work when we don't install additional openssl on the GitHub Actions macos case.

@junaruga
Copy link
Contributor

How do you fix this issue to pass MacOS cases?

@junaruga
Copy link
Contributor

I opened another PR #1301 based on the first 2 commits on this PR.

@junaruga
Copy link
Contributor

Maybe shall we change this PR's title "CI: GitHub Actions MacOS images now include openssl" to another one that describes what the PR do in a better way? I suppose that the "CI: GitHub Actions MacOS images now include openssl" was fixed by #1303 .

@junaruga
Copy link
Contributor

Have you considered the unified YAML file for Ubuntu cases? The ubuntu-focal.yml and ubuntu-jammy.yml are similar.

$ diff ubuntu-focal.yml ubuntu-jammy.yml
1c1
< name: Ubuntu Focal 20.04 with Ruby 2.x
---
> name: Ubuntu Jammy 22.04 with Ruby 3.x
12c12
<           - ubuntu-20.04 # focal
---
>           - ubuntu-22.04 # jammy
14,21c14,17
<           - '2.7'
<           - '2.6'
<           - '2.5'
<           - '2.4'
<           - '2.3'
<           - '2.2'
<           - '2.1'
<           - '2.0'
---
>           - 'head'
>           - '3.2'
>           - '3.1'
>           - '3.0'
23,25c19,21
<           - {os: ubuntu-20.04, ruby: '2.7', db: mariadb10.6}
<           - {os: ubuntu-20.04, ruby: '2.7', db: mysql57}
<           - {os: ubuntu-20.04, ruby: '2.7', db: mysql80}
---
>           - {os: ubuntu-22.04, ruby: '3.0', db: mariadb10.6}
>           - {os: ubuntu-22.04, ruby: '3.0', db: mysql57}
>           - {os: ubuntu-22.04, ruby: '3.0', db: mysql80}

I tired the unified one ubuntu.yml on my forked repository on this PR. Then some cases failed with the network connection error. The CI result.

ubuntu.yml

name: Ubuntu
on: [push, pull_request]
jobs:
  build:
    name: >-
      ${{ matrix.os }} ruby ${{ matrix.ruby }} ${{ matrix.db }}
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.allow-failure || false }}
    strategy:
      matrix:
        include:
          # jammy
          - {os: ubuntu-22.04, ruby: 'head'}
          - {os: ubuntu-22.04, ruby: '3.2'}
          - {os: ubuntu-22.04, ruby: '3.1'}
          - {os: ubuntu-22.04, ruby: '3.0'}
          - {os: ubuntu-22.04, ruby: '3.0', db: mariadb10.6}
          - {os: ubuntu-22.04, ruby: '3.0', db: mysql57}
          - {os: ubuntu-22.04, ruby: '3.0', db: mysql80}
          # focal
          - {os: ubuntu-20.04, ruby: '2.7'}
          - {os: ubuntu-20.04, ruby: '2.6'}
          - {os: ubuntu-20.04, ruby: '2.5'}
          - {os: ubuntu-20.04, ruby: '2.4'}
          - {os: ubuntu-20.04, ruby: '2.3'}
          - {os: ubuntu-20.04, ruby: '2.2'}
          - {os: ubuntu-20.04, ruby: '2.1'}
          - {os: ubuntu-20.04, ruby: '2.0'}
          - {os: ubuntu-20.04, ruby: '2.7', db: mariadb10.6}
          - {os: ubuntu-20.04, ruby: '2.7', db: mysql57}
          - {os: ubuntu-20.04, ruby: '2.7', db: mysql80}
      # On the fail-fast: true, it cancels all in-progress jobs
      # if any matrix job fails, which we don't want.
      fail-fast: false
    env:
      BUNDLE_WITHOUT: development
    steps:
      - uses: actions/checkout@v3
      # https://github.com/ruby/setup-ruby
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - if: matrix.db
        run: echo 'DB=${{ matrix.db }}' >> $GITHUB_ENV
      - run: sudo echo "127.0.0.1 mysql2gem.example.com" | sudo tee -a /etc/hosts
      - run: bash ci/setup.sh
      - run: bundle exec rake spec

@@ -0,0 +1,42 @@
name: Ubuntu Focal 20.04 with Ruby 2.x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of the "name" element is also used as the badge image's text. Maybe shorter text is better. See https://github.com/brianmario/mysql2/actions/workflows/ubuntu-focal.yml/badge.svg.

@sodabrew sodabrew force-pushed the macos-images-have-openssl branch 6 times, most recently from a0e417a to 81541bf Compare January 21, 2023 02:55
@sodabrew sodabrew force-pushed the macos-images-have-openssl branch from 81541bf to 5946b29 Compare January 21, 2023 02:58
@sodabrew sodabrew merged commit ad56ca4 into brianmario:master Jan 21, 2023
@sodabrew sodabrew deleted the macos-images-have-openssl branch January 21, 2023 03:04
@sodabrew sodabrew changed the title CI: GitHub Actions MacOS images now include openssl CI: update runtime environments Jan 21, 2023
@junaruga
Copy link
Contributor

Thanks for the work! Just note that when we see the network connection error, we can use a retry bash script that is like this used in the ruby/ruby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants