Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foster beeing OS agnostic by introducing other environments (like Windows) to GitHub Actions builds #1622

Closed
jonashackt opened this issue Feb 4, 2021 · 11 comments · Fixed by #1630

Comments

@jonashackt
Copy link
Member

As we have issues like #1617, we should be able to check, if SBA is not also working on the default GitHub Actions Ubuntu, but also on Windows (and maybe Mac - but I think that might be overengineered?).

@jonashackt
Copy link
Member Author

jonashackt commented Feb 4, 2021

Facing the build error

Error:  Unknown lifecycle phase ".javadoc.skip=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

which seems to be Windows Powershell related, where the Powershell tries to interpret . inside the JavaDoc skip command -D maven.javadoc.skip=true as described in https://stackoverflow.com/questions/38051787/maven-javadoc-skip-true-throws-an-error.

jonashackt added a commit that referenced this issue Feb 4, 2021
@ccoltx
Copy link
Contributor

ccoltx commented Feb 4, 2021

Remove it, it's not needed

@jonashackt
Copy link
Member Author

jonashackt commented Feb 4, 2021

No problem @ccoltx 🤪 works with the space between -D and the maven.javadoc parameter.

But now we have the next problem with the spring-javaformat-maven-plugin:

Error:  Failed to execute goal io.spring.javaformat:spring-javaformat-maven-plugin:0.0.27:validate (default) on project spring-boot-admin-server: Formatting violations found in the following files:
Error:   * D:\a\spring-boot-admin\spring-boot-admin\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\config\AdminServerAutoConfiguration.java

I found a workaround in 78e51b2 - but now I'm getting frustrated with the GitHub Actions Matrix build setup - since right now I need to bloat every workflow with "Windows specific" stuff like that:

      # since we also build on Windows Powershell, we need to add a space between -D maven.javadoc.skip=true
      # otherwise the build will fail https://stackoverflow.com/questions/38051787/maven-javadoc-skip-true-throws-an-error
      - name: Build with Maven
        run: |
          mvn -B spring-javaformat:apply --no-transfer-progress
          mvn -B install --no-transfer-progress -D maven.javadoc.skip=true

@jonashackt
Copy link
Member Author

jonashackt commented Feb 4, 2021

Hmm, now the maven-checkstyle-plugin runs amock:

[INFO] --- maven-checkstyle-plugin:3.1.2:check (checkstyle-validation) @ spring-boot-admin-server ---
[INFO] Starting audit...
Error:  D:\a\spring-boot-admin\spring-boot-admin\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\config\AdminServerAutoConfiguration.java:1: Expected line ending for file is LF(\n), but CRLF(\r\n) is detected. [NewlineAtEndOfFile]

This is related to #1555

@jonashackt
Copy link
Member Author

jonashackt commented Feb 6, 2021

Ok, seems that the GitHub Actions windows-latest environment has an issue with Docker (see this build log):

Could not find a valid Docker environment. Please see logs and check configuration

@jonashackt
Copy link
Member Author

Ah, this is a known Testcontainers limitation right now with Windows Server 2019 and Docker:

Docker on Windows Server 2019 is currently not supported (also note this issue testcontainers/testcontainers-java#2960).

jonashackt added a commit that referenced this issue Feb 6, 2021
…since Windows Server 2019 isn't supported right now by Testcontainers testcontainers/testcontainers-java#2960).
@jonashackt
Copy link
Member Author

Hmm, sadly also not working with windows-server2016 GitHub Actions environment.

@jonashackt
Copy link
Member Author

Seems that the problem is, that in Windows Server there are only Windows containers activated per default (no Linux containers): https://stackoverflow.com/questions/66077884/testcontainers-in-windows-environment-on-github-actions-could-not-find-a-valid As Sergei Egorov stated:

The problem with windows-latest is that it uses Windows containers, not Linux containers. It means that Testcontainers itself works, but all the images that it starts are Linux-based and, in Windows containers mode, they obviously fail to start :)

So a "fix" for that would be to have a GitHub Action environment with Linux containers enabled! But after some googeling this doesn't seem to be that easy. First I though LCOW (Linux Containers on Windows) would simply need to be enabled. But as this great elaboration states, it's not easy (or even possible) to activate LCOW on the GitHub Actions Windows env.

I digged deeper into the issue and found that LCOW was officially deprecated in 20.10 😢 in favour of WSL2, that brings in native Linux runtime and also Docker for Desktop on Windows 10 already favours this approach.

BUT: We are on Windows Server 2019, which is not Windows 10 Desktop. And on GitHub Actions we only have the server version in it's nano flavor. There's sadly an open issue for the WSL2 support in Windows Server 2019. And scanning the GitHub Actions Windows Server 2019 docs I found out that there's only WSLv1 installed right now.

@jonashackt
Copy link
Member Author

If we don't want to create a private GitHub Actions runner this seems to be a dead end.

The testcontainers team uses Azure Pipelines to run the tests on Windows - maybe we should also switch to this approach. See the testcontainers pipeline at https://github.com/testcontainers/testcontainers-java/blob/master/azure-pipelines.yml

@ccoltx
Copy link
Contributor

ccoltx commented Feb 7, 2021

@jonashackt - how would you like to proceed? We could tag the testcases using docker and exclude them from the command line here.

@jonashackt
Copy link
Member Author

jonashackt commented Feb 8, 2021

@ccoltx oh yeah, that would be an approach. I don't see any benefit from also using Azure Pipelines... Do you know how to easily do that with Maven?

ccoltx pushed a commit that referenced this issue Feb 11, 2021
…since Windows Server 2019 isn't supported right now by Testcontainers testcontainers/testcontainers-java#2960).
jonashackt added a commit that referenced this issue Feb 12, 2021
jonashackt added a commit that referenced this issue Feb 12, 2021
jonashackt added a commit that referenced this issue Feb 12, 2021
…since Windows Server 2019 isn't supported right now by Testcontainers testcontainers/testcontainers-java#2960).
jonashackt added a commit that referenced this issue Feb 12, 2021
jonashackt added a commit that referenced this issue Feb 12, 2021
…1630)

* #1622: Using Actions matrix build feature to also build on Windows
* #1622: Fixing `Unknown lifecycle phase ".javadoc.skip=true"` error on Windows builds.
* #1622: Fixing problems on Windows with spring-javaformat-maven-plugin
* Tagged testcases using docker
* if docker isn't installed, they won't fail the build anymore
* can be excluded using -DexcludedGroups=docker
* #1622: Add springjava-format apply to PR GHA workflow. Also switched to verify in all build workflows.

Co-authored-by: Jonas Hecht <jonas.hecht@codecentric.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants