ubicloud/.github/actions/setup-clover/action.yml
Enes Cakir 6bfad55c99 Run CI on macOS runners too
We hit macOS specific issues a few times in the past.

Since macOS runners are free for open source projects, there is no
reason not to run CI on them.

bcrypt_pbkdf doesn't support Ruby 3.4 yet; only the rc version is
supported for now. https://github.com/net-ssh/bcrypt_pbkdf-ruby/issues/25

    Fetching gem metadata from https://rubygems.org/.......... The
    following platform specific gems are getting installed, yet the
    lockfile includes only their generic ruby version: *
    bcrypt_pbkdf-1.1.1-arm64-darwin Please run `bundle lock
    --normalize-platforms` and commit the resulting lockfile.
    Alternatively, you may run `bundle lock --add-platform
    <list-of-platforms-that-you-want-to-support>`
    bcrypt_pbkdf-1.1.1-arm64-darwin requires ruby version < 3.4.dev, >=
    2.7, which is incompatible with the current version, 3.4.4
2025-10-01 18:54:06 +03:00

55 lines
2.1 KiB
YAML

name: 'Setup Clover'
runs:
using: "composite"
steps:
- name: Setup PostgreSQL
shell: bash
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
# Remove the default PostgreSQL cluster on the runner
sudo -u postgres pg_dropcluster 14 main --stop
# Install PostgreSQL
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-15 postgresql-client-15
# Allow runner user to access PostgreSQL
echo 'runner_map runner postgres
runner_map runner clover
runner_map runner clover_password' | sudo tee -a /etc/postgresql/15/main/pg_ident.conf > /dev/null
sudo sed -i '1i local all all peer map=runner_map' /etc/postgresql/15/main/pg_hba.conf
sudo systemctl start postgresql
until pg_isready -q; do sleep 1; done
elif [ "$RUNNER_OS" = "macOS" ]; then
brew install postgresql@15
export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH"
echo "/opt/homebrew/opt/postgresql@15/bin" >> $GITHUB_PATH
brew services start postgresql@15
until pg_isready -q; do sleep 1; done
psql -d postgres -c "CREATE ROLE postgres WITH LOGIN SUPERUSER CREATEDB CREATEROLE;"
else
echo "Unsupported RUNNER_OS: $RUNNER_OS"
exit 1
fi
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .tool-versions
bundler-cache: true
- name: Create .env.rb file
shell: bash
run: "bundle exec rake overwrite_envrb && echo '$stdout.sync = true' >> .env.rb"
- name: Setup clover database
shell: bash
run: |
createuser -U postgres clover
createuser -U postgres clover_password
bundle exec rake setup_database\[test,true\]
- name: Install CSI gems
shell: bash
run: "cd kubernetes/csi && bundle install"