feat: re-enable tests in production CI workflow (#217)
Re-add the test-exunit job that runs all ExUnit tests before deployment. The build-and-deploy job now depends on tests passing first. All 8837 tests are currently passing locally with 0 failures. Reviewed-on: graham/towerops-web#217
This commit is contained in:
parent
d9b929038b
commit
afb9fcc538
1 changed files with 70 additions and 0 deletions
|
|
@ -10,9 +10,79 @@ env:
|
|||
IMAGE_NAME: graham/towerops-web
|
||||
|
||||
jobs:
|
||||
test-exunit:
|
||||
name: Run ExUnit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
MIX_ENV: test
|
||||
DATABASE_URL: ecto://postgres:postgres@postgres/towerops_test
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: timescale/timescaledb:latest-pg17
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: towerops_test
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Elixir
|
||||
uses: https://github.com/erlef/setup-beam@v1
|
||||
with:
|
||||
version-type: strict
|
||||
elixir-version: '1.18.1'
|
||||
otp-version: '27.2'
|
||||
|
||||
- name: Cache Mix
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: ~/.mix
|
||||
key: ${{ runner.os }}-mix-1.18.1-27.2
|
||||
restore-keys: ${{ runner.os }}-mix-
|
||||
|
||||
- name: Cache deps
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: deps
|
||||
key: ${{ runner.os }}-deps-${{ hashFiles('mix.lock') }}
|
||||
restore-keys: ${{ runner.os }}-deps-
|
||||
|
||||
- name: Cache _build
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: _build
|
||||
key: ${{ runner.os }}-build-v2-${{ hashFiles('lib/**/*.ex') }}-${{ hashFiles('mix.lock') }}
|
||||
restore-keys: ${{ runner.os }}-build-v2-
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libssl-dev libsnmp-dev snmp-mibs-downloader postgresql-client
|
||||
|
||||
- name: Install dependencies
|
||||
run: mix deps.get
|
||||
|
||||
- name: Compile C NIF
|
||||
run: make -C c_src
|
||||
|
||||
- name: Compile (warnings as errors)
|
||||
run: mix compile --warnings-as-errors
|
||||
|
||||
- name: Run tests
|
||||
run: mix test
|
||||
|
||||
build-and-deploy:
|
||||
name: Build and Deploy to Production
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [test-exunit]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue