Skip to content

Commit

Permalink
experiment service container in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeyson committed Jul 16, 2024
1 parent 1e40a95 commit e6f73fa
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: test

on:
push:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
typesense-version: ["26.0"]
typesense-port: ["8108:8108"]

env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

services:
typesense:
image: typesense/typesense:${{ matrix.typesense-version }}
ports:
- ${{matrix.typesense-port}}
options: >-
--health-cmd "curl -f http://localhost:8108/health"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repo
uses: actions/checkout@v4

# - name: Start Typesense
# run: |
# docker run -d \
# -p ${{ matrix.typesense-port }} \
# --name typesense \
# -v /tmp/typesense-data:/data \
# typesense/typesense:${{ matrix.typesense-version}} \
# --api-key=xyz \
# --data-dir /data \
# --enable-cors

# - name: Curl Typesense
# run: sleep 1 && curl http://localhost:8108/health

- name: Setup Elixir/OTP
uses: erlef/setup-beam@v1
with:
otp-version: "25"
elixir-version: "1.14.x"

- name: Cache dependencies/builds
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-typesense-${{ matrix.typesense-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-typesense-${{ matrix.typesense-version }}
- name: Install Dependencies
run: |
mix local.rebar --if-missing
mix local.hex --if-missing
mix deps.get
- name: Find unused dependencies
run: mix deps.unlock --check-unused

- name: Check retired dependencies
run: mix hex.audit

- name: Security audit of dependencies
run: mix deps.audit

- name: Compile project
run: mix compile --all-warnings

- name: run static analysis
run: mix credo --all --strict

- name: check format files
run: mix format --check-formatted

- name: Run tests
run: mix test

- name: Post test coverage to Coveralls
run: mix coveralls.github

0 comments on commit e6f73fa

Please sign in to comment.