fredwu/crawler
À propos
Un crawler/scraper web haute performance en Elixir.
Données et analyseWhat you can do
- Crawl pages and, optionally, their scripts, stylesheets, and images, including references found in CSS, JavaScript, import maps, source maps, preloads, and speculation rules.
- Honour robots.txt, nofollow, meta robots, and X-Robots-Tag, and crawl the sitemaps and RSS/Atom feeds that a site lists.
- Save a complete offline copy as an atomically published managed archive, or save one file as a standalone snapshot.
- Hook into scraping, parsing, URL filtering, retries, and request construction with your own modules.
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalCrawler
A high performance web crawler / scraper in Elixir, with worker pooling and rate limiting via OPQ.
Features
- Crawl pages and, optionally, their scripts, stylesheets, and images, including references found in CSS, JavaScript, import maps, source maps, preloads, and speculation rules.
- Honour
robots.txt,nofollow, meta robots, andX-Robots-Tag, and crawl the sitemaps and RSS/Atom feeds that a site lists. - Save a complete offline copy as an atomically published managed archive, or save one file as a standalone snapshot.
- Hook into scraping, parsing, URL filtering, retries, and request construction with your own modules.
- Keep ordinary links on the seed site, limit the crawl depth and page count, and limit concurrency and rate.
- Keep cookies per crawl with browser SameSite, prefix, and partition rules, and drop caller credentials when a request leaves the seed origin.
- Retry transient failures with exponential backoff and
Retry-After. - Decode text responses to UTF-8 from their BOM, HTTP charset, or document declaration.
- Bound every crawl by memory, work, and time limits, and report run and archive status.
- Pause, resume, and stop a crawl, and share one queue between crawls.
See Hex documentation.
Architecture
flowchart TD
app(["Your application"])
handler["<b>Crawler.QueueHandler</b><br/>admits URLs"]
modifier{{"Modifier"}}
store[("<b>Crawler.Store</b><br/>frontier, limits, status")]
queue["<b>Crawler.Queue</b> (OPQ)<br/>worker pool, rate limit"]
worker["<b>Crawler.Worker</b><br/>checks out one job"]
fetcher["<b>Crawler.Fetcher</b><br/>robots.txt, decoding"]
filter{{"URL filter"}}
retrier{{"Retrier"}}
http["<b>Crawler.HTTP</b> (Req)<br/>redirects, cookies"]
web(["Web"])
pages[("<b>Crawler.Store.DB</b><br/>page table")]
custom{{":store module"}}
parser{{"Parser<br/>finds links with Crawler.Analysis"}}
scraper{{"Scraper"}}
export["<b>Crawler.Export</b><br/>rewrites links"]
archive(["Offline archive"])
app -->|"Crawler.crawl/2"| handler
handler --- modifier
handler -->|"prepared request"| store
store -->|"ticket"| queue
queue --> worker
worker --> fetcher
fetcher --- filter
fetcher --- retrier
fetcher --> http
http <--> web
fetcher -->|"page"| parser
fetcher -->|"page"| pages
fetcher -.-> custom
parser --> scraper
parser -.->|"linked URLs"| handler
parser -.->|":save_to"| export
export --> archive
classDef hook fill:#fff3d6,stroke:#b7791f,color:#3d2a00
classDef core fill:#e3edfb,stroke:#3b6fb6,color:#10233f
classDef io fill:#e4f4e8,stroke:#3a8a52,color:#12331d
class modifier,filter,retrier,parser,scraper,custom hook
class handler,store,queue,worker,fetcher,http,pages,export core
class app,web,archive io
Yellow hexagons are modules that you can replace: see Custom modules, and :store under Options. Dotted lines are steps that not every page has.
Crawler.QueueHandleradmits each crawl intoCrawler.Store, which holds the bounded frontier, run authority, retained-memory accounting, the page table (Crawler.Store.DB, an ETS table), and export status.Crawler.Queueowns the OPQ queue that a crawl starts, with its workers and rate limiter. EachCrawler.Workerchecks out a job from the Store, then fetches and parses it.Crawler.Fetcherapplies the URL filter, robots rules, and retries.Crawler.HTTPprepares each request once and checks each redirect before Req follows it.Crawler.Parserdiscovers links throughCrawler.Analysis, which holds the source facts and reference occurrences that discovery and rewriting share. It then calls the scraper.- With
:save_to, the parser stages each page for the export. When the crawl settles, the export renders local links and publishes the archive atomically throughCrawler.Export.Filesystem.Crawler.Snapperpublishes standalone files through the same boundary.
Usage
url = "https://elixir-lang.org"
{:ok, opts} = Crawler.crawl(url, max_depths: 2, store: Crawler.Store)
Crawling is asynchronous. Keep the returned opts: the other API calls take them. Poll Crawler.running?(opts) until it returns false, then read a processed page:
page = Crawler.Store.find_processed({url, opts[:scope]})
This returns nil when the page was not processed. With the default store: nil, the page table records each URL but not its body or options. Set store: Crawler.Store to keep bodies, use a custom scraper or parser, or set :save_to to create a managed archive.
Crawler.running?/1 reports inactivity, not success: a paused crawl also reports false. For the outcome, call Crawler.run_status(opts). It returns {:ok, status} with :state, :root_status, :reported_limit, :reason, :running?, :paused?, :terminal?, :pending, and :inflight, or {:error, :stale} for options of a stopped or replaced run. :state is :running or :paused while work is active, then the root outcome (:succeeded, :failed, :rejected, or :cancelled), or :limited when the run reached a limit. Root success does not mean that every linked page succeeded.
Page identity follows the browser: equivalent spellings of a host or an escaped path share one page, and the fragment is not part of it. http and https, userinfo, and an encoded slash stay separate pages. When an allowed redirect lands on another URL, the page is stored under both URLs.
Options
Pass options to Crawler.crawl/2, or set application defaults under config :crawler.
| Option | Default | Meaning |
|---|---|---|
:assets |
[] |
Asset types to fetch: "css", "js", "images". |
:javascript_goal |
:module |
Source goal for a direct JavaScript crawl. Use :script for a classic script. HTML script references select their goal from their script type. |
:save_to |
nil |
Fresh destination for a managed archive. |
:workers |
10 |
Maximum concurrent workers. |
:interval |
0 |
Milliseconds between dispatches; 0 is no rate limit. |
:max_depths |
3 |
Maximum nested depth of pages to crawl. |
:max_pages |
:infinity |
Maximum number of pages in the scope. |
:timeout |
5_000 |
HTTP receive timeout in milliseconds, or :infinity. This is not a deadline for the whole fetch; see :attempt_timeout. |
:retries |
2 |
Extra attempts after a transient failure. See Retrier. |
:retry_base_delay |
1_000 |
Base backoff in milliseconds for the default retrier. |
:store |
nil |
Crawler.Store to keep page bodies, or your module that implements add_page_data/3 (see Crawler.Store.add_page_data/3). |
:force |
false |
Reset the scope before a root crawl: remove its pages and counters and start a new run deadline. |
:scope |
unique per crawl | Seen URLs and :max_pages belong to one scope. Pass the same scope to share them between crawls. |
:user_agent |
"Crawler/<version> (https://github.com/fredwu/crawler)" |
User-Agent header. Its product token selects the robots.txt group. |
:respect_robots |
true |
Honour robots.txt, nofollow, meta robots, and X-Robots-Tag. See Robots. |
:max_body |
10_485_760 |
Maximum decoded response size in bytes. A larger response is discarded and is not retried. |
:url_filter |
Crawler.Fetcher.UrlFilter |
URL filter module. See URL filter. |
:retrier |
Crawler.Fetcher.Retrier |
Retry policy module. See Retrier. |
:modifier |
Crawler.Fetcher.Modifier |
Request header and option module. See Modifier. |
:req_options |
[] |
Advanced Req request options. Req retry options are ignored. |
:scraper |
Crawler.Scraper |
Scraper module, called with each parsed page. |
:parser |
Crawler.Parser |
Parser module. |
:encode_uri |
false |
Apply URI.encode/1 to the URL before crawling. |
:queue |
nil |
An OPQ pid or registered name to share a queue. See Multiple crawlers. |
Invalid options raise ArgumentError. :workers must be a positive integer. :max_depths, :interval, :retries, and :retry_base_delay must be non-negative integers. :max_pages and :timeout accept a non-negative integer or :infinity. :max_body must be a non-negative integer.
Limits and deadlines
Each crawl is bounded. These are per-crawl options too, with the same application defaults. Each value must be a positive integer.
| Option | Default | Meaning |
|---|---|---|
:attempt_timeout |
30_000 |
Deadline in milliseconds for one fetch attempt, including redirects, retry waits, decoding, and analysis. |
:run_timeout |
600_000 |
Deadline in milliseconds for the whole run. Pausing does not extend it. |
:robots_failure_ttl |
60_000 |
Milliseconds that a failed robots.txt fetch disallows its origin. |
:max_pending |
5_000 |
Admitted jobs that wait to run. |
:max_frontier_bytes |
16_777_216 |
Bytes that waiting jobs keep. |
:max_representations |
10_000 |
Distinct effective requests (URL plus credentials and headers). |
:max_interpretations |
20_000 |
Jobs that the run keeps, one for each URL and interpretation context (script goal or stylesheet context). |
:max_retained_bytes |
67_108_864 |
Memory the run keeps for responses, analysis, and archive bookkeeping. Also reported for a page whose analysis has more than 2,000,000 terms. A page of 5,000 plain links fits the default limits. |
:max_queue_tickets |
32 |
Outstanding Crawler notifications on one queue. |
:max_tracked_queues |
1_024 |
Queues that Crawler tracks at once. |
:max_control_documents |
128 |
robots.txt and sitemap documents. |
:max_control_bytes |
33_554_432 |
Total bytes of those documents. |
:max_control_depth |
16 |
Nested sitemap index depth. |
:max_control_entries |
50_000 |
Entries in one control document. |
:max_control_token_bytes |
65_536 |
Bytes of one token or address in a control document. |
:max_analysis_bytes |
41_943_040 |
Memory budget to analyze one document, and the maximum size of its rewritten output. |
:max_analysis_regions |
100_000 |
Source regions in one document. |
:max_analysis_depth |
16 |
Nesting depth of source regions. |
:max_analysis_facts |
200_000 |
Source facts in one document. |
:max_analysis_occurrences |
100_000 |
References in one document. |
:max_analysis_edits |
100_000 |
Reference rewrites in one document. |
:max_xml_depth |
256 |
XML element depth. |
:max_xml_tokens |
100_000 |
XML tokens. |
:max_xml_attributes |
1_024 |
Attributes on one XML element. |
:max_css_work |
100_000 |
CSS graph work for one stylesheet group. |
:max_css_pictures |
10_000 |
Resolved CSS images in one stylesheet group. |
:max_css_depth |
256 |
CSS graph depth. |
:max_manifest_bytes |
16_777_216 |
Archive manifest bookkeeping, about 3 KB for a small page. |
:max_artifacts |
10_000 |
Files in an archive. |
:max_edges |
100_000 |
References between archive files. |
:max_staged_bytes |
1_073_741_824 |
Disk bytes that an archive stages. A page counts twice: its source and its output. |
:max_staged_metadata_bytes |
134_217_728 |
Disk bytes of staged archive metadata. |
:max_file_bytes |
33_554_432 |
Bytes of one staged archive file. |
:max_files |
20_000 |
Staged archive files. A page has three: its source, its analysis, and its output. |
:max_fs_entries |
40_000 |
Entries in the archive filesystem journal. |
:max_fs_journal_bytes |
8_388_608 |
Bytes of the archive filesystem journal. |
:max_cookies |
3_000 |
Cookies in the scope jar. The oldest cookie is evicted first. |
:max_cookies_per_site |
180 |
Cookies for one registrable site. |
:max_cookie_bytes |
4_096 |
Bytes of one Set-Cookie value. A larger value is rejected. |
:max_cookie_jar_bytes |
1_048_576 |
Total bytes in the jar. |
:max_cookie_updates |
256 |
Set-Cookie values read from one response. |
A crawl that reaches a limit stops that work with {:error, {:limit, key}}. A passed deadline gives {:error, {:deadline, :attempt}} or {:error, {:deadline, :run}}. Crawler.crawl/2 can return these errors at admission; later work reports them through Crawler.run_status/1 and Crawler.export_status/1. The default retrier does not retry them.
All crawls share one retained-memory budget of 64 MiB in Crawler.Store. A crawl's :max_retained_bytes limits that crawl inside the shared budget and cannot enlarge it. A response stays in memory after its work for as long as there is room, so that another reference to it can use it. Without room, the response that was used the longest time ago goes first. A later reference then reads it from the archive that the crawl saves, or requests it again. What a :store keeps stays. Work that needs memory while other work holds it waits within its deadline. When all of it waits, jobs that have not stored a page yet give way to the oldest, and run again later within the same attempt. That can repeat a request, but not one whose response set a cookie. The queue-ticket service reads :max_queue_tickets and :max_tracked_queues from the application environment when it starts; a crawl can lower these values but not raise them.
A response body is funded as it arrives with a streaming adapter, such as the default Finch adapter. An adapter that delivers the whole body at once, such as Req.Test or a custom :adapter in :req_options, has :max_body bytes reserved before each request. About five such requests run at once under the default limits, and the others wait; a lower :max_body lets more run.
Managed archives
Set :save_to to save a complete offline copy of the crawl. Links between saved files are rewritten to local paths. A reference to a file that was not saved keeps its online URL, without userinfo. So does a CSS custom property whose relative URL is a different picture for each stylesheet that uses it, since no one path is right for all of them: the pictures are saved, and the property's reference in manifest.json has no target.
{:ok, opts} = Crawler.crawl(url, save_to: "/Users/me/archives/elixir-2026-11-29")
Path policy:
- The destination must not exist; use a new destination for each export. Existing destinations and symlinks are refused.
- Its parent must be an existing directory that you own and that is not group- or other-writable.
- Every ancestor must be a real directory owned by you or by root. A shared writable ancestor needs the sticky bit, and a symlinked ancestor is refused. On macOS,
/tmpand/varare symlinks, so pass the physical path, for example fromSystem.cmd("pwd", ["-P"], cd: System.tmp_dir!()).
Every directory of the staged and published archive has mode 0700, so only your user can list or enter it; files keep your umask. Change the modes after publication if others need access.
Archive file names come from opaque IDs and the response content type, not from the URL, so host names, queries, and userinfo do not appear in paths. Raw bodies and query values can still contain secrets; Crawler does not sanitize content.
Publication is atomic against process and VM failure: the archive is either absent or complete. It is not durable against power loss, because no file is fsynced.
Read the outcome with Crawler.export_status(opts). It returns {:ok, nil} for a run without an export, {:ok, status} for an export, or {:error, :stale} for options of a stopped or replaced run. status.state is :admitting, :paused, :finalizing, :ready, :failed, :limited, or :cancelled. The status also has :reason, :ready?, :running?, :paused?, :reported_limit, and bounded manifest counts. Use the files only when the state is :ready; Crawler.running?/1 returning false does not mean that the archive is ready. An archive is published only when no limit stopped part of the crawl: otherwise the crawl finishes, the state is :limited, and :reason is the first such limit or deadline. Only :max_pages and :max_body leave out pages without this, because they are the caller's choice of pages. A page that its server or a filter refused, for example with a 404, is missing without this too, so the archive can be empty. When no page was stored and one failed, by a server error or an internal one, the state is :failed and :reason is {:snapshot, :no_page}. A cleanup failure after publication reports :failed with {:snapshot, :cleanup_failed} and keeps the complete archive.
Standalone snapshots
Crawler.Snapper.snap/2 saves one file under an existing root that follows the same path policy. Supply an opaque :public_id of 24 to 64 lowercase ASCII letters or digits. Use a random ID for each response or interpretation variant, and do not derive it from credentials.
{:ok, artifact} =
Crawler.Snapper.snap(decoded_html, %{
url: "https://example.test/page",
content_type: "text/html",
save_to: existing_root,
public_id: "0123456789abcdef01234567"
})
# artifact == %{public_id: "0123456789abcdef01234567",
# path: "resources/0123456789abcdef01234567.html"}
File.read!(Path.join(existing_root, artifact.path))
- Text input must already be decoded UTF-8. Decode raw response bytes with
Crawler.Charset.decode/2. Binary bodies keep their bytes. - The response content type selects the suffix, for example
.html,.css,.docx, or.binfor an unknown type. HTML gets one UTF-8 byte-order mark; XHTML does not. - References keep their resolved online URLs, without userinfo.
- Reusing an ID and content type replaces that file. Concurrent writers can receive
:destination_owned. - Filesystem errors return
{:error, {:snapshot, operation, reason}}. Analysis errors pass through unchanged. A managed crawl gets{:error, {:snapshot, :managed_export_required}}and must use:save_to.
To resolve a URL without saving, use Crawler.Linker.url/2. To rewrite references yourself, keep the occurrence collection from Crawler.Analysis.occurrences_result/2 through Crawler.Analysis.bind/2 and Crawler.Analysis.render/4.
Crawl policy
Robots
With respect_robots: true (the default), Crawler reads robots.txt once per origin and scope. A missing file (a 4xx response) allows the crawl. A server error or a transport failure disallows that origin for :robots_failure_ttl milliseconds; the next check after that requests the file again. A redirect to a disallowed URL is refused. Crawler crawls the sitemaps that the seed site's robots.txt lists, including sitemap indexes, text lists, and RSS/Atom feeds; a sitemap file does not use a page slot. respect_robots: false skips these checks and does not request robots.txt.
Responses
The response media type decides how Crawler reads it: a stylesheet only when the response is CSS, a script only when it is JavaScript, and HTML only when the response says so. A missing content type is not HTML. Gzip and deflate bodies are decoded, up to :max_body. Text is decoded to UTF-8 before parsing and saving.
Cookies and credentials
Each scope has its own cookie jar. Cookies follow browser rules: SameSite (Lax when absent), Secure, the __Host- and __Secure- prefixes, Partitioned, and the credentials mode of each request (for example from crossorigin). Each redirect hop rebuilds Cookie from the live jar. Resetting the scope clears its jar.
Caller Authorization, other custom headers, and the caller Cookie are sent only while the scheme, host, and effective port match the seed origin. An HTTPS-to-HTTP redirect or a port change drops them for the rest of the redirect chain, the same as another host. Crawler does not set Req's :redirect_trusted, and setting it does not widen this policy.
Crawler.cookie_outcome(opts) returns {:ok, nil} before the first cookie save, {:ok, outcome} for the latest save, or {:error, :stale}. The redacted outcome has :status (:ok or :limited), :processed, :expired, :evicted, :rejected, :unprocessed?, and :limits, and no cookie values or domains.
Redirects
Req follows up to five redirects. Each target must pass the crawl's URL filter and robots rules before it is fetched. Use req_options: [redirect: false] to return redirect responses instead. The :follow_redirects option raises ArgumentError; use :redirect.
Custom modules
The :url_filter, :retrier, :modifier, :scraper, and :parser options take a module that implements the matching behaviour.
URL filter
See Crawler.Fetcher.UrlFilter.
defmodule CustomUrlFilter do
@behaviour Crawler.Fetcher.UrlFilter.Spec
@impl true
def filter(url, _opts), do: {:ok, String.starts_with?(url, "https://elixir-lang.org/")}
end
Return {:ok, true} to allow the URL, {:ok, false} to reject it, or {:error, reason} when filtering fails. An error for the initial URL is returned unchanged, without a request. A redirect target is followed only on {:ok, true}.
The default filter keeps links, image maps, and meta refresh on the seed site: one leading www label is ignored, and http on port 80 matches https on port 443. Scripts, stylesheets, images, and fonts can come from another host, such as a CDN.
Retrier
See Crawler.Fetcher.Retrier.
defmodule CustomRetrier do
@behaviour Crawler.Fetcher.Retrier.Spec
@impl true
def perform(fetch_url, _opts), do: fetch_url.()
end
One retry policy covers pages and sitemaps. The fetch function returns {:error, %Crawler.Fetcher.Retryable{}} for a transport error or a 408, 429, or 5xx response; every other result is final. The struct carries the response :status and its Retry-After delay in milliseconds (:retry_after).
The default retrier makes up to :retries extra attempts. It waits for Retry-After when the response sends it. Otherwise it waits :retry_base_delay * 2^n milliseconds, capped at 30 seconds, with jitter over the upper half. When the wait cannot end before the attempt and run deadlines, the fetch fails at once. Callback and programming exceptions propagate without a retry.
A custom retrier replaces this policy. It can return the Retryable result unchanged; the fetcher reports it as {:error, reason}. Req's own retry options (:retry, :max_retries, :retry_delay, :retry_log_level) are removed from every request.
Modifier
See Crawler.Fetcher.Modifier.
defmodule CustomModifier do
@behaviour Crawler.Fetcher.Modifier.Spec
@impl true
def headers(_opts), do: [{"accept-language", "en"}]
@impl true
def opts(_opts), do: [connect_options: [timeout: 1_000]]
end
headers/1 returns request headers and opts/1 returns Req request options. Crawler applies Req application defaults, its own fetch settings (receive timeout and User-Agent), modifier headers, modifier options, and :req_options, in that order. Header names merge case-insensitively, and later values win. The credential policy runs after all of them, so a modifier cannot restore credentials that the policy removed.
Scraper
See Crawler.Scraper.
defmodule CustomScraper do
@behaviour Crawler.Scraper.Spec
@impl true
def scrape(%Crawler.Store.Page{url: url} = page) do
IO.puts("Scraped #{url}")
{:ok, page}
end
end
Parser
See Crawler.Parser.
defmodule CustomParser do
@behaviour Crawler.Parser.Spec
@impl true
def parse(%Crawler.Store.Page{} = page), do: Crawler.Parser.parse(page)
def parse(_failure), do: :ok
end
parse/1 receives each fetched page, or the error when a fetch does not produce a page. The default parser discovers links, sends them to Crawler.Dispatcher, and then calls the scraper. A custom parser can call Crawler.Parser.parse_links/3 with its own link handler.
Pause, resume, and stop
{:ok, opts} = Crawler.crawl("https://elixir-lang.org")
Crawler.running?(opts) # => true
Crawler.pause(opts)
Crawler.running?(opts) # => false
Crawler.resume(opts)
Crawler.running?(opts) # => true
Crawler.stop(opts)
Crawler.running?(opts) # => false
Pausing stops queue dispatch. Requests that have already started can still finish. Pausing does not extend the run deadline.
Crawler.stop/1 drops the scope's URLs, counters, and in-flight page slots. When the crawl started its own queue, stop/1 also shuts down that queue, its workers, and its rate limiter. Pass the options returned by Crawler.crawl/2. A crawl that finishes on its own keeps the pages stored with :store.
A failed URL is fetched once per crawl. After the crawl is idle, a later Crawler.crawl/2 in the same scope can fetch it again without :force.
If Crawler.Store restarts, the queues that Crawler started stop; start a new crawl. A queue that you created keeps running, but its old jobs cannot change the new state.
Multiple crawlers
Crawls can share one queue:
{:ok, queue} = OPQ.init(worker: Crawler.Dispatcher.Worker, workers: 2)
Crawler.crawl("https://elixir-lang.org", queue: queue)
Crawler.crawl("https://github.com", queue: queue)
Crawler.stop/1 does not stop a queue that you created. If that queue has stopped, Crawler.crawl/2 does not run the crawl. An unavailable named queue returns {:error, {:queue_unavailable, name}}.
To share a queue that Crawler started, pass queue: opts[:queue] from the crawl that created it. Stopping that crawl shuts the queue down, and the other crawls on it stop making progress; their stored pages stay readable.
Find all scraped URLs
Crawler.Store.all_urls() # => ["https://elixir-lang.org", "https://google.com", ...]
Examples
Google Search + Github
This example performs a Google search, then scrapes the results to find Github projects and output their name and description. It accepts HTTPS URLs on the exact Google Search and GitHub hosts and rejects URL credentials.
See the source code.
You can run the example by cloning the repo and run the command:
mix run -e "Crawler.Example.GoogleSearch.run()"
API reference
Please see https://hexdocs.pm/crawler.
Development
Use the Erlang and Elixir versions in .tool-versions (OTP 26.1.1 and Elixir 1.17.3). The project requires Elixir 1.17 or later. If your shell selects another runtime, prefix each command with mise exec --. Install dependencies with mix deps.get.
Run the same checks as CI, in this order:
mix format --check-formatted
mix recode --dry --force --no-color
mix compile --force --warnings-as-errors
MIX_ENV=test mix compile --force --warnings-as-errors
mix docs --warnings-as-errors
mix dialyzer
MIX_ENV=test mix test
for seed in {1..10}; do
MIX_ENV=test mix test --warnings-as-errors --seed "$seed" || exit 1
done
CI runs the quality job (format, Recode, both compiles, tests, and docs) on every push and pull request. The long job (Dialyzer and the ten seeded suites) runs only on its weekly schedule and on manual workflow dispatch. If a seeded run fails, reproduce it with its seed, fix the cause, and run all ten again.
Tests use Req.Test through Crawler.ReqTestSite, so the suite does not need live websites. Use Crawler.TestCase for HTTP fixtures, start_crawl/2 to start a crawl that is cleaned up after the test, await_idle/1 before you check final crawl results, a unique scope for independent crawl state, and distinct temporary paths for saved files.
Changelog
Please see CHANGELOG.md.
Copyright and License
Copyright (c) 2016 Fred Wu
This work is free. You can redistribute it and/or modify it under the terms of the MIT License.
Maintained by Fred Wu — maker of Hourbun, simple time tracking and invoicing for freelancers and dev teams.
Explorer des projets similaires
Chargement…