mirror of
https://codeberg.org/JasterV/spazio-solazzo.git
synced 2026-04-26 18:20:03 +00:00
This pull request refactors and improves the GitHub Actions CI/CD workflow setup and enhances the application header component. The changes consolidate and clarify deployment workflows for production and review environments, improve environment variable handling, and update the application UI for greater flexibility. **CI/CD Workflow Refactoring and Improvements:** * Consolidated the CI workflow in `.github/workflows/ci.yml` to support both manual and reusable workflow triggers, making it easier to compose in other workflows. * Removed the old deployment workflows (`fly-deploy.yml` and `fly-review.yml`) in favor of new, clearer workflows for production (`production.yml`) and review apps (`review.yml`). These new workflows use reusable CI steps, improved secret management, and explicit environment configuration [[1]](diffhunk://#diff-e98bb23501189d64a1cee3fab4260cfa5fb4e0bf50a7352fc8c4bfe1939f92c2L1-L18) [[2]](diffhunk://#diff-360ed408b1160aff40b11529c2471f642a393cfd9375757bf6d4da2c7ab78db7L1-L34) [[3]](diffhunk://#diff-d5171f9b8c42863b1e934fda1fefedf968913c65aa5d715555a696fb3cbd4c7eR1-R45) [[4]](diffhunk://#diff-ebc21ccd816b27c07389e15ad88c9e74b71bde5e8e315e4e30902097d38386e5R1-R66). * Added a new `fly.review.toml` configuration file to standardize review app deployments on Fly.io, specifying build, deploy, environment, and VM settings. * Updated `fly.toml` to explicitly specify the Dockerfile for builds, improving deployment reliability. **Environment and Configuration Handling:** * Changed the application to require the `PHX_HOST` environment variable at runtime, raising an error if it is missing. This ensures correct host configuration for all deployments. **UI Component Enhancement:** * Refactored the `app_header` component to accept customizable `title` and `icon` attributes, and updated its usage in the main layout to display "Spazio Solazzo" with a sun icon. This makes the header more flexible and visually consistent [[1]](diffhunk://#diff-4b44e6943316f34ab5bf0f9ea1956fd2a65dc8a7cbb9c5a381578c13c6e559f6L42-R42) [[2]](diffhunk://#diff-4b44e6943316f34ab5bf0f9ea1956fd2a65dc8a7cbb9c5a381578c13c6e559f6R119-R138).
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
MIX_ENV: test
|
|
|
|
jobs:
|
|
ci:
|
|
# Service containers to run with `container-job`
|
|
services:
|
|
# Label used to access the service container
|
|
postgres:
|
|
# Docker Hub image
|
|
image: postgres
|
|
# Provide the password for postgres
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
# Set health checks to wait until postgres has started
|
|
options: >-
|
|
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
name: Run CI on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
otp: ["27.3"]
|
|
elixir: ["1.18.3"]
|
|
|
|
steps:
|
|
- name: Set up Elixir
|
|
uses: erlef/setup-beam@v1
|
|
with:
|
|
elixir-version: ${{matrix.elixir}}
|
|
otp-version: ${{matrix.otp}}
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
# Step: Define how to cache deps. Restores existing cache if present.
|
|
- name: Cache deps
|
|
id: cache-deps
|
|
uses: actions/cache@v4
|
|
env:
|
|
cache-name: cache-spazio-solazzo-deps
|
|
with:
|
|
path: spazio-solazzo/deps
|
|
key: ${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}}-${{ env.cache-name }}-${{ hashFiles('spazio-solazzo/**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}}-${{ env.cache-name }}-
|
|
|
|
# Step: Define how to cache the `_build` directory. After the first run,
|
|
# this speeds up tests runs a lot. This includes not re-compiling our
|
|
# project's downloaded deps every run.
|
|
- name: Cache compiled build
|
|
id: cache-build
|
|
uses: actions/cache@v4
|
|
env:
|
|
cache-name: cache-spazio-solazzo-compiled-build
|
|
with:
|
|
path: spazio-solazzo/_build
|
|
key: ${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}}-${{ env.cache-name }}-${{ hashFiles('spazio-solazzo/**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}}-${{ env.cache-name }}
|
|
${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}}-
|
|
|
|
- name: Install dependencies
|
|
run: mix deps.get
|
|
|
|
# Step: Compile the project treating any warnings as errors.
|
|
- name: Compiles without warnings
|
|
run: mix compile --warnings-as-errors
|
|
|
|
# Step: Check that the checked in code has already been formatted.
|
|
# This step fails if something was found unformatted.
|
|
- name: Check Formatting
|
|
run: mix format --check-formatted
|
|
|
|
# Step: Execute Credo
|
|
- name: Run Credo
|
|
run: mix credo
|
|
|
|
# Step: Execute the tests.
|
|
- name: Run tests
|
|
run: mix test
|