bonfire-app/.github/workflows/test.yaml

172 lines
6.1 KiB
YAML
Raw Normal View History

2022-05-02 02:04:35 +00:00
name: Test
2021-01-07 11:49:55 +00:00
on:
push:
2021-03-14 18:03:30 +00:00
branches:
- main
2021-01-07 11:49:55 +00:00
pull_request:
2021-03-14 18:03:30 +00:00
branches:
- main
2021-01-07 11:49:55 +00:00
jobs:
2021-11-25 01:50:02 +00:00
test_classic_flavour:
2021-11-25 01:52:44 +00:00
name: Test classic flavour
2021-01-07 11:49:55 +00:00
runs-on: ubuntu-latest
2023-01-05 03:36:11 +00:00
container: elixir:1.14-alpine
2021-06-10 17:11:23 +00:00
env:
2021-11-25 01:50:02 +00:00
FLAVOUR: classic
2021-11-25 02:21:03 +00:00
MIX_ENV: test
2021-12-17 00:18:43 +00:00
WITH_DOCKER: no
2021-06-10 17:11:23 +00:00
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: postgres
CI: true
2021-07-13 08:56:10 +00:00
SECRET_KEY_BASE: "kSNSvYkWk14onNdbYzhEqFyG5TzpOO9+FFlk5sIrhTk0RV6+FeL/nM8DWQffDah4woepgQdrP6J8cjWGyehcWcRWvIIWXsghp0yY9/fEjgfUekD15P9LGRCmu6exIQ6g"
SIGNING_SALT: "NPkqpeTx/q9xGQRWwRpqBWI7bCxeHMAF4L2PHntfjVtd8GZD2BQKe9KLnkIR5WbLVdZt24FWuR+Hy5WoXaZM4APydGvC2+w2enJmskOckX5VY1Bpvm7JGKu+QymgIgK/"
ENCRYPTION_SALT: "l+QT/gkdX722f57qSAUc+bZcqm5ZduXY4D0hp0glEiKdR267JsZ1/CZlrlhADcD8kzuaZGFWvJ2dlr6sujbzGQV5e04lKVIsZh3gfd8eqQBckIqH6L8TDRRz4M07YE+F"
2021-01-07 11:49:55 +00:00
services:
postgres:
2022-10-17 01:02:24 +00:00
image: postgis/postgis:12-3.3-alpine
2021-01-07 11:49:55 +00:00
env:
2021-06-10 17:34:16 +00:00
POSTGRES_DB: bonfire_test
2021-01-07 11:49:55 +00:00
POSTGRES_PASSWORD: postgres
2021-06-10 17:34:16 +00:00
ports:
- 5432:5432
2021-01-07 11:49:55 +00:00
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
2021-05-01 12:54:11 +00:00
-
name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
-
2022-09-08 04:58:38 +00:00
name: Install bash (needed for just), git (needed for checkout), tar (needed for cache), file (needed for bonfire_files), make/build-base/sqlite (for arch), and just
run: apk add bash git tar file make build-base sqlite just
2021-05-01 12:54:11 +00:00
-
name: Checkout repo
2021-04-17 19:51:10 +00:00
uses: actions/checkout@v2
2021-04-17 10:38:53 +00:00
with:
fetch-depth: 2 # needed for action-detect-and-tag-new-version
2021-01-07 11:49:55 +00:00
# - name: Set up Elixir
# uses: actions/setup-elixir@v1
# with:
# elixir-version: ${{ matrix.elixir }}
# otp-version: ${{ matrix.otp }}
2022-04-27 20:42:14 +00:00
# TODO: does not handle git deps correctly?...
2022-05-23 03:15:11 +00:00
- name: Trust my repo
run: export GIT_CEILING_DIRECTORIES=/__w && git config --global --add safe.directory /__w/bonfire-app/bonfire-app # see https://github.com/actions/checkout/issues/760
2022-04-16 22:24:09 +00:00
- name: Restore dependencies cache
uses: actions/cache@v2
id: cache
with:
path: |
deps
_build
2022-04-27 20:42:14 +00:00
key: ${{ runner.os }}-mix-${{ hashFiles('/mix.lock') }}
2022-04-16 22:24:09 +00:00
restore-keys: ${{ runner.os }}-mix-
2021-11-25 01:50:02 +00:00
- name: Install system deps
2022-09-08 04:19:11 +00:00
run: apk add mailcap ca-certificates openssl-dev tzdata gettext rust cargo sqlite
2022-05-23 03:04:46 +00:00
# - name: Install tools
# run: cargo install just && echo "/github/home/.cargo/bin" >> $GITHUB_PATH
2021-11-25 01:50:02 +00:00
- name: Install hex
run: mix local.hex --force
- name: Install rebar
run: mix local.rebar --force
2022-04-16 22:24:09 +00:00
# - name: Remove mix.lock
# run: rm mix.lock
2022-05-02 02:04:35 +00:00
- name: Prepare environment
2022-05-23 03:15:11 +00:00
run: just pre-setup && just init
2021-11-25 01:50:02 +00:00
- name: Install dependencies
run: mix deps.get
- name: Update Bonfire extensions to latest git versions
run: mix bonfire.deps.update
2022-04-16 22:24:09 +00:00
- name: Fetch any differences in nested deps
2021-11-25 01:50:02 +00:00
run: mix deps.get
- name: Clean-build Bonfire data extensions
2022-04-16 22:24:09 +00:00
run: mix bonfire.deps.clean.data
2021-11-25 01:50:02 +00:00
- name: Compile deps & app
2022-04-17 05:54:46 +00:00
run: mix compile
2021-11-25 01:50:02 +00:00
- name: Set up database
2021-11-25 02:21:03 +00:00
run: mix ecto.setup
2021-11-25 01:50:02 +00:00
- name: Run tests
run: mix test
2022-05-03 05:22:29 +00:00
- name: Check database down migrations
run: mix ecto.rollback --all
2021-11-25 01:50:02 +00:00
2022-05-10 08:49:32 +00:00
# test_cooperation_flavour:
# name: Test cooperation flavour
# runs-on: ubuntu-latest
# container: elixir:1.13-alpine
# env:
# FLAVOUR: cooperation
# MIX_ENV: test
# WITH_DOCKER: no
# POSTGRES_HOST: postgres
# POSTGRES_PASSWORD: postgres
# CI: true
# SECRET_KEY_BASE: "kSNSvYkWk14onNdbYzhEqFyG5TzpOO9+FFlk5sIrhTk0RV6+FeL/nM8DWQffDah4woepgQdrP6J8cjWGyehcWcRWvIIWXsghp0yY9/fEjgfUekD15P9LGRCmu6exIQ6g"
# SIGNING_SALT: "NPkqpeTx/q9xGQRWwRpqBWI7bCxeHMAF4L2PHntfjVtd8GZD2BQKe9KLnkIR5WbLVdZt24FWuR+Hy5WoXaZM4APydGvC2+w2enJmskOckX5VY1Bpvm7JGKu+QymgIgK/"
# ENCRYPTION_SALT: "l+QT/gkdX722f57qSAUc+bZcqm5ZduXY4D0hp0glEiKdR267JsZ1/CZlrlhADcD8kzuaZGFWvJ2dlr6sujbzGQV5e04lKVIsZh3gfd8eqQBckIqH6L8TDRRz4M07YE+F"
# services:
# postgres:
# # image: postgres
2022-10-17 01:02:24 +00:00
# image: postgis/postgis:12-3.3-alpine
2022-05-10 08:49:32 +00:00
# env:
# POSTGRES_DB: bonfire_test
# POSTGRES_PASSWORD: postgres
# ports:
# - 5432:5432
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# steps:
# -
# name: Install git (needed for checkout), tar (needed for cache), file (needed for bonfire_files)
# run: apk add git tar file
# -
# name: Checkout repo
# uses: actions/checkout@v2
# with:
# fetch-depth: 2 # needed for action-detect-and-tag-new-version
# # - name: Set up Elixir
# # uses: actions/setup-elixir@v1
# # with:
# # elixir-version: ${{ matrix.elixir }}
# # otp-version: ${{ matrix.otp }}
# - name: Restore dependencies cache
# uses: actions/cache@v2
# id: cache
# with:
# path: |
# deps
# _build
# key: ${{ runner.os }}-mix-${{ hashFiles('/mix.lock') }}
# restore-keys: ${{ runner.os }}-mix-
# - name: Install system deps
# run: apk add mailcap ca-certificates openssl-dev tzdata gettext rust cargo make
# - name: Install hex
# run: mix local.hex --force
# - name: Install rebar
# run: mix local.rebar --force
# - name: Prepare environment
# run: make pre-run
# - name: Install dependencies
# run: mix deps.get
# - name: Update Bonfire extensions to latest git versions
# run: mix bonfire.deps.update
# - name: Fetch any differences in nested deps
# run: mix deps.get
# - name: Clean-build Bonfire data extensions
# run: mix bonfire.deps.clean.data
# - name: Compile deps & app
# run: mix compile
# - name: Set up database
# run: mix ecto.setup
# - name: Run tests
# run: mix test
# - name: Check database down migrations
# run: mix ecto.rollback --all