# Create initial workflow based on GitHub's suggestion for Elixir. | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
MIX_ENV: test | |
jobs: | |
test: | |
name: Test codebase | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: pgvector/pgvector:pg16 | |
env: | |
POSTGRES_USERNAME: postgres | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install ffmpeg | |
run: sudo apt-get install ffmpeg | |
# - name: Download Bumblebee model artifacts | |
# uses: actions/download-artifacts | |
# with: | |
# name: bumblebee-cache | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: '1.16.0' | |
otp-version: '26.0' | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Print out Bumblebee cache directory | |
run: elixir -e 'IO.puts(:filename.basedir(:user_cache, "bumblebee"))' | |
- name: Cache Bumblebee model files | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/.cache/bumblebee | |
key: ${{ runner.os }}-bumblebee-${{ hashFiles('**/application.ex') }} | |
restore-keys: ${{ runner.os }}-bumblebee- | |
- name: Run tests | |
env: | |
DATABASE_URL: postgresql://postgres:postgres@localhost/medical_transcription_test | |
run: mix test | |
# - name: Upload Bumblebee model artifacts | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: bumblebee-cache | |
# path: $HOME/.cache/bumblebee | |