Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
apodlaski committed Oct 29, 2024
1 parent b02b26f commit 46918b0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 85 deletions.
54 changes: 34 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ on:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
Expand Down Expand Up @@ -54,23 +46,35 @@ jobs:
OBAN_LICENSE_KEY: ${{ secrets.OBAN_LICENSE_KEY }}

steps:
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}

- name: Install ExEnv
run: mix archive.install hex ex_env 0.3.2 --force

- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
submodules: recursive
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}

# When following job fails, it means you've changed .tool-versions
# and you must trigger machine.yml (build machine) workflow to build correct machine-cache
- name: Restore elixir and erlang
uses: actions/cache/restore@v3
id: machine-cache
with:
key: v2-release-${{ runner.os }}-amd64-${{ hashFiles('./.tool-versions') }}
path: |
~/.mix
~/.hex
~/.asdf
- name: Install Erlang, Elixir, etc
- uses: asdf-vm/actions/install@v2

- name: Install mix & hex and ex_env
if: steps.machine-cache.outputs.cache-hit != 'true'
run: |
mix local.hex --force
mix local.rebar --force
mix archive.install --force hex ex_env 0.3.2 --force
- name: Init Deps Cache
uses: actions/cache/restore@v3
id: deps-cache
Expand All @@ -80,18 +84,28 @@ jobs:
${{ inputs.cache_paths }}
~/.mix
~/.hex
~/.asdf
${{ inputs.elixir-code-path }}/deps
${{ inputs.elixir-code-path }}/_build
- name: Save elixir and erlang
if: steps.machine-cache.outputs.cache-hit != 'true'
uses: buildjet/cache/save@v3
id: machine-cache-save
with:
key: v2-release-${{ runner.os }}-amd64-${{ hashFiles('./.tool-versions') }}
path: |
~/.mix
~/.hex
~/.asdf
- name: Init Code Cache
uses: actions/cache/restore@v3
id: code-cache
with:
key: v2-release-${{ github.sha }}-${{ inputs.mix-env }}
path: |
${{ inputs.cache_paths }}
~/.mix
~/.hex
${{ inputs.elixir-code-path }}/deps
${{ inputs.elixir-code-path }}/_build
Expand Down
24 changes: 7 additions & 17 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ on:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
Expand Down Expand Up @@ -52,20 +44,14 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}


code_checks:
name: Run code checks
needs: build
runs-on: ubuntu-20.04

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Get workflow version
id: workflow-version
uses: canonical/get-workflow-version-action@v1
Expand All @@ -74,17 +60,21 @@ jobs:
file-name: code-checks.yml
github-token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}

- name: Checkout private tools
uses: actions/checkout@v4
with:
repository: coingaming/.github
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
path: my-tools

- name: Prepare repo and env
uses: coingaming/.github/actions/prepare@${{ steps.workflow-version.outputs.sha }}
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}
elixir-code-path: ${{ inputs.elixir-code-path }}


- name: Install protoc
run: sudo apt-get install protobuf-compiler

Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/dialyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ on:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
Expand Down Expand Up @@ -41,8 +33,6 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}

dialyzer:
Expand All @@ -56,8 +46,6 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}
elixir-code-path: ${{ inputs.elixir-code-path }}

Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/release-hex-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ on:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
Expand Down Expand Up @@ -45,8 +37,6 @@ jobs:
ref: ${{ inputs.version }}
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}

release:
Expand All @@ -65,8 +55,6 @@ jobs:
ref: ${{ inputs.version }}
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}
elixir-code-path: ${{ inputs.elixir-code-path }}

Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/release-hex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ on:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
Expand Down Expand Up @@ -41,8 +33,6 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}

release:
Expand All @@ -59,8 +49,6 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}

Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ on:
type: string
required: false
default: ""
elixir-version:
type: string
required: false
default: "1.14.3" # Define the elixir version
otp-version:
type: string
required: false
default: "25.1" # Define the OTP version
mix-env:
type: string
required: false
Expand Down Expand Up @@ -49,8 +41,6 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
elixir-code-path: ${{ inputs.elixir-code-path }}

tests:
Expand Down Expand Up @@ -80,8 +70,6 @@ jobs:
with:
mix-env: ${{ inputs.mix-env }}
cache_paths: ${{ inputs.cache_paths }}
elixir-version: ${{ inputs.elixir-version }}
otp-version: ${{ inputs.otp-version }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}
elixir-code-path: ${{ inputs.elixir-code-path }}

Expand Down

0 comments on commit 46918b0

Please sign in to comment.