geopaparazzi / GSS

2 stars 5 forks source link

CI system #10

Open frafra opened 3 years ago

frafra commented 3 years ago

I would suggest adding a continuous integration system to test each commit and pull request. A basic CI system could consist initially in building the docker image; basic tests could be added afterwards. We could rely on GitHub Actions (https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action#creating-an-action-metadata-file) or use an external service, like Circle CI.

This would also be beneficial to have basic testing for the dependabot PRs (dependabot could also check for outdated images in Dockerfiles).

I would be glad to help with that. Having a group on GitHub instead of relying on personal repositories, could help others to join in maintaining and supporting projects like GSS and SMASH (configuring dockerhub to read from an organization, setting up github actions, PR policies and such).

moovida commented 3 years ago

With group you mean an organisation?

Actually I don't even know why GSS and SMASH are not yet under the geopaparazzi org: https://github.com/geopaparazzi

If that is what you meant I will be more than happy to move them over there.

(well, for a couple of days I will be working on other things, so it might be towards the weekend).

frafra commented 3 years ago

Right; it could be a good idea to move them there :)

moovida commented 3 years ago

Great, will move things over as soon as possible.

moovida commented 3 years ago

Well, it was very straightforward. It is now all under geopaparazzi. :-)

frafra commented 3 years ago

I would then ask to become part of the organization, so I can propose new PR on this very same repository and configure GitHub actions and such.

frafra commented 2 years ago

It looks like we have some basic CI now, using GitHub actions and Docker build :) That should be just enough to check that the dependencies do not have major issues :)

moovida commented 2 years ago

Since we are at it and you are the actions magician... how much work would it take to port such a script to github actions? :-)

STARTDIR=`pwd`

SOURCEFOLDER=$HOME/development/GEOPAPARAZZI/geopaparazzi-survey-server-flutter

# BUILD BACKBONE
SERVERFOLDER=$SOURCEFOLDER/flutter_server_backbone/
CLIENTFOLDER=$SOURCEFOLDER/flutter_server/

cd $SERVERFOLDER
VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
mvn -q clean
mvn -q install 

cd $STARTDIR

NAME=GSS_$VERSION
BUILDFOLDER=$STARTDIR/$NAME
rm -rd $BUILDFOLDER
rm -rd $BUILDFOLDER.tar.gz
mkdir $BUILDFOLDER
cp -rv $SERVERFOLDER/target/lib $SERVERFOLDER/target/gss-backbone-$VERSION.jar $BUILDFOLDER

# BUILD CLIENT
cd $CLIENTFOLDER
rm -rf $CLIENTFOLDER/build/

flutter build web --release

mv $CLIENTFOLDER/build/web $BUILDFOLDER/public
cp $CLIENTFOLDER/web/favicon.png $BUILDFOLDER/public/

echo "VERSION=$VERSION" > $BUILDFOLDER/run.sh
echo "WORKSPACE=$HOME/GSSSERVER/" >> $BUILDFOLDER/run.sh
echo "MEM=-Xmx4g" >> $BUILDFOLDER/run.sh
echo "java \$MEM -jar gss-backbone-\$VERSION.jar -w \$WORKSPACE -mp testPwd >> $BUILDFOLDER/run.sh

chmod 755 $BUILDFOLDER/run.sh

cd $STARTDIR
tar -czvf $NAME.tar.gz $NAME/
rm -rf $NAME

Clearly some paths refer to my environment.

This would allow for a complete release (also for mere human not using docker).

frafra commented 2 years ago

We have something similar in Docker build already. My suggestion would be to improve the Dockerfile, if needed, and just copy the files out of the Docker image. This would also help in avoiding duplication and make it easier to replicate the CI locally, in my opinion.

moovida commented 2 years ago

Hmmm, it sounds like a great plan. I just didn't even know you could copy files out of the image :-D Usually I guess the reverse is done. Would you be keen/have time to implementing this?

frafra commented 2 years ago

I would be glad to help :)

moovida commented 2 years ago

Thanks, we could do it next week at some point? Then I could be available and maybe contribute (while learning :-) )