diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a5a769541..3cdbf855c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,36 +1,69 @@ -# This is a basic workflow to help you get started with Actions - name: GitHub Actions -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - pull_request: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: +on: [ pull_request, push ] -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest + build-test: + name: Build and Test + runs-on: ubuntu-16.04 + + strategy: + matrix: + python: [3.6,3.7,3.8,3.9] + shutdown_mode: [Normal,Soft] + toolset: [Mono,.NET] + include: + - toolset: .NET + BUILD_OPTS: --xplat + RUN_TESTS: dotnet + EMBED_TESTS_PATH: netcoreapp3.1_publish/ + PERF_TESTS_PATH: net461/ + - toolset: Mono + BUILD_OPTS: "" + RUN_TESTS: "mono ./packages/NUnit.*/tools/nunit3-console.exe" + EMBED_TESTS_PATH: "" + PERF_TESTS_PATH: "" + + env: + BUILD_OPTS: ${{ matrix.BUILD_OPTS }} + RUN_TESTS: ${{ matrix.RUN_TESTS }} + EMBED_TESTS_PATH: ${{ matrix.EMBED_TESTS_PATH }} + PERF_TESTS_PATH: ${{ matrix.PERF_TESTS_PATH }} + PYTHONNET_SHUTDOWN_MODE: ${{ matrix.SHUTDOWN_MODE }} - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Mono + if: ${{ matrix.toolset == 'Mono' }} + run: | + sudo apt update + sudo apt install mono-devel ca-certificates-mono -y - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! + - name: Install .NET + if: ${{ matrix.toolset == '.NET' }} + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x - # Runs a set of commands using the runners shell - - name: Run a multi-line script + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: Install dependencies + run: | + pip install --upgrade setuptools # TEMP - due to setuptools 36.2.0 bug + pip install --upgrade -r requirements.txt + + - name: Install run: | - echo Add other actions to build, - echo test, and deploy your project. + echo $BUILD_OPTS + python setup.py install $BUILD_OPTS + + - name: Python Tests + run: pytest + + - name: .NET Tests + run: $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll --labels=All diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4f95e5a51..000000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -dist: xenial -sudo: false -language: python -python: - - 3.9 - - 3.8 - - 3.7 - - 3.6 - -env: - matrix: - - BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp3.1_publish/ PERF_TESTS_PATH=net461/ - - BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH="" - - PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp3.1_publish/ PERF_TESTS_PATH=net461/ - - PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH="" - - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all - - PYTHONUNBUFFERED=True - - CODECOV_ENV=TRAVIS_PYTHON_VERSION - -addons: - apt: - sources: - - sourceline: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main - key_url: https://packages.microsoft.com/keys/microsoft.asc - - sourceline: deb http://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/5.20 main - key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF - packages: - - mono-devel - - ca-certificates-mono - - dotnet-sdk-3.1 - -before_install: - # Set-up dll path for embedded tests - - PY_LIBDIR=$(python -c 'import sysconfig; print(sysconfig.get_config_var("LIBDIR"))') - - export LD_LIBRARY_PATH=$PY_LIBDIR:$LD_LIBRARY_PATH - -install: - - pip install --upgrade setuptools # TEMP - due to setuptools 36.2.0 bug - - pip install --upgrade -r requirements.txt - - coverage run setup.py install $BUILD_OPTS - -script: - - python -m pytest - - $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll --labels=All - # does not work on Linux, because NuGet package for 2.3 is Windows only - # - "if [[ $TRAVIS_PYTHON_VERSION == '3.5' && $PERF_TESTS_PATH != '' ]]; then mono $NUNIT_PATH src/perf_tests/bin/$PERF_TESTS_PATH/Python.PerformanceTests.dll; fi" - -after_script: - # Waiting on mono-coverage, SharpCover or xr.Baboon - - coverage xml -i - - codecov --file coverage.xml --flags setup_linux - -notifications: - email: false - slack: - secure: "UiQdSK1/uNnHl8/gQgfLj/F5JGxtJuaT3QYtKNcw3Ddpr3FX8tfXJ/RjsCsSlRQzDm7AdBAeMzcBQmvH4iRIV2y7qVywLyru5MPiwY4ZjMN6fJK/zaaxetOct9fasIBYzHguNPDAtiBGFh2iK1H1MXTY8rkmU3WZvl18b8EsrP0=" diff --git a/pythonnet.15.sln b/pythonnet.15.sln index 402bd0003..76986c84f 100644 --- a/pythonnet.15.sln +++ b/pythonnet.15.sln @@ -24,10 +24,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Repo", "Repo", "{441A0123-F EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{D301657F-5EAF-4534-B280-B858D651B2E5}" ProjectSection(SolutionItems) = preProject - .travis.yml = .travis.yml appveyor.yml = appveyor.yml ci\appveyor_build_recipe.ps1 = ci\appveyor_build_recipe.ps1 ci\appveyor_run_tests.ps1 = ci\appveyor_run_tests.ps1 + .github\workflows\main.yml = .github\workflows\main.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{57F5D701-F265-4736-A5A2-07249E7A4DA3}"