Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GitHub actions duration #309

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ master, develop, testnet ]

env:
MIX_ENV: test

jobs:
build:

Expand All @@ -24,22 +27,42 @@ jobs:
elixir-version: '1.12.3' # Define the elixir version [required]
otp-version: '24.1' # Define the OTP version [required]
- name: Restore dependencies cache
uses: actions/cache@v2
uses: actions/cache@v3
id: mix-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Make Clean
run: mix clean
- name: Install dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: Set Formatting
run: mix format --check-formatted
- name: Restore build cache
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-build-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-build-
- name: Compile the codebase
run: mix compile --warnings-as-errors
- name: Set credo
run: mix credo
- name: Run tests
run: mix test --trace
- name: Run Dialyzer
run: mix dialyzer
- name: Retrieve PLT Cache
uses: actions/cache@v3
id: plt-cache
with:
path: priv/plts
key: ${{ runner.os }}-plts-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-plts-
- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix dialyzer --plt
- name: Run dialyzer
run: mix dialyzer --no-check
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ erl_crash.dump
# Self signed cert are used for local and dev purposes
/priv/cert

# Dialyzer
/priv/plts

/assets/node_modules

log_*
Expand Down
11 changes: 10 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Archethic.MixProject do
compilers: [:elixir_make, :phoenix] ++ Mix.compilers(),
elixirc_paths: elixirc_paths(Mix.env()),
elixirc_options: [warnings_as_errors: true],
dialyzer: [plt_add_apps: [:mix]]
dialyzer: dialyzer()
]
end

Expand All @@ -31,6 +31,15 @@ defmodule Archethic.MixProject do
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]

# Specify dialyzer path
defp dialyzer do
[
plt_add_apps: [:mix, :ex_unit],
plt_core_path: "priv/plts",
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
]
end

# Run "mix help deps" to learn about dependencies.
defp deps do
[
Expand Down
2 changes: 1 addition & 1 deletion test/archethic/beacon_chain_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defmodule Archethic.BeaconChainTest do

describe "load_transaction/1 for beacon transaction" do
test "should fetch the transaction chain from the beacon involved nodes" do
SummaryTimer.start_link(interval: "0 0 * * * *")
SummaryTimer.start_link([interval: "0 0 * * * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down
2 changes: 1 addition & 1 deletion test/archethic/bootstrap/sync_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ defmodule Archethic.Bootstrap.SyncTest do
end

test "publish_end_of_sync/0 should notify the network the node have finished its synchronization" do
BeaconSlotTimer.start_link(interval: "0 * * * * *")
BeaconSlotTimer.start_link([interval: "0 * * * * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down
16 changes: 8 additions & 8 deletions test/archethic/oracle_chain/scheduler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ defmodule Archethic.OracleChain.SchedulerTest do
import Mox

setup do
SelfRepairScheduler.start_link(interval: "0 0 * * *")
SelfRepairScheduler.start_link([interval: "0 0 * * *"], [])
:ok
end

describe "start_link/1" do
test "should start the process with idle state and initialize the polling date" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 * * * *", summary_interval: "0 0 0 * *")
Scheduler.start_link([polling_interval: "0 * * * *", summary_interval: "0 0 0 * *"], [])

polling_date =
"0 * * * *"
Expand Down Expand Up @@ -81,7 +81,7 @@ defmodule Archethic.OracleChain.SchedulerTest do

test "if not trigger node, it should skip the polling" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 * * * *", summary_interval: "0 0 0 * *")
Scheduler.start_link([polling_interval: "0 * * * *", summary_interval: "0 0 0 * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand All @@ -100,7 +100,7 @@ defmodule Archethic.OracleChain.SchedulerTest do

test "if trigger node, it should fetch new data and create a new transaction" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 * * * *", summary_interval: "0 0 0 * *")
Scheduler.start_link([polling_interval: "0 * * * *", summary_interval: "0 0 0 * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down Expand Up @@ -147,7 +147,7 @@ defmodule Archethic.OracleChain.SchedulerTest do

test "should not send a new transaction when the fetched data is the same" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 * * * *", summary_interval: "0 0 0 * *")
Scheduler.start_link([polling_interval: "0 * * * *", summary_interval: "0 0 0 * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down Expand Up @@ -186,7 +186,7 @@ defmodule Archethic.OracleChain.SchedulerTest do

test "if the date is the summary date, it should generate summary transaction, followed by an polling oracle transaction" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 0 0 * *", summary_interval: "0 0 0 * *")
Scheduler.start_link([polling_interval: "0 0 0 * *", summary_interval: "0 0 0 * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down Expand Up @@ -277,7 +277,7 @@ defmodule Archethic.OracleChain.SchedulerTest do

property "dates and address stay in sync over pollings" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 * * * *", summary_interval: "0 0 0 * *")
Scheduler.start_link([polling_interval: "0 * * * *", summary_interval: "0 0 0 * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down Expand Up @@ -349,7 +349,7 @@ defmodule Archethic.OracleChain.SchedulerTest do

property "dates and address are in sync over the summaries" do
{:ok, pid} =
Scheduler.start_link(polling_interval: "0 * * * *", summary_interval: "0 0 * * *")
Scheduler.start_link([polling_interval: "0 * * * *", summary_interval: "0 0 * * *"], [])

P2P.add_and_connect_node(%Node{
ip: {127, 0, 0, 1},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Archethic.SelfRepair.Sync.BeaconSummaryHandlerTest do
|> elem(0)
|> NetworkLookup.set_daily_nonce_public_key(DateTime.utc_now() |> DateTime.add(-10))

Archethic.SelfRepair.Scheduler.start_link(interval: "0 0 0 * * *")
Archethic.SelfRepair.Scheduler.start_link([interval: "0 0 0 * * *"], [])

:ok
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule Archethic.SharedSecrets.NodeRenewalSchedulerTest do
import Mox

setup do
SelfRepairScheduler.start_link(interval: "0 0 0 * *")
SelfRepairScheduler.start_link([interval: "0 0 0 * *"], [])
start_supervised!({BeaconSlotTimer, interval: "0 * * * * *"})
Enum.each(BeaconChain.list_subsets(), &Registry.register(SubsetRegistry, &1, []))
:ok
Expand Down