feat: test prepare #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile and check | ||
on: | ||
workflow_call: | ||
inputs: | ||
cache_paths: | ||
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 | ||
default: test | ||
check-format: | ||
type: boolean | ||
required: false | ||
default: true | ||
check-credo: | ||
type: boolean | ||
required: false | ||
default: true | ||
check-warnings: | ||
type: boolean | ||
required: false | ||
default: true | ||
elixir-code-path: | ||
type: string | ||
required: false | ||
default: "." | ||
secrets: | ||
HEX_ORGANIZATION_COINGAMING_KEY: | ||
required: true | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
MIX_ENV: ${{ inputs.mix-env }} | ||
jobs: | ||
build: | ||
name: Build | ||
uses: ./.github/workflows/build.yml | ||
secrets: inherit | ||
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 }} | ||
prepare: | ||
name: Prepare repo and env | ||
uses: ./actions/prepare | ||
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 }} | ||
code_checks: | ||
name: Run code checks | ||
needs: build | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Install protoc | ||
run: sudo apt-get install protobuf-compiler | ||
- name: Format | ||
if: ${{ inputs.check-format }} | ||
run: | | ||
cd ${{ inputs.elixir-code-path }} | ||
mix format --check-formatted | ||
- name: Credo | ||
if: ${{ inputs.check-credo }} | ||
run: | | ||
cd ${{ inputs.elixir-code-path }} | ||
mix credo | ||
- name: Compile and check warnings | ||
if: ${{ inputs.check-warnings }} | ||
run: | | ||
cd ${{ inputs.elixir-code-path }} | ||
mix do clean, compile --warnings-as-errors |