Skip to content

Commit

Permalink
Trying to let the Windows runners find MSVC
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Wilson <[email protected]>
  • Loading branch information
scott-wilson committed Jul 30, 2024
1 parent 4006f88 commit d7afb2b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 221 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/codeql_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
defaults:
run:
working-directory: bindings/c
shell: bash
runs-on: ubuntu-latest
permissions:
actions: read
Expand Down Expand Up @@ -78,29 +77,9 @@ jobs:
with:
python-version: 3
cache: 'pip'
- name: Cache virtualenv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version}}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Setup virtual environment
run: |
python -m venv .venv
source .venv/bin/activate
- name: Install ninja
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install ninja-build
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install ninja
else
echo "$RUNNER_OS not supported"
exit 1
fi
working-directory: 'scripts'
run: python install_package.py ninja
- name: Install meson
run: python -m pip install .[build]
- name: Meson Setup
Expand Down
25 changes: 2 additions & 23 deletions .github/workflows/codeql_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
defaults:
run:
working-directory: bindings/cpp
shell: bash
runs-on: ubuntu-latest
permissions:
actions: read
Expand Down Expand Up @@ -78,29 +77,9 @@ jobs:
with:
python-version: 3
cache: 'pip'
- name: Cache virtualenv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version}}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Setup virtual environment
run: |
python -m venv .venv
source .venv/bin/activate
- name: Install ninja
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install ninja-build
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install ninja
else
echo "$RUNNER_OS not supported"
exit 1
fi
working-directory: 'scripts'
run: python install_package.py ninja
- name: Install meson
run: python -m pip install .[build]
- name: Meson Setup
Expand Down
46 changes: 7 additions & 39 deletions .github/workflows/test_suite_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
defaults:
run:
working-directory: bindings/c
shell: bash
strategy:
matrix:
os:
Expand Down Expand Up @@ -64,43 +63,13 @@ jobs:
with:
python-version: 3
cache: 'pip'
- name: Cache virtualenv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version}}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Setup virtual environment
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
- name: Install ninja
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install ninja-build
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install ninja
else
echo "$RUNNER_OS not supported"
exit 1
fi
working-directory: 'scripts'
run: python install_package.py ninja
- name: Install meson
run: python -m pip install .[build]
- name: Meson Setup
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
CC=cl CXX=cl meson setup build -Dtests=true -Db_coverage=true
else
meson setup build -Dtests=true -Db_coverage=true
fi
run: meson setup build -Dtests=true -Db_coverage=true
- name: Meson Compile
working-directory: bindings/c/build
run: |
Expand All @@ -120,13 +89,12 @@ jobs:
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_result
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_runner
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_status
- name: Install LCov
working-directory: '.'
run: python install_package.py lcov
- name: Run LCov
working-directory: bindings/c/build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y lcov
lcov -c -d . -o coverage.info
run: lcov -c -d . -o coverage.info
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: lang-c
Expand Down
48 changes: 8 additions & 40 deletions .github/workflows/test_suite_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
defaults:
run:
working-directory: bindings/cpp
shell: bash
strategy:
matrix:
os:
Expand All @@ -57,43 +56,13 @@ jobs:
with:
python-version: 3
cache: 'pip'
- name: Cache virtualenv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version}}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Setup virtual environment
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
- name: Install ninja
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install ninja-build
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install ninja
else
echo "$RUNNER_OS not supported"
exit 1
fi
working-directory: 'scripts'
run: python install_package.py ninja
- name: Install meson
run: python -m pip install .[build]
- name: Meson Setup
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
CC=cl CXX=cl meson setup build -Dtests=true -Db_coverage=true
else
meson setup build -Dtests=true -Db_coverage=true
fi
run: meson setup build -Dtests=true -Db_coverage=true
- name: Meson Compile
working-directory: bindings/cpp/build
run: |
Expand All @@ -112,13 +81,12 @@ jobs:
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_result
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_runner
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_status
- name: Install LCov
working-directory: '.'
run: python install_package.py lcov
- name: Run LCov
working-directory: bindings/cpp/build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y lcov
lcov -c -d . -o coverage.info
working-directory: bindings/c/build
run: lcov -c -d . -o coverage.info
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: lang-cpp
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/test_suite_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
defaults:
run:
working-directory: bindings/python
shell: bash
strategy:
matrix:
os:
Expand Down Expand Up @@ -74,20 +73,6 @@ jobs:
with:
python-version: ${{matrix.python-version}}
cache: 'pip'
- name: Cache virtualenv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version}}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Setup virtual environment
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
- name: Install dependencies
run: python -m pip install .[test]
- name: Lint with Ruff
Expand Down
81 changes: 0 additions & 81 deletions bindings/python/Makefile

This file was deleted.

26 changes: 26 additions & 0 deletions scripts/install_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import argparse
import subprocess
import sys

_PACKAGE_NAME_OVERRIDE = {"ninja": {"linux": "ninja-build"}}


def main(package: str):
package = _PACKAGE_NAME_OVERRIDE.get(package, {}).get(sys.platform, package)

if sys.platform == "linux":
subprocess.run(["sudo", "apt-get", "install", package], shell=True, check=True)
elif sys.platform == "win32":
subprocess.run(["choco", "install", package], shell=True, check=True)
elif sys.platform == "darwin":
subprocess.run(["brew", "install", package], shell=True, check=True)
else:
raise NotImplementedError(f"{sys.platform!r} is not supported")


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("package")
args = parser.parse_args()

main(args.package)

0 comments on commit d7afb2b

Please sign in to comment.