I've been trying to setup a SurrealDB container within my test job in GitHub Actions. The step I am currently struggling with is that I can't find a way to expose the ports on my surreal-db custom docker action. Previously, I have also tried using a service container (my understanding is that the service container is usually used for that purpose).
test:
name: Test
runs-on: ubuntu-latest
env:
SURREAL_USER: ${{ secrets.SURREAL_USER }}
SURREAL_PASS: ${{ secrets.SURREAL_PASS }}
SURREAL_PORT: ${{ vars.SURREAL_PORT }}
steps:
- uses: actions/checkout@v4
...
services:
db:
image: surrealdb/surrealdb:latest
# Problem here is that I can't use the entrypoint property to launch the server
ports:
- ${{ vars.SURREAL_PORT }:8000
...
inputs:
surreal-user:
description: "Username for the account"
required: false
default: "root"
surreal-pass:
description: "Password for the account"
required: false
default: "root"
surreal-port:
description: "Port to expose on the host machine"
required: false
default: "8000"
runs:
using: "docker"
image: docker://surrealdb/surrealdb:latest
entrypoint: "entrypoint.sh"
args:
- ${{ inputs.surreal-user }}
- ${{ inputs.surreal-pass }}
- ${{ inputs.surreal-port }}
# ... and here I can't use the ports property
I am thinking that there must be a way to expose the ports somehow. Anyone know how? Or do you have an alternative way of working around that problem?
Can you try something like the following and let me know if that worked? Also use the official surrealdb/setup-surreal@v1 action.
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Test
uses: actions/checkout@v2
- name: Start SurrealDB
uses: surrealdb/setup-surreal@v1
with:
surrealdb_version: latest
surrealdb_port: 8000
surrealdb_username: root
surrealdb_password: root
surrealdb_auth: false
surrealdb_strict: false
surrealdb_log: info