-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add basic initial github action. * Initially just running tests * Add dependabot to maintain github action versions * Add `.rtx.toml` for those that want to use it to manage Java and Scala CLI versions * Add `.vscode/` with some initial settings * Update `.gitignore` * Docker Build * Multi-arch Docker * UTF8 encoding * Docker as non-root user
- Loading branch information
Showing
11 changed files
with
184 additions
and
7 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,8 @@ | ||
# Ignore everything | ||
** | ||
|
||
# Except the following | ||
!src/ | ||
!target/ | ||
!test/ | ||
!project.scala |
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,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: weekly |
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,92 @@ | ||
name: CICD | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "master" | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- "master" | ||
|
||
concurrency: | ||
group: cicd-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REGISTRY: ghcr.io/${{ github.repository_owner }} | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
concurrency: | ||
group: cicd-test-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: coursier/cache-action@v6 | ||
- uses: VirtusLab/scala-cli-setup@v1 | ||
with: | ||
jvm: 21 | ||
- run: scala-cli fmt --check . | ||
- run: scala-cli --power test . | ||
|
||
build: | ||
name: Build and push Docker | ||
permissions: | ||
packages: write | ||
runs-on: ubuntu-latest | ||
|
||
needs: test | ||
|
||
concurrency: | ||
group: cicd-build-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ github.token }} | ||
|
||
- uses: coursier/cache-action@v6 | ||
- uses: VirtusLab/scala-cli-setup@v1 | ||
with: | ||
jvm: 21 | ||
- run: mkdir ./target | ||
- run: scala-cli --power package --standalone . --output ./target/dawn-patrol | ||
|
||
- uses: docker/metadata-action@v5 | ||
id: meta | ||
with: | ||
images: ${{ env.REGISTRY }}/dawn-patrol | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=sha,prefix=pr-${{ github.event.pull_request.number }}-,priority=601,enable=${{ github.event_name == 'pull_request' }} | ||
type=sha,prefix={{branch}}-,priority=601,enable=${{ github.event_name == 'push' && github.ref_type == 'branch' }} | ||
type=ref,event=branch,priority=600 | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: | | ||
type=gha,scope=build | ||
type=registry,ref=${{ env.REGISTRY }}/dawn-patrol:latest | ||
cache-to: type=gha,mode=max,scope=build |
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,3 @@ | ||
[tools] | ||
java = "21" | ||
scala-cli = "1.0.5" |
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,5 @@ | ||
{ | ||
"recommendations": [ | ||
"scala-lang.scala" | ||
] | ||
} |
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,7 @@ | ||
{ | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.eol": "\n", | ||
"files.trimTrailingWhitespace": true, | ||
"files.encoding": "utf8" | ||
} |
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,13 @@ | ||
FROM eclipse-temurin:21 | ||
|
||
RUN adduser --system --group --uid 1000 --shell /bin/bash dawn | ||
|
||
WORKDIR /app | ||
COPY --chown=0:0 ./target/dawn-patrol ./dawn-patrol | ||
|
||
USER dawn | ||
|
||
ENV HF_API_KEY= | ||
ENV OPENAI_TOKEN= | ||
|
||
ENTRYPOINT [ "/app/dawn-patrol" ] |
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