diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b3579a01..47bdbb6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} @@ -54,4 +61,5 @@ jobs: working-directory: ${{ env.ZOTONIC_DIR }} env: ERL: "erl -noshell" + ZOTONIC_DBHOST: postgres run: $GITHUB_WORKSPACE/scripts/runtests.sh diff --git a/config/zotonic-test.config b/config/zotonic-test.config new file mode 100644 index 00000000..a7bddb50 --- /dev/null +++ b/config/zotonic-test.config @@ -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"}}} + ]} + ] +}].