Skip to content

Commit

Permalink
refactor(ci)(cd): more advanced ci/cd (#2)
Browse files Browse the repository at this point in the history
adding tests for CI and docker image publish for CD
  • Loading branch information
datYori authored Oct 1, 2024
1 parent 1ff5ecd commit 09259ba
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/scripts/dnd-sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -exu
SCRIPT_HOME="$(cd "$(dirname "$0")"; pwd)"
COMPONENT_HOME="$(cd "${SCRIPT_HOME}/../.."; pwd)"

cd "${COMPONENT_HOME}"

tmp_dir=$(mktemp -d -t dnd-sbt-XXXXXXXXXX)
cp -R . ${tmp_dir}

docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
-v ${HOME}/.docker/config.json:/root/.docker/config.json \
-v ${tmp_dir}:/root/ \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.2_13_1.9.9_2.12.19 \
git config --global --add safe.directory /root; sbt ${1}
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
paths:
- .github/workflows/ci.yaml
- .sbtopts
- build.sbt
- .scalafmt.conf
- project/**
Expand Down Expand Up @@ -32,3 +33,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sbt clean test
docker-buid:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- run: .github/scripts/dnd-sbt docker/Docker/publishLocal
17 changes: 16 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: publish
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
Expand All @@ -8,7 +9,7 @@ env:
GITHUB_TOKEN: ${{ secrets.WRITE_PACKAGES }}

jobs:
publish:
publish-jars:
runs-on: self-hosted
container:
image: sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.2_13_1.9.9_2.12.19
Expand All @@ -19,3 +20,17 @@ jobs:
fetch-depth: 0
- name: sbt publish
run: sbt clean publish
publish-docker-image:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.WRITE_PACKAGES }}
logout: false
- name: publish docker images
run: .github/scripts/dnd-sbt docker/Docker/publish
7 changes: 7 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-J-Xmx4G
-J-Xms1G
-J-Xss4M
-J-XX:+UseG1GC
-J--add-opens=java.base/java.lang=ALL-UNNAMED
-J--add-opens=java.base/java.util=ALL-UNNAMED
-J-XX:+CrashOnOutOfMemoryError

0 comments on commit 09259ba

Please sign in to comment.