8000 added github actions workflow to replace travis · pythonnet/pythonnet@92dcfd5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 92dcfd5

Browse files
committed
added github actions workflow to replace travis
1 parent 41ae994 commit 92dcfd5

File tree

3 files changed

+65
-28
lines changed

3 files changed

+65
-28
lines changed

.github/workflows/main.yml

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,72 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: GitHub Actions
42

5-
# Controls when the action will run.
6-
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
8-
push:
9-
branches: [ master ]
10-
pull_request:
11-
branches: [ master ]
12-
13-
# Allows you to run this workflow manually from the Actions tab
14-
workflow_dispatch:
3+
on: [ pull_request, push ]
154

16-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
175
jobs:
18-
# This workflow contains a single job called "build"
19-
build:
20-
# The type of runner that the job will run on
21-
runs-on: ubuntu-latest
6+
build-test:
7+
name: Build and Test
8+
runs-on: ubuntu-16.04
9+
10+
strategy:
11+
matrix:
12+
python: [3.6,3.7,3.8,3.9]
13+
shutdown_mode: [Normal,Soft]
14+
toolset: [Mono,.NET]
15+
include:
16+
- toolset: .NET
17+
BUILD_OPTS: --xplat
18+
RUN_TESTS: dotnet
19+
EMBED_TESTS_PATH: netcoreapp3.1_publish/
20+
PERF_TESTS_PATH: net461/
21+
- toolset: Mono
22+
BUILD_OPTS: ""
23+
RUN_TESTS: "mono ./packages/NUnit.*/tools/nunit3-console.exe"
24+
EMBED_TESTS_PATH: ""
25+
PERF_TESTS_PATH: ""
26+
27+
env:
28+
BUILD_OPTS: ${{ matrix.BUILD_OPTS }}
29+
RUN_TESTS: ${{ matrix.RUN_TESTS }}
30+
EMBED_TESTS_PATH: ${{ matrix.EMBED_TESTS_PATH }}
31+
PERF_TESTS_PATH: ${{ matrix.PERF_TESTS_PATH }}
32+
PYTHONNET_SHUTDOWN_MODE: ${{ matrix.SHUTDOWN_MODE }}
2233

23-
# Steps represent a sequence of tasks that will be executed as part of the job
2434
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26-
- uses: actions/checkout@v2
35+
- name: Checkout code
36+
uses: actions/checkout@v2
37+
38+
- name: Install mono
39+
if: ${{ matrix.toolset == 'Mono' }}
40+
run: |
41+
sudo apt autoremove mono-complete
42+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
43+
sudo sh -c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/5.20 main" > /etc/apt/sources.list.d/mono-official-5.20.list'
44+
sudo apt update
45+
sudo apt install mono-devel ca-certificates-mono -y
2746
28-
# Runs a single command using the runners shell
29-
- name: Run a one-line script
30-
run: echo Hello, world!
47+
- name: Install .NET
48+
if: ${{ matrix.toolset == '.NET' }}
49+
uses: actions/setup-dotnet@v1
50+
with:
51+
dotnet-version: 3.1.x
3152

32-
# Runs a set of commands using the runners shell
33-
- name: Run a multi-line script
53+
- name: Set up Python ${{ matrix.python }}
54+
uses: actions/setup-python@v2
55+
with:
56+
python-version: ${{ matrix.python }}
57+
58+
- name: Install dependencies
59+
run: |
60+
pip install --upgrade setuptools # TEMP - due to setuptools 36.2.0 bug
61+
pip install --upgrade -r requirements.txt
62+
63+
- name: Install
3464
run: |
35-
echo Add other actions to build,
36-
echo test, and deploy your project.
65+
echo $BUILD_OPTS
66+
python setup.py install $BUILD_OPTS
67+
68+
- name: Python Tests
69+
run: pytest
70+
71+
- name: .NET Tests
72+
run: $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll --labels=All

pythonnet.15.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{D301657F-5EAF-
2727
appveyor.yml = appveyor.yml
2828
ci\appveyor_build_recipe.ps1 = ci\appveyor_build_recipe.ps1
2929
ci\appveyor_run_tests.ps1 = ci\appveyor_run_tests.ps1
30+
.github\workflows\main.yml = .github\workflows\main.yml
3031
EndProjectSection
3132
EndProject
3233
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{57F5D701-F265-4736-A5A2-07249E7A4DA3}"

src/tests/test_method.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ def test_we_can_bind_to_encoding_get_string():
761761
read = 1
762762

763763
while read > 0:
764-
read, _ = stream.Read(buff, 0, buff.Length)
764+
read = stream.Read(buff, 0, buff.Length)
765765
temp = Encoding.UTF8.GetString(buff, 0, read)
766766
data.append(temp)
767767

0 commit comments

Comments
 (0)
0