Compare commits

...

21 commits

Author SHA1 Message Date
hirst 6a21ca2b48 Merge pull request 'dev to basic spring' (#9) from dev into basic-spring
Reviewed-on: #9
2024-05-31 08:26:26 +02:00
2005 8139318127 pom.xml:
Some checks failed
build and publish docker image / deploy / build (push) Failing after 1m26s
ci build failed due to wrong image being used to compile containers
2024-05-30 06:11:45 +02:00
2005 1c7feef7db actions:
Some checks failed
build and publish docker image / deploy / build (push) Failing after 1m35s
added maven back, but different thistime
2024-05-30 06:09:14 +02:00
2005 acce7ba3cb wtf is happening
Some checks failed
build and publish docker image / deploy / build (push) Failing after 44s
2024-05-30 06:06:43 +02:00
2005 917cec6173 fix: return to older java action
Some checks failed
build and publish docker image / deploy / build (push) Failing after 57s
2024-05-30 06:02:53 +02:00
2005 b0e8c7c06c fix: actions mvn version
Some checks failed
build and publish docker image / deploy / build (push) Failing after 53s
2024-05-30 06:00:48 +02:00
2005 88e852cbcf fix: typo for action
Some checks failed
build and publish docker image / deploy / build (push) Failing after 16s
2024-05-30 05:58:39 +02:00
2005 2aaed98ae6 actions update
Some checks failed
build and publish docker image / deploy / build (push) Failing after 18s
2024-05-30 05:57:47 +02:00
2005 55dfc95a78 due to using forgejo actions some fillins have to be made
Some checks failed
build and publish docker image / deploy / build (push) Failing after 2m8s
2024-05-30 05:29:27 +02:00
2005 0816ba7ee9 ref to github for actions
Some checks failed
build and publish docker image / deploy / build (push) Failing after 2m23s
aslo fixed token
2024-05-30 05:20:35 +02:00
2005 6e3904b153 act to build and publish images, test
Some checks failed
build and publish docker image / deploy / build (push) Failing after 20s
2024-05-30 04:20:39 +02:00
2005 24eae7839c removed result 2024-05-28 23:46:43 +02:00
2005 64305b10dd flake done? 2024-05-28 23:42:05 +02:00
2005 024312776a hydra config 2024-05-27 20:39:00 +02:00
2005 3e80c6a896 added dummy to flake 2024-05-27 20:26:32 +02:00
2005 3534dee0f4 flake build eureka and gateway 2024-05-27 18:34:24 +02:00
2005 977a943504 Merge branch 'master' of https://git.4o1x5.dev/LearningPulse/server into ci 2024-05-27 18:16:10 +02:00
hirst d03b910044 Merge pull request 'basic-spring to master' (#5) from basic-spring into master
Reviewed-on: #5
Reviewed-by: 2005 <4o1x5@4o1x5.dev>
Reviewed-by: Seiwy <bmate20050911@gmail.com>
2024-05-27 17:32:46 +02:00
2005 9b23cd16c2 switched to mkderivation 2024-05-25 16:33:17 +02:00
2005 d811c86345 Merge branch 'master' of https://git.4o1x5.dev/LearningPulse/server into flake 2024-05-25 16:30:15 +02:00
2005 fbfa29a867 tryna build with java 2024-05-24 09:37:55 +02:00
6 changed files with 188 additions and 45 deletions

33
.github/workflows/build_deploy_dev.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: build and publish docker image / deploy
on:
push:
branches: ["dev"]
pull_request:
branches: ["dev"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v4
with:
repository: 'learningpulse/server'
ref: 'dev'
token: '${{ secrets.token }}'
- name: 'Set up java 22'
uses: https://github.com/actions/setup-java@v3
with:
java-version: "22"
distribution: "temurin"
- name: "Setup maven"
uses: https://github.com/stCarolas/setup-maven@v5
- name: Build with Maven
run: mvn -Dtoken=${{ secrets.token }} clean compile jib:build -e

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
result/*
result

View file

@ -2,18 +2,17 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1716293225, "lastModified": 1716509168,
"narHash": "sha256-pU9ViBVE3XYb70xZx+jK6SEVphvt7xMTbm6yDIF4xPs=", "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3eaeaeb6b1e08a016380c279f8846e0bd8808916", "rev": "bfb7a882678e518398ce9a31a881538679f6f092",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "id": "nixpkgs",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "type": "indirect"
"type": "github"
} }
}, },
"root": { "root": {

113
flake.nix
View file

@ -1,48 +1,95 @@
{ {
description = "Learning Pulse"; description = "CI, devshell and package definition for learningpulse";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
}; };
outputs = { self, nixpkgs, ... }:
outputs =
{ self
, nixpkgs
, maven
, makeWrapper
}:
let let
javaVersion = 22; # TODO add more systems
overlays = [ system = "x86_64-linux";
(final: prev: rec { pkgs = import nixpkgs { inherit system; };
jdk = prev."jdk${toString javaVersion}";
gradle = prev.gradle.override { java = jdk; };
maven = prev.maven.override { inherit jdk; };
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
buildPackages = with pkgs; [
jdk22
makeWrapper
];
in in
rec {
packages.${system} =
{ {
hydraJobs = { learningpulse-gateway = pkgs.maven.buildMavenPackage rec {
gateway = maven.buildMavenPackage rec { pname = "gateway";
pname = "learningpulse-gateway"; version = "0.0.1";
version = "1.2.1";
# src = ./.;
# hello i wrote something here to test pulling # todo get automatically
mvnHash = "sha256-YCK1Qujgx73cZdEx2mRip+y+66px5TxL247fBIMyoy4=";
nativeBuildInputs = buildPackages;
installPhase = ''
mkdir -p $out/bin $out/share/${pname}
install -Dm644 ${pname}/target/${pname}-${version}.jar $out/share/${pname}
makeWrapper ${pkgs.jre8}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/share/${pname}/${pname}-${version}.jar"
'';
};
learningpulse-eureka = pkgs.maven.buildMavenPackage rec {
pname = "eureka";
version = "0.0.1";
src = ./.;
# todo get automatically
mvnHash = "sha256-YCK1Qujgx73cZdEx2mRip+y+66px5TxL247fBIMyoy4=";
nativeBuildInputs = buildPackages;
installPhase = ''
mkdir -p $out/bin $out/share/${pname}
install -Dm644 ${pname}/target/${pname}-${version}.jar $out/share/${pname}
makeWrapper ${pkgs.jre8}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/share/${pname}/${pname}-${version}.jar"
'';
};
learningpulse-dummy = pkgs.maven.buildMavenPackage rec {
pname = "dummy";
version = "0.0.1";
src = ./.;
# todo get automatically
mvnHash = "sha256-YCK1Qujgx73cZdEx2mRip+y+66px5TxL247fBIMyoy4=";
nativeBuildInputs = buildPackages;
installPhase = ''
mkdir -p $out/bin $out/share/${pname}
install -Dm644 ${pname}/target/${pname}-${version}.jar $out/share/${pname}
makeWrapper ${pkgs.jre8}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/share/${pname}/${pname}-${version}.jar"
'';
}; };
}; };
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell { hydraJobs = {
packages = with pkgs; [ inherit (self)
jdk packages;
};
devShells."${system}".default = pkgs.mkShell {
buildInputs = with pkgs; [
maven maven
jdk22
jre8
# top run actions locally
act
]; ];
}; };
});
}; };
} }

39
pom.xml
View file

@ -67,6 +67,45 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<from>
<image>eclipse-temurin:22-jre</image>
<!-- <auth>
<username>${dockerusername}</username>
<password>${dockerpassword}</password>
</auth> -->
<platforms>
<platform>
<architecture>amd64</architecture>
<os>linux</os>
</platform>
<platform>
<architecture>arm64</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
<to>
<image>git.4o1x5.dev/learningpulse/server/${project.artifactId}:${project.version}</image>
<auth>
<username>hydrabot</username>
<password>${token}</password>
</auth>
</to>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>dockerBuild</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>

23
readme.md Normal file
View file

@ -0,0 +1,23 @@
# LearningPulse server
## CI/CD
To check up on builds head to [the hydra server](https://hydra.4o1x5.dev/project/learningpulse)
### Enter developer shell
```bash
nix develop
```
### Build services
```bash
nix build .#learningpulse-dummy
```
### Run service
```bash
nix develop && cd dummy && mvn run spring-boot:run
```