Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci_v26.0.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: CI v26.0

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# Workflows that would otherwise be triggered using `on: push` or
Expand All @@ -19,7 +21,9 @@ jobs:
# - [actions skip]

test:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'jaeyson/open_api_typesense' }}
runs-on: ubuntu-latest
environment: review

env:
MIX_ENV: test
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci_v27.0.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: CI v27.0

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# Workflows that would otherwise be triggered using `on: push` or
Expand All @@ -19,7 +21,9 @@ jobs:
# - [actions skip]

test:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'jaeyson/open_api_typesense' }}
runs-on: ubuntu-latest
environment: review

env:
MIX_ENV: test
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci_v27.1.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: CI v27.1

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# Workflows that would otherwise be triggered using `on: push` or
Expand All @@ -19,7 +21,9 @@ jobs:
# - [actions skip]

test:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'jaeyson/open_api_typesense' }}
runs-on: ubuntu-latest
environment: review

env:
MIX_ENV: test
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/ci_v28.0.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: CI v28.0

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# Workflows that would otherwise be triggered using `on: push` or
Expand All @@ -19,7 +21,9 @@ jobs:
# - [actions skip]

test:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'jaeyson/open_api_typesense' }}
runs-on: ubuntu-latest
environment: review

env:
MIX_ENV: test
Expand All @@ -36,7 +40,7 @@ jobs:
- typesense: '28.0'
otp: '27'
elixir: '1.18'
lint: true
lint: false

services:
typesense:
Expand Down
172 changes: 172 additions & 0 deletions .github/workflows/ci_v29.0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: CI v29.0

on:
workflow_call:
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# Workflows that would otherwise be triggered using `on: push` or
# `on: pull_request` won't be triggered if you add any of the
# following strings to the commit message in a push, or the HEAD
# commit of a pull request:
# - [skip ci]
# - [ci skip]
# - [no ci]
# - [skip actions]
# - [actions skip]

test:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'jaeyson/open_api_typesense' }}
runs-on: ubuntu-latest
environment: review

env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST_TYPESENSE: '29.0'

strategy:
matrix:
include:
- typesense: '29.0'
otp: '25'
elixir: '1.14'
lint: false
- typesense: '29.0'
otp: '28'
elixir: '1.18'
lint: true

services:
typesense:
image: typesense/typesense:${{ matrix.typesense }}

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Check for misspellings
uses: codespell-project/actions-codespell@v2

Check warning on line 55 in .github/workflows/ci_v29.0.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/ci_v29.0.yml#L55

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.

- name: Start Typesense
run: |
docker run -id \
-p 8108:8108 \
--name typesense \
-v /tmp/typesense-data:/data \
-v /tmp/typesense-analytics-data:/analytics-data \
typesense/typesense:${{ matrix.typesense}} \
--api-key xyz \
--data-dir /data \
--enable-search-analytics=true \
--analytics-dir=/analytics-data \
--analytics-flush-interval=60 \
--analytics-minute-rate-limit=100 \
--enable-cors

- name: Wait for Typesense to be healthy
shell: bash
run: |
start_time=$(date +%s)
timeout=30
counter=0
until curl -s http://localhost:8108/health | grep -q '"ok":true'; do
if [ $counter -eq $timeout ]; then
echo "Timed out waiting for Typesense to be healthy"
exit 1
fi
echo "Waiting for Typesense to be healthy..."
sleep 1
counter=$((counter + 1))
done
end_time=$(date +%s)
elapsed=$((end_time - start_time))
echo "Typesense healthcheck elapsed: ${elapsed}s"

- name: Setup Elixir/OTP
uses: erlef/setup-beam@v1

Check warning on line 93 in .github/workflows/ci_v29.0.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/ci_v29.0.yml#L93

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Cache dependencies/builds
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-typesense-${{ matrix.typesense}}-${{ matrix.otp}}-${{ matrix.elixir}}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-typesense-${{ matrix.typesense}}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-

- 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
if: ${{ matrix.lint }}

- name: Check retired dependencies
run: mix hex.audit
if: ${{ matrix.lint }}

- name: Security audit of dependencies
run: mix deps.audit
if: ${{ matrix.lint }}

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

- name: Run static analysis
run: mix credo --all --strict
if: ${{ matrix.lint }}

- name: Check format files
run: mix format --check-formatted
if: ${{ matrix.lint }}

- name: Restore PLT cache
id: plt_cache
uses: actions/cache/restore@v4
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
path: |
priv/plts
if: ${{ matrix.lint }}

- name: Create PLTs
if: ${{ steps.plt_cache.outputs.cache-hit != 'true' && matrix.lint }}
run: mix dialyzer --plt

- name: Save PLT cache
id: plt_cache_save
uses: actions/cache/save@v4
if: ${{ steps.plt_cache.outputs.cache-hit != 'true' && matrix.lint }}
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
path: |
priv/plts

- name: Dialyzer
run: mix dialyzer --format github --format dialyxir
if: ${{ matrix.lint }}

- name: Run tests
run: mix test --only ${{ matrix.typesense }}:true --trace

- name: Post test coverage to Coveralls
run: mix coveralls.github
if: ${{ matrix.lint && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
95 changes: 95 additions & 0 deletions .github/workflows/llm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: LLM
on:
pull_request:
branches: ["main"]

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true

jobs:
ci_workflow:
uses: ./.github/workflows/ci_v29.0.yml
secrets: inherit

llm:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && github.repository == 'jaeyson/open_api_typesense' }}
runs-on: ubuntu-latest
environment: review
needs: [ci_workflow]

env:
MIX_ENV: test

strategy:
matrix:
include:
- typesense: '29.0'
otp: '28'
elixir: '1.18'

services:
typesense:
image: typesense/typesense:${{ matrix.typesense }}

steps:
- name: Start Typesense
run: |
docker run -id \
-p 8108:8108 \
--name typesense \
-v /tmp/typesense-data:/data \
-v /tmp/typesense-analytics-data:/analytics-data \
typesense/typesense:${{ matrix.typesense}} \
--api-key xyz \
--data-dir /data \
--enable-search-analytics=true \
--analytics-dir=/analytics-data \
--analytics-flush-interval=60 \
--analytics-minute-rate-limit=100 \
--enable-cors

- name: Wait for Typesense to be healthy
shell: bash
run: |
start_time=$(date +%s)
timeout=30
counter=0
until curl -s http://localhost:8108/health | grep -q '"ok":true'; do
if [ $counter -eq $timeout ]; then
echo "Timed out waiting for Typesense to be healthy"
exit 1
fi
echo "Waiting for Typesense to be healthy..."
sleep 1
counter=$((counter + 1))
done
end_time=$(date +%s)
elapsed=$((end_time - start_time))
echo "Typesense healthcheck elapsed: ${elapsed}s"

- name: Checkout repo
uses: actions/checkout@v5

- name: Setup Elixir/OTP
uses: erlef/setup-beam@v1

Check warning on line 75 in .github/workflows/llm.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/llm.yml#L75

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Cache typesense-data
uses: actions/cache@v4
with:
path: |
typesense-data
key: ${{ runner.os }}-typesense-data
restore-keys: |
${{ runner.os }}-typesense-data

- name: Test natural language search
run: mix test --only nls:true --trace
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}

- name: Post test coverage to Coveralls
run: mix coveralls.github
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ open_api_typesense-*.tar
.elixir_ls
**.DS_Store

*.env

/priv/plts/*.plt
/priv/plts/*.plt.hash
Loading
Loading