diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..dc7c007573 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,80 @@ +name: ResInsight Build + +on: [push] + +jobs: + ResInsight-x64: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + include: + - os: windows-latest + triplet: x64-windows + vcpkgGitCommitId: '6282cab61d175974b1af06473db584b9b80dcd48' + vcpkgPackages: 'grpc' + - os: ubuntu-latest + triplet: x64-linux + vcpkgGitCommitId: '6282cab61d175974b1af06473db584b9b80dcd48' + vcpkgPackages: 'grpc' + steps: + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install grpcio-tools + pip install pytest + - name: Install Linux dependencies + if: "contains( matrix.os, 'ubuntu')" + run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev + - name: Checkout + uses: actions/checkout@v1 + - name: Cache vcpkg artifacts + uses: actions/cache@v1 + env: + cache-name: cache-vcpkg-modules + with: + path: ${{ github.workspace }}/vcpkg/ + key: ${{ env.cache-name }}-${{ runner.os }} + - name: Run vcpkg + uses: lukka/run-vcpkg@v0.10 + id: runvcpkg + with: + vcpkgArguments: '${{ matrix.vcpkgPackages }}' + vcpkgTriplet: '${{ matrix.triplet }}' + vcpkgGitCommitId: '${{ matrix.vcpkgGitCommitId }}' + - name: Prints outputs of run-vcpkg task + run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' " + - name: Install Qt + uses: ouuan/install-qt-action@v2.3.1 + with: + version: 5.9.1 + target: desktop + modules: qtscript + - name: Build ResInsight-x64 Windows + if: "contains( matrix.os, 'windows')" + run: | + mkdir cmakebuild + cd cmakebuild + cmake .. -DRESINSIGHT_ENABLE_GRPC=true -DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=true -DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=python -DRESINSIGHT_ENABLE_UNITY_BUILD=true -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -A x64 + cmake --build . --config Release --target PACKAGE + - name: Build ResInsight-x64 Linux + if: "contains( matrix.os, 'ubuntu')" + run: | + mkdir cmakebuild + cd cmakebuild + cmake .. -DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=true -DRESINSIGHT_ENABLE_UNITY_BUILD=true -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake + cmake --build . --config Release + - name: Test with pytest + if: "contains( matrix.os, '##-undefined-##')" # To be used when RESINSIGHT_GRPC_PYTHON_EXECUTABLE can be 'python' without extention in PATH + env: + RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationCode/Release/ResInsight.exe + run: | + cd ApplicationCode/GrpcInterface/Python/rips + pytest --console + - name: Upload artifact + if: "contains( matrix.os, 'windows')" + uses: actions/upload-artifact@v1 + with: + name: ResInsight + path: ${{ runner.workspace }}/ResInsight/cmakebuild/packages