Skip to content

Add tar step in workflow #70

Add tar step in workflow

Add tar step in workflow #70

Workflow file for this run

name: Elixir CI
on:
pull_request:
branches: ["main"]
permissions:
contents: read
concurrency:
group: manx-build-and-test-${{ github.ref }}
cancel-in-progress: true
env:
KINDA_PRINT_LINKAGES: 1
jobs:
build:
runs-on: ubuntu-latest
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
otp: ["25.0"]
elixir: ["1.14.0"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.11.0
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-kinda-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-kinda-
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: ./kinda_example/deps
key: ${{ runner.os }}-mix-example-${{ hashFiles('**/mix.exs') }}
restore-keys: ${{ runner.os }}-mix-example-
- name: Install dependencies
run: mix deps.get
- name: Run tests
run: |
mix test
- name: Install dependencies (example)
working-directory: ./kinda_example
run: mix deps.get
- name: Run tests (example)
working-directory: ./kinda_example
run: |
mix test --force
- name: Production build
working-directory: ./kinda_example
env:
MIX_ENV: prod
run: |
mix
- name: Tar production native libraries
working-directory: ./kinda_example
id: tar
env:
MIX_ENV: prod
run: |
set -u
APP_NAME=kinda_example
ls _build/${MIX_ENV}/lib/${APP_NAME}/native_install/lib
LIB_FINAL_SO=$(ls _build/${MIX_ENV}/lib/${APP_NAME}/native_install/lib | grep -E "lib${APP_NAME}.+so")
LIB_FINAL_NAME=${LIB_FINAL_SO}.tar.gz
tar --dereference -cvzf ${LIB_FINAL_NAME} \
-C $PWD/_build/${MIX_ENV}/lib/${APP_NAME}/native_install/lib $(cd $PWD/_build/${MIX_ENV}/lib/${APP_NAME}/native_install/lib && ls *.so) \
-C $PWD/_build/${MIX_ENV}/lib/${APP_NAME}/native_install/lib $(cd $PWD/_build/${MIX_ENV}/lib/${APP_NAME}/native_install/lib && ls *.dylib) \
-C $PWD/_build/${MIX_ENV}/lib/${APP_NAME}/native_install $(cd $PWD/_build/${MIX_ENV}/lib/${APP_NAME}/native_install && ls *.ex)
echo "LIB_FINAL_NAME=${LIB_FINAL_NAME}" >> $GITHUB_OUTPUT