livebook/.github/workflows/test.yaml
2022-06-22 08:04:59 +02:00

113 lines
3.4 KiB
YAML

name: Test
on:
pull_request:
push:
branches:
- main
jobs:
main:
runs-on: ubuntu-latest
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v2
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1
with:
otp-version: '24.0'
elixir-version: '1.13.0'
- name: Cache Mix
uses: actions/cache@v2
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- name: Install mix dependencies
run: mix deps.get
- name: Check formatting
run: mix format --check-formatted
- name: Check warnings
run: mix compile --warnings-as-errors
- name: Run tests
run: mix test
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Cache npm dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install npm dependencies
run: npm ci --prefix assets
- name: Check assets formatting
run: npm run format-check --prefix assets
- name: Run assets tests
run: npm test --prefix assets
windows:
runs-on: windows-latest
if: github.ref == 'refs/heads/main'
env:
MIX_ENV: test
steps:
- name: Configure Git
run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1
with:
version-type: strict
otp-version: '24.2'
elixir-version: '1.13.2'
- name: Start epmd
run: cmd /c "START /b epmd"
working-directory: ${{ env.INSTALL_DIR_FOR_OTP }}/erts-12.2/bin
# Add tar that supports symlinks, see https://github.com/actions/virtual-environments/issues/4679
- name: Add tar.exe
run: |
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Cache Mix
uses: actions/cache@v2
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- name: Install mix dependencies
run: mix deps.get
- name: Check formatting
run: mix format --check-formatted
- name: Check warnings
run: mix compile --warnings-as-errors
- name: Run tests
run: mix test
- name: Build the app
run: bash .github/scripts/app/build_windows.sh
macos:
runs-on: macos-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Cache Mix Deps
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
- name: Cache Bootstrap
uses: actions/cache@v2
with:
path: tmp
key: ${{ runner.os }}-app-${{ hashFiles('.github/scripts/app/bootstrap_mac.sh') }}
- name: Bootstrap
run: bash .github/scripts/app/bootstrap_mac.sh
- name: Build the app
run: bash .github/scripts/app/build_mac.sh