Skip to content

Commit

Permalink
Fix the GH test action (#734)
Browse files Browse the repository at this point in the history
* Fix the GH test action

* Use checkout@v2

* Use psql setup from zotonic-master tests

* Set ZOTONIC_DBHOST env

* Use test config file with db connect options

* Try with psql 9.6

* Use dbpassword 'zotonic'

* Just to force the checks to run again
  • Loading branch information
mworrell authored Jul 17, 2023
1 parent a688d72 commit 5874c6d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 21 deletions.
50 changes: 29 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,51 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
name: Test on OTP ${{ matrix.otp_version }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
otp_version: [21.3]
os: [ubuntu-latest]

container:
image: erlang:${{ matrix.otp_version }}

env:
ZOTONIC_DIR: /tmp/zotonic

# Start PostgreSQL wth 'zotonic' as the default user.
services:
postgres:
image: postgres:9.5.5-alpine
env:
POSTGRES_USER: zotonic
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:9.6
env:
POSTGRES_DB: zotonic
POSTGRES_USER: zotonic
POSTGRES_PASSWORD: zotonic
# Set health checks to wait until postgres has started.
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout
uses: actions/checkout@v2.4.0

- name: Set up Erlang
uses: erlef/setup-beam@v1.10.0
with:
otp-version: "21.3"
env:
ImageOS: ubuntu20
uses: actions/checkout@v2

- name: Install and configure Zotonic
run: |
git clone https://github.com/zotonic/zotonic.git $ZOTONIC_DIR --branch 0.x
mkdir -p ~/.zotonic/0 ${ZOTONIC_DIR}/user
sed "s|\.\.\/ginger/modules|$GITHUB_WORKSPACE/modules|" config/zotonic.config > ~/.zotonic/0/zotonic.config
sed "s|\.\.\/ginger/modules|$GITHUB_WORKSPACE/modules|" config/zotonic-test.config > ~/.zotonic/0/zotonic.config
- name: Install dependencies
run: |
git clone https://github.com/driebit/mod_elasticsearch.git modules/mod_elasticsearch
git clone https://github.com/driebit/mod_elasticsearch2.git modules/mod_elasticsearch2
- name: Compile
working-directory: ${{ env.ZOTONIC_DIR }}
Expand All @@ -54,4 +61,5 @@ jobs:
working-directory: ${{ env.ZOTONIC_DIR }}
env:
ERL: "erl -noshell"
ZOTONIC_DBHOST: postgres
run: $GITHUB_WORKSPACE/scripts/runtests.sh
23 changes: 23 additions & 0 deletions config/zotonic-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[{zotonic,
[
{user_sites_dir, "../ginger/sites"},
{user_modules_dir, "../ginger/modules"},
{password, ""},

{dbdatabase, "zotonic"},
{dbschema, "public"},
{dbpassword, "zotonic"},
{dbuser, "zotonic"},
{dbport, 5432},
{dbhost, "postgres"},

{deps, [
{erlastic_search, ".*", {git, "https://github.com/tsloughter/erlastic_search.git", "8482766d479a0d41b3e7d1e754e096293fa30955"}},
{geodata2, ".*", {git, "https://github.com/brigadier/geodata2.git", "1a4da299683691d6de19b9f261f53b5ea6e10407"}},
{hackney, ".*", {git, "https://github.com/benoitc/hackney.git", {tag, "1.14.3"}}},
{hamcrest, ".*", {git, "https://github.com/truqu/hamcrest-erlang", "e413409e9424751865bd58d65c49fa6659d94d2d"}},
{lager_logstash, "", {git, "https://github.com/rpt/lager_logstash.git", {tag, "0.1.3"}}},
{tql, ".*", {git, "https://github.com/driebit/tql", {tag, "1.2.1"}}}
]}
]
}].

0 comments on commit 5874c6d

Please sign in to comment.