Hey there,
my team is using Github Actions and all in all we are very happy. But a strange behavior occurs from time to time:
When we run our tests we start up some small scale local servers that mock our third party systems. So a test will start up a server, run its test and stop the server again.
In general this works fine, but sometimes we will get a random :eaddrinuse error.
Does somebody experience the same? Is there a way to avoid this? Further below I will add the config of our workflow.
on:
push:
branches: [master]
jobs:
release:
name: Stage Release (OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }} | Node ${{ matrix.node }} | OS ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
otp: [23.x]
elixir: [1.11.x]
node: [12.x]
postgres: [12]
services:
db:
image: postgres:${{ matrix.postgres }}
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Elixir
uses: erlef/setup-elixir@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Cache deps
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ matrix.elixir }}-mix-
- name: Install Dependencies
run: mix deps.get
- name: Cache _build/test
uses: actions/cache@v2
with:
path: _build/test
key: ${{ runner.os }}-${{ matrix.elixir }}-build-test-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.elixir }}-build-test
- name: Run Tests
run: mix test
...
Kind regards,
Peter