# Running E2E Tests with the Typesense Github Action

GitHub Actions provides powerful automation which enables you to setup your continuous integration and continuous deployment pipelines; you can use it to run tests in your codebase, build images and deploy workloads to different environments.

# Use Typesense in GitHub Actions

When using Typesense you might want to run end-to-end tests -- these are test that run with real instances of your application's dependencies and not against mocks. Running your tests against an actual Typesense instance increases the confidence in your code and the contract between your app and Typesense. Adding Typesense to a GitHub Action is pretty straightforward.

There is a GitHub Action providing a Typesense server. You can find it in the GitHub marketplace at jirevwe/typesense-github-action (opens new window) and install it from there.

You can configure the Typesense server in your workflow YAML file. Depending on your needs, you may configre it to run on a different port or you may make run your tests against a matrix of multiple Typesense versions.

Here’s a sample configuration using the jirevwe/typesense-github-action (opens new window) package to add Typesense to your GitHub Actions:

name: Run tests

on: [push]

    runs-on: ubuntu-latest
        typesense-version: [0.22.0, 0.23.1]

      - name: Start Typesense
        uses: jirevwe/typesense-github-action@v1.0.1
          typesense-version: ${{ matrix.typesense-version }}
          typesense-port: 20863

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

This workflow setup runs your action's steps against each version of Typesense specfied in the typesense-version list. This allows you run your tests against mutiple versions of Typesense. One usecase of running your tests against multiple versions is if you want to be sure that updating your Typesense self-hosted or cloud version won't break your app's functionality.

There's a full example of how this works here (opens new window).

And that's it! As we saw above, Typesense is easy to set up and simple to use. You can use it with your apps to create fast, typo-tolerant search interfaces. And with this package you can easily test your Typesense integration. If you face any difficulties with Typesense or would like to see any new features added, head over to our GitHub repo (opens new window) and create an issue.

Last Updated: 11/22/2022, 5:42:22 PM