Skip to content

Commit

Permalink
Upgrade CI for unit tests to Ubuntu 20.04 (#11119)
Browse files Browse the repository at this point in the history
* Upgrade CI for unit tests to Ubuntu 20.04

Extracted from #11026

Signed-off-by: Dirkjan Bussink <[email protected]>

* Fix MySQL installation

Signed-off-by: Dirkjan Bussink <[email protected]>

Signed-off-by: Dirkjan Bussink <[email protected]>
  • Loading branch information
dbussink authored Aug 30, 2022
1 parent 727a86a commit 8c7d460
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unit_race.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

build:
name: Unit Test (Race)
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
Expand Down Expand Up @@ -60,10 +60,10 @@ jobs:
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# mysql57
# mysql80
sudo apt-get install -y mysql-server mysql-client
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-8-jdk eatmydata
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata
sudo service mysql stop
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/unit_test_mariadb103.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Check if workflow needs to be skipped
Expand Down Expand Up @@ -64,8 +64,6 @@ jobs:
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# !mysql57
# Uninstall any previously installed MySQL first
sudo systemctl stop apparmor
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
Expand All @@ -82,7 +80,7 @@ jobs:
sudo apt update
sudo DEBIAN_FRONTEND="noninteractive" apt install -y mariadb-server
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-8-jdk eatmydata
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata
sudo service mysql stop
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/unit_test_mysql57.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Check if workflow needs to be skipped
Expand Down Expand Up @@ -64,10 +64,29 @@ jobs:
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# Uninstall any previously installed MySQL first
sudo systemctl stop apparmor
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
sudo apt-get -y autoremove
sudo apt-get -y autoclean
sudo deluser mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
# Get key to latest MySQL repo
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
# mysql57
sudo apt-get install -y mysql-server mysql-client
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb
# Bionic packages are still compatible for Focal since there's no MySQL 5.7
# packages for Focal.
echo mysql-apt-config mysql-apt-config/repo-codename select bionic | sudo debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
sudo apt-get update
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-8-jdk eatmydata
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata
sudo service mysql stop
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/unit_test_mysql80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Check if workflow needs to be skipped
Expand Down Expand Up @@ -64,8 +64,6 @@ jobs:
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# !mysql57
# Uninstall any previously installed MySQL first
sudo systemctl stop apparmor
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
Expand All @@ -85,7 +83,7 @@ jobs:
sudo apt-get update
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-8-jdk eatmydata
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata
sudo service mysql stop
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
Expand Down
31 changes: 18 additions & 13 deletions test/templates/unit_test.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Check if workflow needs to be skipped
Expand Down Expand Up @@ -62,15 +62,6 @@ jobs:
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update

{{if (eq .Platform "mysql57")}}

# mysql57
sudo apt-get install -y mysql-server mysql-client

{{else}}

# !mysql57

# Uninstall any previously installed MySQL first
sudo systemctl stop apparmor
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
Expand All @@ -80,6 +71,22 @@ jobs:
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql

{{if (eq .Platform "mysql57")}}
# Get key to latest MySQL repo
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29

# mysql57
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb
# Bionic packages are still compatible for Focal since there's no MySQL 5.7
# packages for Focal.
echo mysql-apt-config mysql-apt-config/repo-codename select bionic | sudo debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
sudo apt-get update
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*

{{end}}

{{if (eq .Platform "mysql80")}}
# Get key to latest MySQL repo
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
Expand All @@ -104,9 +111,7 @@ jobs:

{{end}}

{{end}} {{/*outer if*/}}

sudo apt-get install -y make unzip g++ curl git wget ant openjdk-8-jdk eatmydata
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata
sudo service mysql stop
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
Expand Down

0 comments on commit 8c7d460

Please sign in to comment.