Skip to content

Commit c18fd3d

Browse files
authored
Adds Circle CI
There was a lot of churn in getting the build setup. I'm squashing it because none of it makes sense alone except for some README updates. * Adds dev deps to README In order to run tests we need imagemagick so I added to the dev instructions to add imagemagick to the system. * Add a CircleCI build We want to have an automated build to run tests. * Adds CircleCI badge It is always nice to let people know our build status. * Fix circle file format We can't nest under version. The error message said something about not being able to map values so it wasn't clear what was wrong. * Fixes installing of libturbojpeg for the build We need to do an apt-get update before we can install libturbojpeg. If we don't do that then apt-get can't find it. * Fixes Ubuntu package name for libturbojpeg * Stops apt-get prompts on the build The build hangs when installing deps with apt-get because apt-get want to ask if you really want to install. Adding a `-y` switch should do the trick. * Requires git for circle ci Right now we have a dependency on mogrify from Connor's fork. Once his PR is merged we will no longer need git to be installed and can update the dependency. NOTE: This dependency is for testing only * Fixes 404s in circle ci setup Apt-get was getting 404s the recommended course of action was apt-get update. * Changes libturbojpeg ubuntu install We need the dev package of libturbojpeg in order to build. * Installs all the libturbojpeg packages I can find This is getting frustrating, but it appears that the build and my local install are doing different things and I can't figure it out at this moment. * Attempting different jpeg install for ubuntu I can't seem to find the right one, but apt-get search came up with this so I'm trying it. * Use latest Elixir builder We believe the libturbojpeg0-dev package should be there. * Updates the deps There is an error in the version of Shmex and Bundlex we were using that presented itself in elixir 1.10. Updating it fixes the issue. * Adds libturbojpeg We need the dev package and the normal one to build. * Add pkg-config for ci This is needed to build schmex * Changes build's MIX_ENV to test The build was set to prod which wouldn't install propcheck. Changing it should be able to run the tests. * Removes performance test We never did get the test right, and it was just for local playing any way.
1 parent 01c3e47 commit c18fd3d

File tree

4 files changed

+68
-34
lines changed

4 files changed

+68
-34
lines changed

.circleci/config.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: 2
2+
3+
jobs:
4+
build:
5+
parallelism: 1
6+
docker:
7+
- image: binarynoggin/elixir-release-builder:elixir-1.10
8+
environment:
9+
MIX_ENV: test
10+
11+
working_directory: ~/apps
12+
13+
steps:
14+
- checkout
15+
16+
- run: mix local.hex --force
17+
- run: mix local.rebar --force
18+
- run: apt-get update
19+
- run: apt-get install -y imagemagick git libturbojpeg libturbojpeg0-dev pkg-config
20+
21+
- restore_cache: # restores saved mix cache
22+
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
23+
keys: # list of cache keys, in decreasing specificity
24+
- v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
25+
- v1-mix-cache-{{ .Branch }}
26+
- v1-mix-cache
27+
- restore_cache: # restores saved build cache
28+
keys:
29+
- v1-build-cache-{{ .Branch }}
30+
- v1-build-cache
31+
- run: mix do deps.get, compile # get updated dependencies & compile them
32+
- save_cache: # generate and store mix cache
33+
key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
34+
paths: "deps"
35+
- save_cache: # make another, less specific cache
36+
key: v1-mix-cache-{{ .Branch }}
37+
paths: "deps"
38+
- save_cache: # you should really save one more cache (just in case)
39+
key: v1-mix-cache
40+
paths: "deps"
41+
- save_cache: # don't forget to save a *build* cache, too
42+
key: v1-build-cache-{{ .Branch }}
43+
paths: "_build"
44+
- save_cache: # and one more build cache for good measure
45+
key: v1-build-cache
46+
paths: "_build"
47+
48+
- run: mix test # run all tests in project

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Fast JPEG encoding from raw YUV data using [libjpeg-turbo](https://libjpeg-turbo.org/)
44

5+
[![CircleCI](https://circleci.com/gh/BinaryNoggin/elixir-turbojpeg/tree/master.svg?style=svg)](https://circleci.com/gh/BinaryNoggin/elixir-turbojpeg/tree/master)
6+
57
## Installation
68

79
This library requires libjpeg-turbo to be installed
@@ -12,11 +14,25 @@ This library requires libjpeg-turbo to be installed
1214

1315
### Ubuntu/Debian
1416

15-
sudo apt-get install libturbojpeg0-dev
17+
sudo apt-get install libturbojpeg libturbojpeg0-dev
1618

1719
### OSX
1820

1921
brew install libjpeg-turbo
22+
23+
### Develement Dependencies
24+
25+
### Arch linux
26+
27+
sudo pacman -S imagemagick
28+
29+
### Ubuntu/Debian
30+
31+
sudo apt-get install imagemagick
32+
33+
### OSX
34+
35+
brew install imagemagick
2036

2137
If [available in Hex](https://hex.pm/packages/turbojpeg), the package can be installed
2238
by adding `turbojpeg` to your list of dependencies in `mix.exs`:

mix.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%{
2-
"bunch": {:hex, :bunch, "1.2.0", "f26c6c84e2e5e245620c73a0a4560ca91a75b25744012537e055426568916ab7", [:mix], [], "hexpm", "66c1ea8716a7c03124f3bf62c0b167f7294c4948d1688bd2027dadaa4ec032de"},
2+
"bunch": {:hex, :bunch, "1.3.0", "51b4423088b7fb9e21eae6d6bc5e5d219d955ea5556fbd6130bfb6213df4be32", [:mix], [], "hexpm", "9ad233a2bacc0dae8aa6553a9b9057f27446443b1c5903c3479b6f9f3820ce2d"},
33
"bunch_native": {:hex, :bunch_native, "0.2.1", "0227d2a751a32f8c0b77dfec57c8dc7216351720c9c755c467e6d9387467fd1f", [:mix], [{:bundlex, "~> 0.2.7", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "f0819b2f9f78086447ac7459a8e7b6e25ad535b9d3a4f9469253c552137de6b4"},
4-
"bundlex": {:hex, :bundlex, "0.2.7", "8f46199bf4cf84a60cdfc142edeafbab37040167acc35dda8aa70433f2ff8162", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:secure_random, "~> 0.5", [hex: :secure_random, repo: "hexpm", optional: false]}], "hexpm", "5751b4bb5dd0576ca70519239e2ee7b495b17e4bbfbe3ef1f60ae0c12c0e4fe9"},
4+
"bundlex": {:hex, :bundlex, "0.2.8", "0f4530bf24a2ebb92f2e360111319aae6fc6eb03c6ec5054b529d9ffb78811fa", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:secure_random, "~> 0.5", [hex: :secure_random, repo: "hexpm", optional: false]}], "hexpm", "d583b04ea679297aa08ad2b31866c4848fd99feea036bf5af59df71e2408b096"},
55
"coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"},
66
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.7", "6287f8f2cb45df8584317a4be1075b8c9b8a69de8eeb82b4d9e6c761cf2664cd", [:mix], [{:erlex, ">= 0.2.5", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "506294d6c543e4e5282d4852aead19ace8a35bedeb043f9256a06a6336827122"},
77
"earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"},
@@ -18,6 +18,6 @@
1818
"qex": {:hex, :qex, "0.5.0", "5a3a9becf67d4006377c4c247ffdaaa8ae5b3634a0caadb788dc24d6125068f4", [:mix], [], "hexpm", "4ad6f6421163cd8204509a119a5c9813cbb969cfb8d802a9dc49b968bffbac2a"},
1919
"ratio": {:hex, :ratio, "2.4.0", "bd073c82871ea9d900243bc0b351e5274484ec469f7e91eaa83de6468ae9cdcf", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "3623a323a29b7a2b51914efe3a612cca812bd354f1dd2ffc4ac62058b72447e8"},
2020
"secure_random": {:hex, :secure_random, "0.5.1", "c5532b37c89d175c328f5196a0c2a5680b15ebce3e654da37129a9fe40ebf51b", [:mix], [], "hexpm", "1b9754f15e3940a143baafd19da12293f100044df69ea12db5d72878312ae6ab"},
21-
"shmex": {:hex, :shmex, "0.2.0", "2dc5e3919171e69993729fab2eee5bde6b679a4c7da91fd88e41c4254cc65fef", [:mix], [{:bunch_native, "~> 0.2.0", [hex: :bunch_native, repo: "hexpm", optional: false]}, {:bundlex, "~> 0.2.4", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "ac0af802c8934a84a2e7255490568a254b16188acb6358ee24d7d53f76852fc0"},
21+
"shmex": {:hex, :shmex, "0.2.1", "f60f4edc85e514d131ceff1acd37a2b3ff8e77c88d7c04a05b8ab2ba454a1a40", [:mix], [{:bunch_native, "~> 0.2.0", [hex: :bunch_native, repo: "hexpm", optional: false]}, {:bundlex, "~> 0.2.8", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "8e75c2e2fd5735b57a66384ee4e9adb2888675074eacf01c63b71032387d4c65"},
2222
"unifex": {:hex, :unifex, "0.2.5", "a279c09e0bc2a9a50b5fa0552c36783964601f803bb27813122bb17a03be4ebf", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:bundlex, "~> 0.2.0", [hex: :bundlex, repo: "hexpm", optional: false]}, {:shmex, "~> 0.2.0", [hex: :shmex, repo: "hexpm", optional: false]}], "hexpm", "450df31fc1a5e66896bc39e33823db309c124091d37130e07828560ee041fe31"},
2323
}

test/turbojpeg_test.exs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,6 @@ defmodule TurbojpegTest do
2929
assert result.format == :I444
3030
end
3131

32-
@tag [timeout: :timer.minutes(2)]
33-
property "encoding an image is fast", numtests: 5 do
34-
forall [width, height] <- [
35-
width(100),
36-
height(100)
37-
] do
38-
jpeg =
39-
%Mogrify.Image{}
40-
|> Mogrify.custom("size", "#{width}x#{height}")
41-
|> Mogrify.custom("seed", 43)
42-
|> Mogrify.custom("plasma", "fractal")
43-
|> Mogrify.custom("sampling-factor", "4:4:4")
44-
|> Mogrify.custom("stdout", "jpg:-")
45-
|> Mogrify.create(buffer: true)
46-
47-
Shmex.new(jpeg.buffer)
48-
49-
ret = Turbojpeg.jpeg_to_yuv(jpeg)
50-
51-
# Only for local runs
52-
# {time_micros, ret} =
53-
# :timer.tc(fn ->
54-
# Turbojpeg.jpeg_to_yuv(jpeg)
55-
# end)
56-
57-
# assert time_micros / 1000 <= 5000
58-
assert match?({:ok, _}, ret)
59-
end
60-
end
61-
6232
property "solid color jpeg complementary" do
6333
forall [width, height, seed, {r, g, b}, {sampling_factor, _format}] <- [
6434
width(),

0 commit comments

Comments
 (0)