Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo0807 committed Jul 26, 2024
2 parents 8a59283 + c46cede commit 1b56c79
Show file tree
Hide file tree
Showing 47 changed files with 712 additions and 1,162 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Please complete the following information:**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Elixir Version [e.g. 1.16]
- Backpex Version [e.g. 0.5.0]

**Additional context**
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Community Support
url: https://github.com/naymspace/backpex/discussions
about: Please ask and answer questions here.
- name: Feature Requests
url: https://github.com/naymspace/backpex/discussions/categories/ideas
about: Share ideas for new features here.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ updates:
reviewers:
- 'krns'
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
reviewers:
- 'krns'
201 changes: 90 additions & 111 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: CI
on:
workflow_dispatch:
push:
branches:
- main
- develop
pull_request:
branches:
- main
Expand All @@ -12,7 +15,6 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME_TESTING: ${{ github.repository }}/testing
IMAGE_NAME_RUNTIME: ${{ github.repository }}/runtime

jobs:
Expand All @@ -21,8 +23,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
elixir: ["1.16.2", "1.15.7"]
erlang: ["26.2.2", "25.3.2"]
elixir: ["1.17", "1.16"]
erlang: ["27.0", "26.2"]
exclude:
- elixir: "1.16"
erlang: "27.0"

steps:
- name: Checkout code
Expand Down Expand Up @@ -105,21 +110,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Determine the elixir version
id: elixir_version
run: echo "version=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_OUTPUT

- name: Determine the otp version
id: otp_version
run: echo "version=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_OUTPUT

- name: Use versions
run: echo "Using Elixir version ${{ steps.elixir_version.outputs.version }} and OTP version ${{ steps.otp_version.outputs.version }}"

- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: ${{ steps.otp_version.outputs.version }}
elixir-version: ${{ steps.elixir_version.outputs.version }}
version-file: .tool-versions
version-type: strict

- name: Install dependencies
run: |
Expand All @@ -132,153 +127,137 @@ jobs:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --yes

build-testing:
name: "Build testing"
test-demo:
name: "Test (Demo)"
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "5432:5432"

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the container registry
uses: docker/login-action@v3
- name: Setup beam
uses: erlef/setup-beam@v1
id: beam
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
version-file: .tool-versions
version-type: strict

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
- name: Setup node
uses: actions/setup-node@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_TESTING }}
node-version: 20
cache: 'yarn'
cache-dependency-path: demo/yarn.lock

- name: Build and push container
id: docker
uses: docker/build-push-action@v5
- name: Restore the deps cache
uses: actions/cache@v4
id: deps-cache
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_TESTING }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_TESTING }}:buildcache,mode=max
target: builder
build-args: |
MIX_ENV=test
outputs:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_TESTING }}@${{ steps.docker.outputs.digest }}
path: demo/deps
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps-demo-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/demo/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-deps-demo-
- name: Restore the _build cache
uses: actions/cache@v4
id: build-cache
with:
path: demo/_build
key: ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-build-demo-mixlockhash-${{ hashFiles(format('{0}{1}', github.workspace, '/demo/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-build-demo-
- name: Install dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
working-directory: demo
run: |
mix local.hex --force --if-missing
mix local.rebar --force --if-missing
mix deps.get
- name: Compile dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
working-directory: demo
run: mix deps.compile

lint-demo:
needs: build-testing
name: "Lint (Demo)"
runs-on: ubuntu-latest
container:
image: ${{ needs.build-testing.outputs.image }}
- name: Compile with warnings as errors
working-directory: demo
run: |
mix compile --warnings-as-errors --force
- name: Install node dependencies
working-directory: demo
run: yarn install --pure-lockfile

steps:
- name: lint:mix
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:mix
- name: Add tar that supports --posix option to be used by cache action
run: |
apk add --no-cache tar
- name: lint:credo
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:credo
- name: lint:sobelow
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:sobelow
- name: lint:style
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:style
- name: lint:standard
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:standard
- name: lint:deps-unused
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:deps-unused
- name: lint:gettext
working-directory: /opt/app/demo
working-directory: demo
run: |
yarn lint:gettext
test-compile:
needs: build-testing
name: "Compile (Demo)"
runs-on: ubuntu-latest
container:
image: ${{ needs.build-testing.outputs.image }}

steps:
- name: Compile with warnings as errors
working-directory: /opt/app/demo
run: |
mix compile --warnings-as-errors --force
test-demo:
needs: build-testing
name: "Test (Demo)"
runs-on: ubuntu-latest
container:
image: ${{ needs.build-testing.outputs.image }}
env:
POSTGRES_DB: test
POSTGRES_PASSWORD: postgres
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Run test
working-directory: /opt/app/demo
working-directory: demo
env:
DB_HOSTNAME: localhost
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_DATABASE: test
run: |
yarn test
deps-audit:
needs: build-testing
name: "Deps Audit (Demo)"
runs-on: ubuntu-latest
container:
image: ${{ needs.build-testing.outputs.image }}

steps:
- name: Deps audit
working-directory: /opt/app/demo
working-directory: demo
continue-on-error: true
run: |
mix deps.audit
build-runtime:
name: "Build runtime"
name: "Build and push image (Demo)"
runs-on: ubuntu-latest
needs: [lint-demo, test-compile, test-demo, deps-audit]
needs: [test-demo]
if: github.event_name == 'push'

permissions:
contents: read
Expand All @@ -305,7 +284,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_RUNTIME }}

- name: Build container
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 26.2.2
elixir 1.16.2-otp-26
erlang 27.0.1
elixir 1.17.2-otp-27
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Stage: builder
########################################################################

FROM hexpm/elixir:1.16.3-erlang-26.2.5-alpine-3.20.0 as builder
FROM hexpm/elixir:1.17.2-erlang-27.0.1-alpine-3.20.1 as builder

ENV MIX_HOME=/opt/mix \
HEX_HOME=/opt/hex \
Expand Down
6 changes: 6 additions & 0 deletions demo/assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ module.exports = {
'primary-content': 'white',
secondary: '#f39325',
'secondary-content': 'white'
},
dark: {
...require('daisyui/src/theming/themes').dark
},
cyberpunk: {
...require('daisyui/src/theming/themes').cyberpunk
}
}
]
Expand Down
5 changes: 0 additions & 5 deletions demo/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ config :demo, DemoWeb.Endpoint,
signing_salt: fetch_env!("LIVE_VIEW_SIGNING_SALT")
]

config :demo, Demo.Newsletter.Brevo,
api_key: get_env("BREVO_API_KEY"),
include_list_ids: get_env("BREVO_INCLUDE_LIST_IDS", "0,42,1337") |> split(",") |> Enum.map(&to_integer/1),
template_id: get_env("BREVO_TEMPLATE_ID", "0") |> to_integer()

config :demo, DemoWeb.DashboardAuthPlug,
enabled: get_env("DASHBOARD_AUTH_ENABLED", "false") |> to_existing_atom(),
username: get_env("DASHBOARD_AUTH_USERNAME", "backpex"),
Expand Down
Loading

0 comments on commit 1b56c79

Please sign in to comment.