Skip to content

Commit

Permalink
feat: elixir code subpath parameter (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
T0ha committed Aug 12, 2024
1 parent 8cd410b commit 72351ee
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ on:
type: string
required: false
default: test
elixir-code-path:
type: string
required: false
default: "."
secrets:
HEX_ORGANIZATION_COINGAMING_KEY:
required: true
Expand Down Expand Up @@ -65,19 +69,19 @@ jobs:
with:
ref: ${{ inputs.ref }}
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || github.token }}

- name: Init Deps Cache
uses: actions/cache/restore@v3
id: deps-cache
with:
key: v2-release-${{ hashFiles('./mix.lock') }}-${{ inputs.mix-env }}
key: v2-release-${{ hashFiles(format('./{0}/mix.lock', inputs.elixir-code-path)) }}-${{ inputs.mix-env }}
path: |
${{ inputs.cache_paths }}
~/.mix
~/.hex
./deps
./_build
./${{ inputs.elixir-code-path }}/deps
./${{ inputs.elixir-code-path }}/_build
- name: Init Code Cache
uses: actions/cache/restore@v3
Expand All @@ -88,8 +92,8 @@ jobs:
${{ inputs.cache_paths }}
~/.mix
~/.hex
./deps
./_build
./${{ inputs.elixir-code-path }}/deps
./${{ inputs.elixir-code-path }}/_build
- name: SSH Deploy Keys Setup
uses: cardoe/ssh-agent-deploy-key@v1
Expand All @@ -102,11 +106,15 @@ jobs:

- name: Add coingaming organization
if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true'
run: mix hex.organization auth coingaming --key ${{secrets.HEX_ORGANIZATION_COINGAMING_KEY}}
run: |
cd ${{ inputs.elixir-code-path }}
mix hex.organization auth coingaming --key ${{secrets.HEX_ORGANIZATION_COINGAMING_KEY}}
- name: Add oban repo
if: steps.deps-cache.outputs.cache-hit != 'true' && env.OBAN_FINGERPRINT
run: mix hex.repo add oban https://getoban.pro/repo --fetch-public-key ${{env.OBAN_FINGERPRINT}} --auth-key ${{env.OBAN_LICENSE_KEY}}
run: |
cd ${{ inputs.elixir-code-path }}
mix hex.repo add oban https://getoban.pro/repo --fetch-public-key ${{env.OBAN_FINGERPRINT}} --auth-key ${{env.OBAN_LICENSE_KEY}}
- name: Authorize github.com
env:
Expand All @@ -119,6 +127,7 @@ jobs:
- name: Get deps and protobuf escript
if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true'
run: |
cd ${{ inputs.elixir-code-path }}
mix deps.get
mix escript.install hex protobuf 0.10.0 --force
echo "$HOME/.mix/escripts" >> $GITHUB_PATH
Expand All @@ -130,28 +139,34 @@ jobs:

- name: Compile dependencies
if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true'
run: mix deps.compile
run: |
cd ${{ inputs.elixir-code-path }}
mix deps.compile
- name: Download UAInspector DB
if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true'
run: mix run --no-start -e "UAInspector.Downloader.download()"
run: |
cd ${{ inputs.elixir-code-path }}
mix run --no-start -e "UAInspector.Downloader.download()"
continue-on-error: true

- name: Save Deps Cache
uses: actions/cache/save@v3
if: steps.deps-cache.outputs.cache-hit != 'true'
with:
key: v2-release-${{ hashFiles('./mix.lock') }}-${{ inputs.mix-env }}
key: v2-release-${{ hashFiles(format('./{0}/mix.lock', inputs.elixir-code-path)) }}-${{ inputs.mix-env }}
path: |
${{ inputs.cache_paths }}
~/.mix
~/.hex
./deps
./_build
./${{ inputs.elixir-code-path }}/deps
./${{ inputs.elixir-code-path }}/_build
- name: Compile
if: steps.code-cache.outputs.cache-hit != 'true'
run: mix compile
run: |
cd ${{ inputs.elixir-code-path }}
mix compile
- name: Save Code Cache
uses: actions/cache/save@v3
Expand All @@ -162,5 +177,5 @@ jobs:
${{ inputs.cache_paths }}
~/.mix
~/.hex
./deps
./_build
./${{ inputs.elixir-code-path }}/deps
./${{ inputs.elixir-code-path }}/_build

0 comments on commit 72351ee

Please sign in to comment.