Skip to content

Commit

Permalink
Set up the Meilisearch server for testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
waybackarchiver committed Jul 19, 2022
1 parent 6cc1680 commit 70de07b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ jobs:
with:
chrome-version: stable

- name: Set up Meilisearch
if: matrix.os == 'ubuntu-latest'
uses: moy2010/meilisearch-github-action@fcc5ef714af0596633665032d459bfb279d3c730 # 0.1.4
with:
meilisearch-version: v0.28.0
meilisearch-port: 7700
meilisearch-api-key: foobar

- name: Set up Chocolatey
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@e80bd39bb49cae70b67ea53d52d00833a7255c21 # v1.7.0
Expand Down Expand Up @@ -122,6 +130,16 @@ jobs:
# echo "$(which ffmpeg)" >> $GITHUB_PATH
# echo "$(which wget)" >> $GITHUB_PATH
- name: Set environments for Meilisearch
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
# Set env to enable reduxer
echo "WAYBACK_MEILI_ENDPOINT=http://localhost:7700" >> $GITHUB_ENV
echo "PLAYBACK_MEILI_ENDPOINT=http://localhost:7700" >> $GITHUB_ENV
echo "WAYBACK_MEILI_APIKEY=foobar" >> $GITHUB_ENV
echo "PLAYBACK_MEILI_APIKEY=foobar" >> $GITHUB_ENV
- name: Check out code base
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
Expand Down
10 changes: 10 additions & 0 deletions service/mastodon/mastodon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/wabarc/helper"
"github.com/wabarc/wayback/config"
"github.com/wabarc/wayback/pooling"
"github.com/wabarc/wayback/service"
"github.com/wabarc/wayback/storage"
)

Expand Down Expand Up @@ -124,6 +125,15 @@ func TestPlayback(t *testing.T) {
if config.Opts, err = parser.ParseEnvironmentVariables(); err != nil {
t.Fatalf("Parse environment variables or flags failed, error: %v", err)
}
if config.Opts.EnabledMeilisearch() {
endpoint := config.Opts.WaybackMeiliEndpoint()
indexing := config.Opts.WaybackMeiliIndexing()
apikey := config.Opts.WaybackMeiliApikey()
meili := service.NewMeili(endpoint, apikey, indexing)
if err := meili.Setup(); err != nil {
t.Errorf("setup meilisearch failed: %v", err)
}
}

ctx := context.Background()
pool := pooling.New(ctx, config.Opts.PoolingSize())
Expand Down
10 changes: 10 additions & 0 deletions service/telegram/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/wabarc/helper"
"github.com/wabarc/wayback/config"
"github.com/wabarc/wayback/pooling"
"github.com/wabarc/wayback/service"
"github.com/wabarc/wayback/storage"
telegram "gopkg.in/telebot.v3"
)
Expand Down Expand Up @@ -328,6 +329,15 @@ func TestPlayback(t *testing.T) {
if config.Opts, err = parser.ParseEnvironmentVariables(); err != nil {
t.Fatalf("Parse environment variables or flags failed, error: %v", err)
}
if config.Opts.EnabledMeilisearch() {
endpoint := config.Opts.WaybackMeiliEndpoint()
indexing := config.Opts.WaybackMeiliIndexing()
apikey := config.Opts.WaybackMeiliApikey()
meili := service.NewMeili(endpoint, apikey, indexing)
if err := meili.Setup(); err != nil {
t.Errorf("setup meilisearch failed: %v", err)
}
}

getUpdatesJSON = `{
"ok": true,
Expand Down

0 comments on commit 70de07b

Please sign in to comment.