mirror of
https://github.com/benbusby/farside.git
synced 2025-03-14 19:26:30 -04:00
Skip querying all instances w/ "test mode"
Now allows setting FARSIDE_TEST to skip individually fetching each instance, and instead just adds all of them to redis instantly. This allows for an easier time in CI builds, for both the sake of speed and to prevent a scenario where many simultaneous builds have a noticeable impact on actual instances.
This commit is contained in:
parent
1908c56ec6
commit
39c244d970
10
.github/workflows/elixir.yml
vendored
10
.github/workflows/elixir.yml
vendored
@ -14,18 +14,28 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Elixir
|
||||
uses: erlef/setup-elixir@885971a72ed1f9240973bd92ab57af8c1aa68f24
|
||||
with:
|
||||
elixir-version: '1.10.3'
|
||||
otp-version: '22.3'
|
||||
|
||||
- name: Restore dependencies cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: deps
|
||||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
||||
restore-keys: ${{ runner.os }}-mix-
|
||||
|
||||
- name: Start Redis
|
||||
uses: supercharge/redis-github-action@1.2.0
|
||||
|
||||
- name: Install dependencies
|
||||
run: mix deps.get
|
||||
|
||||
- name: Initialize services
|
||||
run: FARSIDE_TEST=1 mix run update.exs
|
||||
|
||||
- name: Run tests
|
||||
run: mix test
|
||||
|
15
update.exs
15
update.exs
@ -19,12 +19,17 @@ defmodule Instances do
|
||||
end
|
||||
|
||||
def request(url) do
|
||||
case HTTPoison.get(url) do
|
||||
{:ok, %HTTPoison.Response{status_code: 200}} ->
|
||||
# TODO: Add validation of results, not just status code
|
||||
cond do
|
||||
System.get_env("FARSIDE_TEST") ->
|
||||
:good
|
||||
_ ->
|
||||
:bad
|
||||
true ->
|
||||
case HTTPoison.get(url) do
|
||||
{:ok, %HTTPoison.Response{status_code: 200}} ->
|
||||
# TODO: Add validation of results, not just status code
|
||||
:good
|
||||
_ ->
|
||||
:bad
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user