Skip to content

Commit

Permalink
fix: Resolve .localhost domains on macOS
Browse files Browse the repository at this point in the history
  By default, macOS does not resolve domains on the `.localhost` tld.

  However we do use this tld for our tests so we need to add `dnsmasq`
  and resolve these domains on the CI or some tests will fail.

  We don't really know why some of them were passing before though.
  • Loading branch information
taratatach committed Oct 3, 2023
1 parent 73ecd82 commit 753ca3c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/actions/setup-dnsmasq/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Setup cozy-stack
author: Erwan Guyader
description: Setup dnsmasq for .localhost domains on macOS
runs:
using: composite
steps:
- name: Install dnsmasq
shell: bash
run: brew install dnsmasq

- name: Add address entry to point .localhost to 127.0.0.1
shell: bash
run: echo "address=/.localhost/127.0.0.1" >> "$(brew --prefix)"/etc/dnsmasq.conf

- name: Start dnsmasq
shell: bash
run: sudo brew services start dnsmasq

- name: Create resolver configuration
shell: bash
run: |
sudo mkdir -p /etc/resolver
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/localhost
6 changes: 6 additions & 0 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ jobs:
uses: ./.github/actions/setup-cozy-stack
with:
couchdb-url: ${{ steps.setup-couchdb.outputs.couchdb-url }}
- name: Setup DNS resolution for .localhost
uses: ./.github/actions/setup-dnsmasq
- name: Setup local env
env:
COZY_DESKTOP_FS: ${{ matrix.fs }}
Expand Down Expand Up @@ -151,6 +153,8 @@ jobs:
uses: ./.github/actions/setup-cozy-stack
with:
couchdb-url: ${{ steps.setup-couchdb.outputs.couchdb-url }}
- name: Setup DNS resolution for .localhost
uses: ./.github/actions/setup-dnsmasq
- name: Setup local env
env:
COZY_DESKTOP_FS: ${{ matrix.fs }}
Expand Down Expand Up @@ -209,6 +213,8 @@ jobs:
uses: ./.github/actions/setup-cozy-stack
with:
couchdb-url: ${{ steps.setup-couchdb.outputs.couchdb-url }}
- name: Setup DNS resolution for .localhost
uses: ./.github/actions/setup-dnsmasq
- name: Setup local env
env:
COZY_DESKTOP_FS: ${{ matrix.fs }}
Expand Down

0 comments on commit 753ca3c

Please sign in to comment.