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:
|
2023-05-30 18:06:59 +08:00
|
|
|
otp: "26.0"
|
|
|
|
elixir: "1.15.0-rc.1"
|
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:
|
2023-03-14 02:43:25 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-17 06:20:23 +08:00
|
|
|
- name: Install Erlang & Elixir
|
2021-05-19 22:46:33 +08:00
|
|
|
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 }}
|
2021-05-21 08:09:05 +08:00
|
|
|
- name: Cache Mix
|
2022-11-30 07:26:28 +08:00
|
|
|
uses: actions/cache@v3
|
2021-05-21 08:09:05 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
deps
|
|
|
|
_build
|
2022-08-12 02:13:57 +08:00
|
|
|
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
|
2021-05-21 08:09:05 +08:00
|
|
|
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
|
2021-03-23 05:16:38 +08:00
|
|
|
- name: Check formatting
|
2022-10-04 14:46:55 +08:00
|
|
|
run: mix 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
|
2022-04-12 02:34:31 +08:00
|
|
|
run: mix test
|
2021-02-17 06:20:23 +08:00
|
|
|
- name: Install Node
|
2022-11-30 07:26:28 +08:00
|
|
|
uses: actions/setup-node@v3
|
2021-02-17 06:20:23 +08:00
|
|
|
with:
|
2022-11-30 07:26:28 +08:00
|
|
|
node-version: "18.x"
|
2021-05-21 08:09:05 +08:00
|
|
|
- name: Cache npm dependencies
|
2022-11-30 07:26:28 +08:00
|
|
|
uses: actions/cache@v3
|
2021-05-21 08:09:05 +08:00
|
|
|
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
|
2021-03-23 05:16:38 +08:00
|
|
|
- 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
|
2022-04-12 02:34:31 +08:00
|
|
|
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
|
2023-03-14 02:43:25 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-12 02:34:31 +08:00
|
|
|
- name: Install Erlang & Elixir
|
|
|
|
uses: erlef/setup-beam@v1
|
|
|
|
with:
|
2022-05-27 21:47:47 +08:00
|
|
|
version-type: strict
|
2022-08-12 02:13:57 +08:00
|
|
|
otp-version: ${{ env.otp }}
|
|
|
|
elixir-version: ${{ env.elixir }}
|
2022-04-12 02:34:31 +08:00
|
|
|
- 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
|
2022-04-12 02:34:31 +08:00
|
|
|
# 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
|
2022-11-30 07:26:28 +08:00
|
|
|
uses: actions/cache@v3
|
2022-04-12 02:34:31 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
deps
|
|
|
|
_build
|
2022-08-12 02:13:57 +08:00
|
|
|
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
|
2022-04-12 02:34:31 +08:00
|
|
|
restore-keys: |
|
2022-08-12 02:13:57 +08:00
|
|
|
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
|
2022-04-12 02:34:31 +08:00
|
|
|
- name: Install mix dependencies
|
|
|
|
run: mix deps.get
|
|
|
|
- name: Run tests
|
|
|
|
run: mix test
|
2022-05-27 21:47:47 +08:00
|
|
|
- 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:
|
2023-03-14 02:43:25 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-22 14:04:59 +08:00
|
|
|
- name: Cache Mix Deps
|
2022-11-30 07:26:28 +08:00
|
|
|
uses: actions/cache@v3
|
2022-06-22 14:04:59 +08:00
|
|
|
with:
|
|
|
|
path: deps
|
|
|
|
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
2023-01-17 04:09:47 +08:00
|
|
|
- name: Cache Bootstrap OTP
|
2022-11-30 07:26:28 +08:00
|
|
|
uses: actions/cache@v3
|
2022-06-22 14:04:59 +08:00
|
|
|
with:
|
2023-01-17 04:09:47 +08:00
|
|
|
path: elixirkit/otp_bootstrap/_build/otp-rel-${{ env.otp }}-openssl-1.1.1s-macos-universal
|
|
|
|
key: ${{ runner.os }}-bootstrap-${{ env.otp }}-${{ hashFiles('elixirkit/otp_bootstrap/build.sh') }}
|
|
|
|
- name: Cache Elixir
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: _build/elixir-${{ env.elixir }}
|
|
|
|
key: ${{ runner.os }}-elixir-${{ env.elixir }}
|
2022-06-22 14:04:59 +08:00
|
|
|
- name: Build the app
|
2023-01-17 04:09:47 +08:00
|
|
|
run: .github/scripts/app/build_macos.sh
|
|
|
|
env:
|
|
|
|
OTP_VERSION: ${{ env.otp }}
|
|
|
|
ELIXIR_VERSION: ${{ env.elixir }}
|