livebook/.github/workflows/test.yaml

114 lines
3.5 KiB
YAML
Raw Normal View History

2021-02-17 06:20:23 +08:00
name: Test
on:
pull_request:
push:
branches:
- main
2022-08-12 02:13:57 +08:00
env:
otp: "25.0"
2022-09-02 18:25:14 +08:00
elixir: "1.14.0"
2021-02-17 06:20:23 +08:00
jobs:
main:
runs-on: ubuntu-latest
2021-05-26 22:15:09 +08:00
env:
MIX_ENV: test
2021-02-17 06:20:23 +08:00
steps:
- uses: actions/checkout@v2
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1
2021-02-17 06:20:23 +08:00
with:
2022-08-12 02:13:57 +08:00
otp-version: ${{ env.otp }}
elixir-version: ${{ env.elixir }}
- name: Cache Mix
uses: actions/cache@v2
with:
path: |
deps
_build
2022-08-12 02:13:57 +08:00
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
2022-08-12 02:13:57 +08:00
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
2021-02-17 06:20:23 +08:00
- name: Install mix dependencies
run: mix deps.get
- name: Check formatting
2022-08-12 02:13:57 +08:00
# TODO: remove deps.compile on Elixir > 1.14.0-rc.0
run: mix do deps.compile, format --check-formatted
2021-04-26 14:59:46 +08:00
- name: Check warnings
run: mix compile --warnings-as-errors
2021-02-17 06:20:23 +08:00
- name: Run tests
run: mix test
2021-02-17 06:20:23 +08:00
- name: Install Node
uses: actions/setup-node@v2
with:
2022-08-12 02:13:57 +08:00
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-
2021-02-17 06:20:23 +08:00
- name: Install npm dependencies
run: npm ci --prefix assets
- name: Check assets formatting
run: npm run format-check --prefix assets
- name: Run assets tests
2021-02-17 06:20:23 +08:00
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
2022-08-12 02:13:57 +08:00
otp-version: ${{ env.otp }}
elixir-version: ${{ env.elixir }}
- name: Start epmd
2022-09-15 20:05:54 +08:00
run: $(elixir -e 'IO.puts "#{:code.root_dir()}/erts-#{:erlang.system_info(:version)}"')/bin/epmd.exe -daemon
shell: bash
# 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
2022-08-12 02:13:57 +08:00
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
2022-08-12 02:13:57 +08:00
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
- name: Install mix dependencies
run: mix deps.get
- name: Run tests
run: mix test
- name: Build the app
run: bash .github/scripts/app/build_windows.sh
2022-06-22 14:04:59 +08:00
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