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: Fix macOS workflow #2338

Merged
merged 7 commits into from
Jul 24, 2024
Merged

ci: Fix macOS workflow #2338

merged 7 commits into from
Jul 24, 2024

Conversation

taratatach
Copy link
Member

@taratatach taratatach commented Jul 23, 2024

The macOS Github Actions workflow needed some love to execute properly
after some probable changes in the underlying macOS image.

Please make sure the following boxes are checked:

  • PR is not too big
  • it improves UX & DX in some way
  • it includes unit tests matching the implementation changes
  • it includes scenarios matching a new behaviour or has been manually tested
  • it includes relevant documentation

  The `distutils` python package has been removed in Python 3.12.
  It is however required by `node-gyp` which we use to compile some
  native dependencies.

  Installing the `setuptools` python package is enough to fix the
  problem until we upgrade `node-gyp` to v10+.
  When one of the commands from the test setup script runs into an error
  (e.g. because the docker container running `cozy-stack` is not
  fully up and running), the script itself should return an error code
  so that it can be run in a Bash loop until it succeeds (very useful
  when run on the CI as we don't really know when the container is ready
  to receive commands).
  Xvfb is not available in macOS images on Github Actions so the step
  does not work and tests seem to run fine without it anyway.
  This version seems to fix DNS lookup errors we're experiencing when
  trying to make requests to cozy.localhost in Realtime tests.
  See nodejs/node@ddd9c70
  The `admin-host` port is forced in the `cozy-app-dev` image to
  `127.0.0.1`, an IPv4 address, while the default value used in
  `cozy-stack` commands is `::`, an IPv6 address.
  This causes setup requests to fail on the CI (not sure why it doesn't
  on a local dev machine though).

  Passing the `--admin-host` option to `cozy-stack` commands in the
  setup script fixes the issue.
  For our test suite to properly run on macOS, we need the `cozy-stack`
  server upon which requests are made to use a case and UTF-8 sensitive
  filesystem such as Ext. These filesystems cannot be created on macOS
  so we need a linux VM to run `cozy-stack` into.

  We were using `podman-machine` to start that VM on the CI until now
  but it does not seem to work anymore so we're switching to a new
  Github action, `douglascamata/setup-docker-macos-action`, which does
  the heavy lifting of creating a linux VM with all the necessary tools
  and connections to run docker containers on it.
  We can then use our docker-compose file to run `cozy-app-dev` easily.
  The `ScribeMD/docke-cache` Github action we use to cache the
  `cozy-app-dev` docker image does not properly run on Github Actions'
  macOS images as it expects Bash to be available at `/usr/bin/bash` but
  Bash is not available by default and Homebrew installs it in a
  different path as `/usr/bin` is read-only.

  To make this action work for us, we forked it to add a `bash` input
  that accepts a string specifying the Bash path to use.
  We'll use our fork until we can get the upstream project to be fixed.
@taratatach taratatach self-assigned this Jul 23, 2024
@taratatach taratatach merged commit 3338647 into master Jul 24, 2024
11 of 17 checks passed
@taratatach taratatach deleted the ci/fix-macos-workflow branch July 24, 2024 08:21
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.

1 participant