Skip to content

Commit

Permalink
Merge pull request #1034 from eyra/release/7
Browse files Browse the repository at this point in the history
Release/7
  • Loading branch information
mellelieuwes authored Jan 8, 2025
2 parents dcf762a + 5ac0554 commit 40442c9
Show file tree
Hide file tree
Showing 275 changed files with 4,018 additions and 1,234 deletions.
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Devcontainer mono",
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],
// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "app",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/app/core",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"jakebecker.elixir-ls",
],
},
},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
26 changes: 26 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.8'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
app:
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- ..:/workspaces:cached

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

58 changes: 58 additions & 0 deletions .github/workflows/release-deprecated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release (deprecated)

on:
workflow_dispatch:
inputs:
bundle:
description: "Bundle ID (next, self)"
required: true
default: "next"
jobs:
tagged-release:
runs-on: ubuntu-20.04
env:
MIX_ENV: prod
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18.19'

- name: Tag name
id: tag
run: echo ::set-output "name=TAG::${{github.event.inputs.bundle}}_$(date +%F)_${{github.run_number}}"

- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.3.2.7"
elixir-version: "1.14.0"

- name: Setup the Elixir project
run: mix deps.get
working-directory: core

- name: Build Frontend
run: ./scripts/build-frontend
working-directory: core

- name: Build release
run: ./scripts/build-release
working-directory: core
env:
BUNDLE: ${{github.event.inputs.bundle}}
VERSION: ${{steps.tag.outputs.tag}}

- name: Archive release
run: tar cfj "../${{steps.tag.outputs.tag}}.tar.bz2" "${{steps.tag.outputs.tag}}"
working-directory: core

- uses: softprops/action-gh-release@v2
with:
tag_name: "${{steps.tag.outputs.tag}}"
prerelease: false
fail_on_unmatched_files: true
files: |
${{steps.tag.outputs.tag}}.tar.bz2
68 changes: 40 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,70 @@
name: Release

on:
push:
branches:
- release/*

workflow_dispatch:
inputs:
bundle:
description: "Bundle ID (next, self)"
required: true
default: "next"

jobs:
tagged-release:
build-release:
runs-on: ubuntu-20.04
env:
MIX_ENV: prod

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18.19'

- name: Tag name
id: tag
run: echo ::set-output "name=TAG::${{github.event.inputs.bundle}}_$(date +%F)_${{github.run_number}}"
ref: ${{ inputs.branch || github.ref }}

- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.3.2.7"
elixir-version: "1.14.0"
- name: Set TAG and VERSION
id: vars
run: |
TAG="${{ inputs.bundle || 'next' }}_$(date +%F)_${{ github.run_number }}"
echo "TAG=$TAG" >> $GITHUB_ENV
echo "VERSION=$TAG" >> $GITHUB_ENV
shell: bash

- name: Setup the Elixir project
run: mix deps.get
working-directory: core
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Frontend
run: ./scripts/build-frontend
working-directory: core
- name: Build Docker Image (dev target) with cache
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: dev
tags: next-platform:latest
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build release
run: ./scripts/build-release
working-directory: core
env:
BUNDLE: ${{github.event.inputs.bundle}}
VERSION: ${{steps.tag.outputs.tag}}
- name: Run build inside Docker
run: |
docker run --rm \
-e MIX_ENV=$MIX_ENV \
-e BUNDLE=${{ inputs.bundle || 'next' }} \
-e VERSION=${{ env.VERSION }} \
-v ${{ github.workspace }}:/app \
next-platform:latest \
bash -c "cd /app/core && ./scripts/build-frontend && ./scripts/build-release"
- name: Archive release
run: tar cfj "../${{steps.tag.outputs.tag}}.tar.bz2" "${{steps.tag.outputs.tag}}"
run: tar cfj "../${{env.VERSION}}.tar.bz2" "${{env.VERSION}}"
working-directory: core

- uses: softprops/action-gh-release@v2
with:
tag_name: "${{steps.tag.outputs.tag}}"
tag_name: "${{env.VERSION}}"
prerelease: false
fail_on_unmatched_files: true
files: |
${{steps.tag.outputs.tag}}.tar.bz2
${{env.VERSION}}.tar.bz2
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- id: setup-elixir
uses: erlef/setup-elixir@v1
with:
otp-version: "25.3.2.7"
elixir-version: "1.14.0"
otp-version: "27.1.2"
elixir-version: "1.17.0-otp-27"

- name: Setup the Elixir project
run: make deps
Expand All @@ -55,9 +55,6 @@ jobs:
message: "Formatted code"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Dialyzer
run: make dialyzer

- name: Compile
run: make compile

Expand All @@ -67,5 +64,5 @@ jobs:
- name: Credo
run: make credo

- name: Format
run: make format
- name: Dialyzer
run: make dialyzer
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
erlang 25.3.2.7
elixir 1.14.0-otp-25
erlang 27.1.2
elixir 1.17.0-otp-27
nodejs 18.19.0
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"type": "mix_task",
"name": "Phoenix Server",
"request": "launch",
"task": "phx.server",
"projectDir": "${workspaceRoot}"
"task": "run",
"projectDir": "${workspaceRoot}/core",
"exitAfterTaskReturns": false
},
{
"type": "mix_task",
Expand Down
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@
* Removed - This notes any features that have been deleted and removed from the software
* Security - This acts as an invitation to users who want to upgrade and avoid any software vulnerabilities

## \#7 unreleased
## \#7.1 unreleased

## \#6.2 unreleased
## \#7 2025-01-07

* Changed: Bump erlang to 27.1.2
* Changed: Bump elixir to 1.17.0
* Fixed: Support for running the app locally in Docker
* Changed: Github release workflow uses Docker
* Changed: Using Debian on production
* Added: Support for sending logging to AppSignal

## \#6.2 2024-11-28

* Added: AppSignal support
* Added: Support for Onyx RIS upload (behind feature flag)

## \#6.1 2024-11-19

Expand Down
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ======================
# Builder Stage
# ======================
FROM debian:12 AS builder

WORKDIR /root

RUN apt-get update && apt-get install -y \
locales \
curl \
git \
build-essential \
unzip \
automake \
autoconf \
libssl-dev \
libncurses-dev \
&& rm -rf /var/lib/apt/lists/*

RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8

RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
ENV PATH="/root/.asdf/bin:/root/.asdf/shims:${PATH}"

RUN asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git && \
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git && \
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git

COPY .tool-versions /root/.tool-versions
RUN asdf install
RUN asdf reshim

RUN mix local.hex --force && mix local.rebar --force
RUN chmod -R a+rX /root/.asdf

COPY ./core /app/core
WORKDIR /app/core


# ======================
# Dev Stage
# ======================
FROM builder AS dev
CMD ["tail", "-f", "/dev/null"]
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,18 @@ docs: ${MIX_PROJECTS:%=%/docs}
cp -R $*/doc/ doc/`basename $*`

.PHONY: FORCE

dockermigrate:
$(MAKE) dockermix cmd="ecto.migrate"

dockerdeps:
$(MAKE) dockermix cmd="deps.get"

dockerrun:
$(MAKE) dockermix cmd="run"

dockermix:
$(MAKE) dockerbash cmd="mix $(cmd)"

dockerbash:
docker compose exec app bash -c "source ~/.bashrc && $(cmd)"
2 changes: 1 addition & 1 deletion banking_proxy/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule BankingProxy.MixProject do
{:ranch, "~> 2.1"},
# Dev and test deps
{:mox, "~> 1.0", only: :test},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
# {:exsync, "~> 0.2", only: :dev},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.26", only: [:dev, :test], runtime: false}
Expand Down
Loading

0 comments on commit 40442c9

Please sign in to comment.