This repository was archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ca10e5
commit 4378b51
Showing
10 changed files
with
244 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Benchmark | ||
|
||
on: | ||
schedule: | ||
- cron: "0 2 * * 1" # Run every Monday at 2:00 AM | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
jobs: | ||
benchmark: | ||
name: Run benchmarks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: "1.17.2" | ||
otp-version: "26" | ||
|
||
- name: Restore dependencies cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: ${{ runner.os }}-mix- | ||
|
||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
- name: Run benchmarks | ||
run: mix bench | ||
|
||
- name: Store benchmark result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
tool: "benchee" | ||
output-file-path: bench.json | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
auto-push: true | ||
# Show alert with commit comment on detecting possible performance regression | ||
alert-threshold: "200%" | ||
comment-on-alert: true | ||
fail-on-alert: true | ||
# Enable Job Summary for PRs | ||
summary-always: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:13 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: "1.17.2" | ||
otp-version: "26" | ||
|
||
- name: Restore dependencies cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: ${{ runner.os }}-mix- | ||
|
||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
- name: Run tests | ||
run: mix test | ||
env: | ||
MIX_ENV: test | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: gakimint_test | ||
|
||
- name: Check formatting | ||
run: mix format --check-formatted | ||
|
||
- name: Run Credo | ||
run: mix credo --strict | ||
|
||
- name: Check for security vulnerabilities | ||
run: mix sobelow --config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
name: Build and publish Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: yourdockerhubusername/gakimint | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Update deployment status | ||
uses: chrnorm/deployment-status@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
state: success | ||
deployment-id: ${{ steps.deployment.outputs.deployment_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,6 @@ gakimint-*.tar | |
|
||
**/node_modules | ||
|
||
**/.DS_Store | ||
**/.DS_Store | ||
|
||
priv/static/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Config | ||
|
||
config :gakimint, GakimintWeb.Endpoint, | ||
url: [ | ||
host: System.get_env("APP_HOST", "localhost"), | ||
port: String.to_integer(System.get_env("PORT", "4000")) | ||
], | ||
cache_static_manifest: "priv/static/cache_manifest.json", | ||
server: true | ||
|
||
config :gakimint, Gakimint.Repo, | ||
url: System.get_env("DATABASE_URL"), | ||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10") | ||
|
||
config :logger, level: :info | ||
|
||
config :gakimint, GakimintWeb.Endpoint, secret_key_base: System.get_env("SECRET_KEY_BASE") | ||
|
||
# Do not print debug messages in production | ||
config :logger, level: :info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Config | ||
|
||
if config_env() == :prod do | ||
database_url = | ||
System.get_env("DATABASE_URL") || | ||
raise """ | ||
environment variable DATABASE_URL is missing. | ||
For example: ecto://USER:PASS@HOST/DATABASE | ||
""" | ||
|
||
config :gakimint, Gakimint.Repo, | ||
url: database_url, | ||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10") | ||
|
||
secret_key_base = | ||
System.get_env("SECRET_KEY_BASE") || | ||
raise """ | ||
environment variable SECRET_KEY_BASE is missing. | ||
You can generate one by calling: mix phx.gen.secret | ||
""" | ||
|
||
config :gakimint, GakimintWeb.Endpoint, | ||
http: [ | ||
port: String.to_integer(System.get_env("PORT") || "4000"), | ||
transport_options: [socket_opts: [:inet6]] | ||
], | ||
secret_key_base: secret_key_base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters