Skip to content

Commit

Permalink
Rework CI
Browse files Browse the repository at this point in the history
  • Loading branch information
externl committed Apr 19, 2024
1 parent 8897645 commit 4885a71
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 111 deletions.
77 changes: 36 additions & 41 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,55 @@
name: Build Ice

inputs:
language:
description: "The programming language to build"
required: true
working_directory:
description: "The working directory to run the build in"
default: "."
type: string
make_flags:
description: "Additional flags to pass to make"
required: false

build_flags:
description: "Additional flags to pass to the build"
default: ""
type: string

msbuild_project:
description: "The project file to build"
default: "ice.proj"
type: string

build_cpp_and_python:
description: "Build C++ and Python"
type: choice
default: "false"
options:
- true
- false

runs:
using: "composite"
steps:
# Linux / macOS
- name: Build C++ Dependencies
working-directory: ./cpp
run: make -j3 V=1 srcs
shell: bash
if: (runner.os == 'macOS' || runner.os == 'Linux') && (inputs.language != 'cpp' || matrix.name == 'xcodesdk')

- name: Build C++ Tests for Scripting Languages
working-directory: ./cpp
run: make -j3 V=1 tests
shell: bash
if: (runner.os == 'macOS' || runner.os == 'Linux') && (inputs.language == 'php' || inputs.language == 'js' || inputs.language == 'ruby')

- name: Build Ice for Python
working-directory: ./python
run: make -j3 V=1
shell: bash
if: (runner.os == 'macOS' || runner.os == 'Linux') && (inputs.language == 'matlab' || matrix.name == 'xcodesdk')

- name: Build ${{ matrix.name || matrix.language }}
working-directory: ./${{ inputs.language }}
# macOS and Linux
- name: Build C++ and Python
run: |
make ${{ inputs.make_flags }} -j3 V=1
make -C cpp srcs
make -C python
shell: bash
if: (runner.os == 'macOS' || runner.os == 'Linux') && inputs.build_cpp_and_python == 'true'
- name: Build
working-directory: ${{ inputs.working_directory }}
run: make ${{ inputs.build_flags }}
shell: bash
if: runner.os == 'macOS' || runner.os == 'Linux'

# Windows
- name: Build C++ Dependencies
run: msbuild /m /p:Platform=x64 msbuild/ice.proj
working-directory: ./cpp
shell: powershell
if: (runner.os == 'Windows') && (inputs.language != 'cpp')

- name: Build Ice for Python
run: msbuild /m /p:Platform=x64 msbuild/ice.proj
working-directory: ./python
- name: Build C++ and Python
run: |
msbuild /m ${{ inputs.build_flags }} /t:BuildDist cpp/msbuild/ice.proj
msbuild /m ${{ inputs.build_flags }} python/msbuild/ice.proj
shell: powershell
if: runner.os == 'Windows' && inputs.language == 'matlab'
if: runner.os == 'Windows' && inputs.build_cpp_and_python == 'true'

- name: Build ${{ matrix.name || matrix.language }}
run: msbuild /m /p:Platform=x64 msbuild/ice.proj
working-directory: ./${{ inputs.language }}
- name: Build
working-directory: ${{ inputs.working_directory }}
run: msbuild /m ${{ inputs.build_flags }} ${{ inputs.msbuild_project }}
shell: powershell
if: runner.os == 'Windows'
52 changes: 35 additions & 17 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ inputs:
runs:
using: "composite"
steps:
- name: Set Linux MAKEFLAGS
run: echo "MAKEFLAGS=-j$(nproc) V=1" >> $GITHUB_ENV
shell: bash
if: runner.os == 'Linux'

- name: Set macOS MAKEFLAGS
run: echo "MAKEFLAGS=-j$(sysctl -n hw.ncpu) V=1" >> $GITHUB_ENV
shell: bash
if: runner.os == 'macOS'

# Python3 is already installed though Homebrew
- name: Install brew dependencies
run: brew install ruby node php lmdb mcpp || true
Expand All @@ -27,7 +37,7 @@ runs:
if: runner.os == 'macOS'

- name: Install testing dependencies from pip
run: python3 -m pip install --break-system-packages passlib cryptography numpy
run: python3 -m pip install --break-system-packages --user passlib cryptography numpy
shell: bash
if: runner.os == 'macOS'

Expand All @@ -41,7 +51,7 @@ runs:
# We should consider removing the dependency on ice-xcode-builder
brew install zeroc-ice/tap/ice-builder-xcode
shell: bash
if: (runner.os == 'macOS') && (matrix.name == 'xcodesdk')
if: (runner.os == 'macOS') && (matrix.config == 'xcodesdk')

- name: Install apt dependencies
run: |
Expand All @@ -51,7 +61,6 @@ runs:
ruby ruby-dev php-cli php-dev \
libbluetooth-dev libdbus-1-dev \
libsystemd-dev
shell: bash
if: runner.os == 'Linux'

Expand All @@ -60,7 +69,11 @@ runs:
with:
distribution: "oracle"
java-version: "17"
if: matrix.language == 'java'

- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Install testing dependencies from pip
run: python3 -m pip install passlib cryptography numpy
Expand All @@ -86,29 +99,35 @@ runs:
shell: powershell
if: runner.os == 'Windows'

# # This choco install will overwrite the existing Python installation
# - name: Setup Debug Python
# run: |
# choco install python312 --installargs='/quiet Include_debug=1' -y --no-progress
# shell: powershell
# if: runner.os == 'Windows' && matrix.config == 'debug'
- name: Install testing dependencies from pip
run: python3 -m pip install passlib cryptography numpy
shell: powershell
if: runner.os == 'Windows'

# ———— MATLAB ———— #
# ———— MATLAB ———— #
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: 'R2023b'
if: matrix.language == 'matlab'
release: "R2023b"
if: matrix.config == 'matlab'

- name: Set MATLAB_HOME
run: |
echo "MATLAB_HOME=/opt/hostedtoolcache/MATLAB/2023.2.999/x64" >> $GITHUB_ENV
shell: bash
if: matrix.language == 'matlab' && runner.os == 'Linux'
if: runner.os == 'Linux' && matrix.config == 'matlab'

- name: Set MATLAB_HOME
run: |
echo "MATLAB_HOME=C:\Program Files\MATLAB\R2023b\bin" >> $env:GITHUB_ENV
shell: powershell
if: matrix.language == 'matlab' && runner.os == 'Windows'
if: runner.os == 'Windows' && matrix.config == 'matlab'

# https://github.com/matlab-actions/run-command/issues/53
- name: Get run-matlab-command
Expand All @@ -121,27 +140,26 @@ runs:
echo "LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6" >> $GITHUB_ENV
shell: bash
if: matrix.language == 'matlab' && runner.os == 'Linux'
if: runner.os == 'Linux' && matrix.config == 'matlab'

# Windows is currently not working. We get an error: "'matlab' executable not found on the system path"
# Is GITHUB_PATH set correctly?
- name: Get run-matlab-command
run: |
wget -O C:\Windows\System32\run-matlab-command.exe https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2/win64/run-matlab-command.exe
Invoke-WebRequest https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2/win64/run-matlab-command.exe -OutFile C:\Windows\System32\run-matlab-command.exe
echo "MATLAB_COMMAND=C:\Windows\System32\run-matlab-command.exe" >> $env:GITHUB_ENV
echo "$env:MATLAB_HOME" >> $env:GITHUB_PATH
shell: powershell
if: matrix.language == 'matlab' && runner.os == 'Windows'
if: runner.os == 'Windows' && matrix.config == 'matlab'

# ———— Cache ———— #
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
# create-symlink: true
append-timestamp: false
key: ci-${{ runner.os }}-${{matrix.name || matrix.language }}-${{ github.sha }}
key: ci-${{ runner.os }}-${{ matrix.config }}-${{ github.sha }}
restore-keys: |
ci-${{ runner.os }}-${{matrix.name || matrix.language }}-
ci-${{ runner.os }}-${{ matrix.config }}-
ci-${{ runner.os }}-
if: inputs.use_ccache == 'true' && (runner.os == 'macOS' || runner.os == 'Linux')

Expand All @@ -162,8 +180,8 @@ runs:
# **/msbuild/**/x64
# **/include/generated

# key: ci-${{ runner.os }}-${{matrix.name || matrix.language }}-${{ github.sha }}
# key: ci-${{ runner.os }}-${{ matrix.config }}-${{ github.sha }}
# restore-keys: |
# ci-${{ runner.os }}-${{matrix.name || matrix.language }}-
# ci-${{ runner.os }}-${{ matrix.config }}-
# ci-${{ runner.os }}-
# if: inputs.cache && runner.os == 'Windows'
16 changes: 11 additions & 5 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
name: Test Ice

inputs:
working_directory:
description: "The working directory to run the tests in"
type: string

flags:
description: "Flags to pass to the test"
required: false
type: string
default: ""

runs:
using: "composite"
steps:
- name: Test ${{ matrix.name || matrix.language }}
run: python3 allTests.py --debug --all --continue --workers=4 --export-xml=test-report.xml --languages=${{ matrix.language }} ${{ inputs.flags }}
- name: Test
working-directory: ${{ inputs.working_directory }}
run: python3 allTests.py --debug --all --continue --workers=4 --export-xml=test-report.xml ${{ inputs.flags }}
shell: bash
if: runner.os == 'macOS' || runner.os == 'Linux'

- name: Test
run: python allTests.py --debug --all --continue --export-xml=test-report.xml --platform=x64 --config=Release --workers=4 --languages=${{ matrix.language }} ${{ inputs.flags }}
working-directory: ${{ inputs.working_directory }}
run: python allTests.py --debug --all --continue --export-xml=test-report.xml --workers=4 ${{ inputs.flags }}
shell: powershell
if: runner.os == 'Windows'

- name: Test Summary
uses: test-summary/action@v2
with:
paths: "test-report.xml"
paths: "${{ inputs.working_directory }}/test-report.xml"
if: always()
Loading

0 comments on commit 4885a71

Please sign in to comment.