It is a memorandum because I investigated the Maven + Java project created in the following article with the intention of turning it with CI. https://qiita.com/kasa_le/items/db0d84e3e868ff14bc2b
AppVeyor
You can register here. https://www.appveyor.com/
Basically, it seems that the main purpose is to build on Windows or Visual Studio.
You can also connect to Git other than Github, GitLab, and Bitbucket. (* However, there are some restrictions. See below) Also, I had to connect to SSH with Git, but AppVeyor also supports this.
It also supports cache.
There are also macOS (Catalina, Majave) and Ubuntu in the OS image, but I had a lot of trouble because there was no template for Maven build or something like that.
Free if open source. Other than that, it is basically a monthly charge. If the project seems to be up and running, but it has expired, it may be good because it is easy to estimate the cost. There is no particular mention of the number of team members, so I think there is no limit. https://www.appveyor.com/docs/team-setup/
Sakura editor is famous as a text editor that is easy to use on Windows, but it seems that AppVeyor is used. (It seems to be used with Azure Pipelines)
Basically, CI jobs are defined by placing a file called ʻappveyor.yml` directly under the root of the project.
The first thing to do is that the build is an MS build (for Visual Studio), so you need to unset it from your browser.
--Open the project page and select [Build] on the [Settings] tab.
--Select [Script] next to [MSBuild]
--Click [Save]
This completes the preparation.
For the time being, here is ʻappveyor.yml`, which was finally built and tested successfully.
appveyor.yml
# Branches
branches:
only:
- feature/for_ci_test
image: ubuntu
install:
- sh: sudo add-apt-repository --yes ppa:rpardini/adoptopenjdk
- sh: sudo apt-get update
- sh: sudo apt-get install -y adoptopenjdk-11-jdk-hotspot-installer
- sh: sudo apt install adoptopenjdk-11-jdk-hotspot-set-default
#/usr/lib/jvm/adoptopenjdk-11-jdk-hotspot
- sh: export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-11-jdk-hotspot
- sh: echo $JAVA_HOME
- sh: export PATH=${PATH}
before_build:
- mvn -v
build_script:
- mvn clean package -DskipTests
test_script:
- mvn install verify
on_finish:
- sh: |
find "$APPVEYOR_BUILD_FOLDER" -type f -name 'TEST*.xml' -print0 | xargs -0 -I '{}' curl -F 'file=@{}' "https://ci.appveyor.com/api/testresults/junit/$APPVEYOR_JOB_ID"
artifacts:
- path: "**/target/*.?ar"
version: "1.1.{build}"
The contents are as follows,
--branches
section
--Run only on the feature / for_ci_test
branch
section --Install adoptopenjdk-11 and set the path --You can also set JDK 11 as
stack: jdk 11, but it had to be installed separately because the version of the JDK you are riding is old and the bug has not been resolved. ――The reason why I set the path by force is that the method of switching between other versions did not work. --
before_build section --Check Maven version --
build_script section --maven build (skip JUnit test) --
test_script section --mvn command (with test) --ʻOn_finish
section
--Upload JUnit test report to report page
--ʻArtifactssection --Save
* .jar and
* .war as artifacts --
version` section
--Build version settingsIf you commit and push this directly under the root of the project, CI will start running.
Since it can be cached, it may be good to target Java folders. In that case, you need to rewrite the sh command part to decide whether to install jdk depending on the presence or absence of the cache.
In the Github repository, if you put the above ʻappveyor.yml, it builds using it, but when connecting to Git other than the repository services ** such as Github, GitLab, Bitbucket ** (for example, your company) (Git server etc. set up in) is placed in the project ʻappveyor.yml
Did not seem to see me at all.
For the time being, similar settings can be set from the browser, but it was a lot of work because I had to set it here and there across pages, and I could not reach the itchy place, so I will consider using it. Be careful if you do.
Originally it was for builds in Visual Studio, so it was also for projects such as C #, and I had the impression that other than that, there was not much focus. I honestly thought it would be better to consider a CI service that is rich in those templates.
Also, my sample project (JerseySample) passed both build and test, but another project running in the same environment could not be passed in the following state.
OS image | phenomenon |
---|---|
On windows | Will it crash during a Maven build?Exit 1 Resulting in |
on macOS | Maven builds stop responding or builds never end |
On ubuntu | Will it crash in the middle of the test?Exit 1 Resulting in(※手元のOn ubuntuではビルドもテストも正常終了する |
Recommended Posts