Skip to content

Add service info

Add service info #2335

Workflow file for this run

name: Continous Integration
on:
push:
branches:
- main
paths-ignore:
- "VERSION"
- "CHANGELOG.md"
pull_request:
paths-ignore:
- "VERSION"
workflow_dispatch:
workflow_call:
repository_dispatch:
types: [start-ci]
env:
MIX_ENV: test
ELIXIR_BC: "1.15.7-otp-26"
ERLANG_BC: "26.2.1"
jobs:
setup-matrix-env:
runs-on: ubuntu-24.04
outputs:
ELIXIR_DEV: ${{ env.ELIXIR_VERSION }}
ERLANG_DEV: ${{ env.ERLANG_VERSION }}
RUST_DEV: ${{ env.RUST_VERSION }}
ELIXIR_BC: ${{ env.ELIXIR_BC }}
ERLANG_BC: ${{ env.ERLANG_BC }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: gather versions
uses: endorama/asdf-parse-tool-versions@c981d1f09f7fad3a91bc97b6d28ce6ec0c93ded5 # v1
- name: Compute matrix
run: |
echo "ELIXIR_DEV=${{ env.ELIXIR_VERSION }}" >> $GITHUB_OUTPUT
echo "ERLANG_DEV=${{ env.ERLANG_VERSION }}" >> $GITHUB_OUTPUT
echo "RUST_DEV=${{ env.RUST_VERSION }}" >> $GITHUB_OUTPUT
echo "ELIXIR_BC=${{ env.ELIXIR_BC }}" >> $GITHUB_OUTPUT
echo "ERLANG_BC=${{ env.ERLANG_BC }}" >> $GITHUB_OUTPUT
elixir-deps:
name: Elixir dependencies
uses: ./.github/workflows/deps.yaml
static-code-analysis:
name: Static Code Analysis
needs: [setup-matrix-env, elixir-deps]
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Setup
id: setup-elixir
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Retrieve Elixir Cached Dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-rust-${{ needs.setup-matrix-env.outputs.RUST_DEV }}-${{ hashFiles('mix.lock') }}
- name: Check for Unused Dependencies
run: mix deps.unlock --check-unused
- name: Check Code Format
run: mix format --check-formatted
- name: Run Credo
run: mix credo --strict
- name: Run Dialyzer
run: mix dialyzer
test:
name: Test
needs: [setup-matrix-env, elixir-deps]
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: wanda_test
ports:
- 5434:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbitmq:
image: rabbitmq
env:
RABBITMQ_DEFAULT_USER: wanda
RABBITMQ_DEFAULT_PASS: wanda
ports:
- 5674:5672
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Setup
id: setup-elixir
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Retrieve Cached Dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-rust-${{ needs.setup-matrix-env.outputs.RUST_DEV }}-${{ hashFiles('mix.lock') }}
- name: Compile
run: mix compile --warnings-as-errors
- name: Run test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mix coveralls.github --warnings-as-errors --color --trace
main-branch-deps:
name: main branch dependencies
if: github.event_name == 'pull_request'
uses: ./.github/workflows/deps.yaml
with:
checkout_ref: main
target-branch-deps:
name: Rebuild target branch dependencies
needs: [setup-matrix-env]
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
if: github.event_name == 'pull_request'
steps:
- name: Checkout target branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Set up Elixir
id: setup-elixir
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Retrieve Elixir Cached Dependencies - target branch
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache-target
with:
path: |
deps
_build/${{ env.MIX_ENV }}
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}-${{ env.MIX_ENV }}
- name: Install missing dependencies
if: steps.mix-cache-target.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile --warnings-as-errors
mix dialyzer --plt
api-docs-check:
name: API docs check
needs: [setup-matrix-env, elixir-deps]
if: github.event_name == 'pull_request' && !failure() && !cancelled()
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Elixir
id: setup-elixir
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Retrieve Cached Dependencies - current branch
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache-current
with:
path: |
deps
_build/${{ env.MIX_ENV }}
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-rust-${{ needs.setup-matrix-env.outputs.RUST_DEV }}-${{ hashFiles('mix.lock') }}
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 22.15.1
- name: Install API linting tools
run: |
npm install -g @redocly/cli@latest
npm install -g @quobix/vacuum@latest
npm install -g @stoplight/spectral-cli
- name: Run API docs check
run: ./hack/api_docs_check.sh
api-bc-check:
name: API bc check
needs: [setup-matrix-env, elixir-deps, target-branch-deps]
if: github.event_name == 'pull_request' && !failure() && !cancelled()
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- version: Unversioned
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- version: Unversioned
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
- version: V1
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- version: V1
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
- version: V2
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- version: V2
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
- version: V3
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_BC }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_BC }}
- version: V3
elixir: ${{ needs.setup-matrix-env.outputs.ELIXIR_DEV }}
otp: ${{ needs.setup-matrix-env.outputs.ERLANG_DEV }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
with:
access_token: ${{ github.token }}
- name: Checkout current branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Elixir
id: setup-elixir
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Retrieve Cached Dependencies - current branch
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache-current
with:
path: |
deps
_build/${{ env.MIX_ENV }}
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-rust-${{ needs.setup-matrix-env.outputs.RUST_DEV }}-${{ hashFiles('mix.lock') }}
- name: Generate current openapi.json
run: |
mix openapi.spec.json --start-app=false --spec WandaWeb.Schemas.${{ matrix.version }}.ApiSpec /tmp/specs/current-spec.json
- name: Checkout target branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.pull_request.base.ref || github.ref_name }}
- name: Retrieve Elixir Cached Dependencies - target branch
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache-target
with:
path: |
deps
_build/${{ env.MIX_ENV }}
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-rust-${{ needs.setup-matrix-env.outputs.RUST_DEV }}-${{ hashFiles('mix.lock') }}
- name: Generate target openapi.json
run: |
mix openapi.spec.json --start-app=false --spec WandaWeb.Schemas.${{ matrix.version }}.ApiSpec /tmp/specs/target-spec.json
- name: Locate generated specs
run: mv /tmp/specs .
- name: Find difference between OpenAPI specifications
run: |
docker run -v "$(pwd)/specs:/specs" --rm openapitools/openapi-diff:2.0.1 \
/specs/target-spec.json \
/specs/current-spec.json \
--fail-on-incompatible \
--markdown /specs/changes.md \
--text /specs/changes.txt \
--html /specs/changes.html
- name: Upload OpenAPI diff report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
if: failure()
with:
name: openapi-diff-report-${{ matrix.version }}
path: specs/
build-containers:
name: Build containers
needs:
- static-code-analysis
- test
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
strategy:
matrix:
include:
- mix_env: prod
tag: "${{ (github.event_name == 'push' && github.ref_name == 'main' && 'rolling') || github.sha }}"
- mix_env: demo
tag: demo
uses: trento-project/.github/.github/workflows/publish-containers.yaml@98e2a3d821253d603d16fd53fb10bcf85f64b395
with:
image_name: trento-wanda
tag: ${{ matrix.tag }}
extra_build_args: |
MIX_ENV=${{ matrix.mix_env }}
secrets:
gh_token: ${{ secrets.TRENTOBOT_GH_PAT }}
ssh_key: ${{ secrets.TRENTOBOT_SSH_KEY }}
deploy-demo:
runs-on: ubuntu-24.04
if: vars.DEPLOY_DEMO == 'true'
needs:
- build-containers
steps:
- name: Remotely trigger trento-web demo deployment
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3
with:
token: ${{ secrets.WEB_REPO_DISPATCH_PAT }}
repository: ${{ github.repository_owner }}/${{ vars.DEMO_TRIGGER_TARGET || 'web' }}
event-type: deploy-demo
generate-docs:
name: Generate project documentation
runs-on: ubuntu-24.04
if: github.event_name == 'push' && github.ref_name == 'main'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Elixir
id: setup-elixir
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
with:
version-file: .tool-versions
version-type: strict
- name: Retrieve Cached Dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: erlang-${{ steps.setup-elixir.outputs.otp-version }}-elixir-${{ steps.setup-elixir.outputs.elixir-version }}-rust-${{ needs.setup-matrix-env.outputs.RUST_DEV }}-${{ hashFiles('mix.lock') }}
- name: Build docs
uses: lee-dohm/generate-elixir-docs@a745603eef443621976df401f45aaff4d849056b # v1
- name: Generate openapi.json
run: mix openapi.spec.json --start-app=false --spec WandaWeb.Schemas.All.ApiSpec
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@eff65dc3f193f0a749872be82f74baa35be0797d # v1
with:
output: ./doc/swaggerui
spec-file: openapi.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc
obs-sync:
name: OBS sync
if: vars.OBS_ENABLED == 'true' && (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/obs.yaml
needs:
- static-code-analysis
- test
secrets: inherit
with:
obs_project: ${{ vars.OBS_PROJECT_ROLLING }}