-
Notifications
You must be signed in to change notification settings - Fork 48
109 lines (95 loc) · 3.66 KB
/
host_core.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: HostCore Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
MIX_ENV: test
working-directory: host_core
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
elixir: [1.14.3]
otp: [25]
name: Build and test
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
# Install Rust
- run: rustup toolchain install stable --profile minimal
# Install erlang/OTP and elixir
- name: Install erlang and elixir
if: ${{ startswith(matrix.os, 'ubuntu') || startswith(matrix.os, 'windows') }}
uses: erlef/setup-beam@v1
with:
otp-version: "=${{ matrix.otp }}"
elixir-version: ${{ matrix.elixir }}
install-hex: true
install-rebar: true
- name: Install erlang and elixir
if: ${{ startswith(matrix.os, 'macos') }}
run: |
brew install erlang
brew install elixir
# If dependencies aren't changing, retrieve cache
- name: Retrieve Mix Dependencies Cache
uses: actions/cache@v2
id: mix-cache #id to use in retrieve action
with:
path: |
host_core/deps
host_core/_build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }}
# Cache Rust builds
- uses: Swatinem/rust-cache@v2
with:
cache-directories: "host_core/native/hostcore_wasmcloud_native/target"
- name: Install Rebar and Hex
working-directory: ${{env.working-directory}}
run: |
mix local.rebar --force
mix local.hex --force
- name: Install Mix Dependencies
working-directory: ${{env.working-directory}}
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix do deps.get, deps.compile
- name: Check Formatting
if: ${{ !startswith(matrix.os, 'windows') }} # Windows gets angry about carriage returns
working-directory: ${{env.working-directory}}
run: mix format --check-formatted
- name: Run Credo
working-directory: ${{env.working-directory}}
continue-on-error: true # Don't fail entire action with refactoring opportunities for now
run: mix credo --strict
- name: Run Tests
if: ${{ startswith(matrix.os, 'ubuntu') }} # Run on Ubuntu only as a temporary workaround to dependencies that aren't present on windows/mac runners
working-directory: ${{env.working-directory}}
env:
EXTRA_TEST_ARGS: "--timeout 120000"
WASMCLOUD_RPC_TIMEOUT_MS: 3000
MIX_ENV: test
run: |
WASMCLOUD_LATTICE_PREFIX=$(echo "${{ runner.os }}__${{ matrix.otp }}__${{ matrix.elixir }}__${{ env.working-directory }}" | sed 's/\./_/g') \
make test
- name: Retrieve PLT Cache
uses: actions/cache@v2
id: plt-cache
with:
path: host_core/priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('host_core/mix.exs', 'host_core/mix.lock') }}
- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true' && !startswith(matrix.os, 'windows')
working-directory: ${{env.working-directory}}
run: |
mkdir -p priv/plts
mix dialyzer --plt
- name: Run dialyzer
if: ${{ !startswith(matrix.os, 'windows') }}
working-directory: ${{env.working-directory}}
run: mix dialyzer
# Thank you https://hashrocket.com/blog/posts/build-the-ultimate-elixir-ci-with-github-actions for this action setup