Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mithereal committed Dec 7, 2023
1 parent 0a3c07c commit 534b503
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 41 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Created with GitHubActions version 0.2.16
name: Coveralls Report
env:
GITHUB_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
on:
- pull_request
- push
jobs:
linux:
name: Test on Ubuntu (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
runs-on: ubuntu-20.04
services:
# Label used to access the service container
strategy:
matrix:
elixir:
- '1.15.6'
otp:
- '26.1'
exclude:
- elixir: '1.13.4'
otp: '26.1'
- elixir: '1.14.5'
otp: '22.3'
- elixir: '1.14.5'
otp: '26.1'
- elixir: '1.15.6'
otp: '22.3'
- elixir: '1.15.6'
otp: '23.3'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Restore deps
uses: actions/cache@v3
with:
path: deps
key: deps-${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: _build-${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Get dependencies
run: mix deps.get
- name: Compile dependencies
run: MIX_ENV=test mix deps.compile
- name: Compile project
run: MIX_ENV=test mix compile
- name: Check code format
if: ${{ contains(matrix.elixir, '1.15.6') && contains(matrix.otp, '26.1') }}
run: mix format --check-formatted
- name: Run tests
run: MIX_ENV=test mix test
if: ${{ !(contains(matrix.elixir, '1.15.6') && contains(matrix.otp, '26.1')) }}
- name: Run tests with coverage
run: MIX_ENV=test mix coveralls.github
if: ${{ contains(matrix.elixir, '1.15.6') && contains(matrix.otp, '26.1') }}
21 changes: 21 additions & 0 deletions .github/workflows/increment_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Increment Product Version"
on:
workflow_dispatch:

push:
branches:
- master
jobs:
Increment-Version:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
WITH_V: true
71 changes: 71 additions & 0 deletions .github/workflows/vulnerability_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Execute Vulnerability Scan
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * 5"

env:
ELIXIR_VERSION: "1.15"
OTP_VERSION: "24.2.1"
APPLICATION_WORKING_DIR: ./

jobs:
execute_scan:
name: Execute Vulnerability Scan
runs-on: ubuntu-latest
steps:
- name: Checkout Github Repo
uses: actions/checkout@v3

- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}

- name: Setup Dependencies Cache
id: deps-cache
run: |
echo "key=${{ runner.os }}-Elixir(${{ env.OTP_VERSION }})-OTP(${{ env.ELIXIR_VERSION }})-Mix.LockHash(${{ hashFiles('**/mix.lock') }})" >> $GITHUB_OUTPUT
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
${{env.APPLICATION_WORKING_DIR}}/deps
${{env.APPLICATION_WORKING_DIR}}/_build
key: ${{ steps.deps-cache.outputs.key }}

- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
working-directory: ${{env.APPLICATION_WORKING_DIR}}
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
- name: Execute Report
id: report_status
working-directory: ${{env.APPLICATION_WORKING_DIR}}
run: |
mix deps.audit
- name: Echo Scan Exit Code
if: always()
run: echo "${{steps.report_status.outcome}}"

- name: Vulnerabilities Found - Discord notification
if: always() && steps.report_status.outcome == 'failure'
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: 'failure'
username: GitHub Actions
avatar_url: ${{ secrets.DISCORD_AVATAR_URL }}
title: " Vulnerability Audit"
description: "View Scan Results: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
image: ${{ secrets.DISCORD_EMBED_IMAGE }}
color: 0x0000ff
url: ${{ github.server_url }}/${{ github.repository }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ by adding `speedtest` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:speedtest, "~> 1.1.0"}
{:speedtest, "~> 1.1.1"}
]
end
```
Expand Down
6 changes: 6 additions & 0 deletions coveralls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"skip_files": [
"deps",
"config"
]
}
36 changes: 18 additions & 18 deletions lib/speedtest.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ defmodule Speedtest do
Retrieve a the list of speedtest.net servers, optionally filtered
to servers matching those specified in the servers argument
example:
## Examples
Speedtest.fetch_servers(%Speedtest{})
iex> Speedtest.fetch_servers(%Speedtest{})
"""
def fetch_servers(%Speedtest{} = speedtest \\ %Speedtest{}) do
Expand Down Expand Up @@ -64,9 +64,9 @@ defmodule Speedtest do
Limit servers to the closest speedtest.net servers based on
geographic distance
example:
## Examples
Speedtest.choose_closest_servers()
iex> Speedtest.choose_closest_servers()
"""
def choose_closest_servers(servers \\ [], amount \\ 2) do
Expand All @@ -79,9 +79,9 @@ defmodule Speedtest do
Perform a speedtest.net "ping" to determine which speedtest.net
server has the lowest latency
example:
## Examples
Speedtest.choose_best_server([]})
iex> Speedtest.choose_best_server([])
"""
def choose_best_server(servers) do
Expand All @@ -102,9 +102,9 @@ defmodule Speedtest do
@doc """
Test download speed against speedtest.net
example:
## Examples
Speedtest.download(%Speedtest{})
iex> Speedtest.download(%Speedtest{})
"""
def download(%Speedtest{} = speedtest \\ %Speedtest{}) do
Expand Down Expand Up @@ -136,9 +136,9 @@ defmodule Speedtest do
@doc """
Test upload speed against speedtest.net
example:
## Examples
Speedtest.upload(%Speedtest{})
iex> Speedtest.upload(%Speedtest{})
"""
def upload(%Speedtest{} = speedtest \\ %Speedtest{}) do
Expand All @@ -164,9 +164,9 @@ defmodule Speedtest do
@doc """
Determine distance between sets of [lat,lon] in km
example:
## Examples
Speedtest.distance(%Speedtest{})
iex> Speedtest.distance(%Speedtest{})
"""
def distance(%Speedtest{} = speedtest \\ %Speedtest{}) do
Expand All @@ -190,9 +190,9 @@ defmodule Speedtest do
@doc """
Run the full speedtest.net test
example:
## Examples
Speedtest.run()
iex> Speedtest.run()
"""
def run() do
Expand Down Expand Up @@ -260,9 +260,9 @@ defmodule Speedtest do
@doc """
Ping an IP and return a tuple with the time
example:
## Examples
Speedtest.ping("127.0.0.1")
iex> Speedtest.ping("127.0.0.1")
"""
def ping(ip) do
Expand All @@ -274,8 +274,8 @@ defmodule Speedtest do
## Examples
iex> Speedtest.init()
{:ok, %Speedtest{config: [],exclude: nil,include: nil,result: nil,selected_server: nil,servers: [],threads: nil}}
iex> Speedtest.init()
{:ok, %Speedtest{config: [],exclude: nil,include: nil,result: nil,selected_server: nil,servers: [],threads: nil}}
"""
Expand Down
16 changes: 8 additions & 8 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Speedtest.MixProject do
use Mix.Project

@version "1.1.0"
@version "1.1.1"
@source_url "https://github.com/mithereal/ex_speedtest.git"

def project do
[
app: :speedtest,
version: @version,
elixir: "~> 1.9",
elixir: "~> 1.15",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
description: description(),
Expand All @@ -30,12 +30,12 @@ defmodule Speedtest.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ex_doc, "~> 0.25", only: :dev, runtime: false},
{:httpoison, "~> 1.8"},
{:sweet_xml, "~> 0.7"},
{:geocalc, "~> 0.8"},
{:inch_ex, ">= 0.0.0", only: [:test, :dev]},
{:mix_test_watch, "~> 0.8", only: :dev, runtime: false}
{:ex_doc, "~> 0.30.9", only: :dev, runtime: false},
{:httpoison, "~> 2.2"},
{:sweet_xml, "~> 0.7.4"},
{:geocalc, "~> 0.8.5"},
{:inch_ex, only: :docs},
{:mix_audit, ">= 0.0.0", only: [:dev, :test], runtime: false}
]
end

Expand Down
Loading

0 comments on commit 534b503

Please sign in to comment.