Skip to content

Commit

Permalink
Merge pull request #1456 from lf-lang/fix-python-tests
Browse files Browse the repository at this point in the history
Fix python tests
  • Loading branch information
lhstrh authored Nov 8, 2022
2 parents d960419 + afa0970 commit a5273af
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ If a repository has a text file that stores a ref (e.g., a SHA1 hash of a commit
After workflow execution, the value of the output `ref` will be equal to the first line in the given `file`.
## Nightly Build
See [nightly-build.yml](https://github.com/lf-lang/lingua-franca/blob/master/.github/workflows/nightly-build.yml).

## Debugging tests

To debug test failures that are difficult to reproduce locally, it can be useful
to add a step such as [this one](https://github.com/marketplace/actions/debugging-with-ssh) to SSH into the GitHub Actions runner. Such a debugging step
should not be included in the `master` version of the workflow file.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

# Run language server tests.
lsp-tests:
uses: lf-lang/lingua-franca/.github/workflows/lsp-tests.yml@master
uses: lf-lang/lingua-franca/.github/workflows/lsp-tests.yml@fix-python-tests
needs: cancel

# Run the C integration tests.
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:

# Run the Python integration tests.
py-tests:
uses: lf-lang/lingua-franca/.github/workflows/py-tests.yml@master
uses: lf-lang/lingua-franca/.github/workflows/py-tests.yml@fix-python-tests
needs: cancel

# Run the Rust integration tests.
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/lsp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
brew install protobuf
brew install protobuf-c
if: ${{ runner.os == 'macOS' }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run language server Python tests without PyLint
run: ./gradlew test --tests org.lflang.tests.lsp.LspTests.pythonValidationTestSyntaxOnly
- name: Report to CodeCov
Expand All @@ -69,6 +73,10 @@ jobs:
verbose: true
- name: Install pylint
run: python3 -m pip install pylint
if: ${{ runner.os != 'macOS' }}
- name: Install pylint macOS
run: brew install pylint
if: ${{ runner.os == 'macOS' }}
- name: Run language server tests
run: ./gradlew clean test --tests org.lflang.tests.lsp.LspTests.*ValidationTest
- name: Report to CodeCov
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/py-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
if: ${{ runner.os == 'Windows' }}
- name: Install dependencies OS X
run: |
brew install coreutils
Expand Down
4 changes: 3 additions & 1 deletion org.lflang/src/org/lflang/generator/c/CCmakeGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class CCmakeGenerator {
)
""";

public static final String MIN_CMAKE_VERSION = "3.19";

private final FileConfig fileConfig;
private final List<String> additionalSources;
private final SetUpMainTarget setUpMainTarget;
Expand Down Expand Up @@ -115,7 +117,7 @@ CodeBuilder generateCMakeCode(
additionalSources.addAll(this.additionalSources);
cMakeCode.newLine();

cMakeCode.pr("cmake_minimum_required(VERSION 3.13)");
cMakeCode.pr("cmake_minimum_required(VERSION " + MIN_CMAKE_VERSION + ")");
cMakeCode.pr("project("+executableName+" LANGUAGES C)");

cMakeCode.newLine();
Expand Down
5 changes: 3 additions & 2 deletions org.lflang/src/org/lflang/generator/c/CCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ public LFCommand compileCmakeCommand() {
buildPath);
if (command == null) {
errorReporter.reportError(
"The C/CCpp target requires CMAKE >= 3.5 to compile the generated code. " +
"Auto-compiling can be disabled using the \"no-compile: true\" target property.");
"The C/CCpp target requires CMAKE >= " + CCmakeGenerator.MIN_CMAKE_VERSION
+ " to compile the generated code. " +
"Auto-compiling can be disabled using the \"no-compile: true\" target property.");
}
return command;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ private static String setUpMainTarget(boolean hasMain, String executableName, St
add_subdirectory(core)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
set(LF_MAIN_TARGET <pyModuleName>)
find_package(Python COMPONENTS Interpreter Development)
find_package(Python 3.7.0...<3.11.0 COMPONENTS Interpreter Development)
Python_add_library(
${LF_MAIN_TARGET}
MODULE
Expand Down

0 comments on commit a5273af

Please sign in to comment.