Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions release test #284

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ce4435f
trying out github actions
Bam4d Jun 3, 2023
0fb1609
disable pipelines
Bam4d Jun 3, 2023
8997432
fix conan version
Bam4d Jun 3, 2023
332f527
fixing configire.sh
Bam4d Jun 3, 2023
d8985ed
rename piplines file so it does not trigger
Bam4d Jun 3, 2023
f684ebd
trying out some more build steps
Bam4d Jun 3, 2023
591e3d6
building multiple python versions and seeing vulkan works
Bam4d Jun 3, 2023
8838c47
maybe the tests will work too
Bam4d Jun 3, 2023
9910053
stupid python versions
Bam4d Jun 3, 2023
43222ad
just ignore the vulkaninfo step and try to run tests with vulkan
Bam4d Jun 3, 2023
5d6b347
remove silly vulkan
Bam4d Jun 3, 2023
cc82e07
dont use python 3.7
Bam4d Jun 3, 2023
38e9162
3.11 apparently doesnt work with tensorflow
Bam4d Jun 3, 2023
596a94a
fixing some wierd test dependency that didnt like manylinux
Bam4d Jun 4, 2023
62dcb20
another attempt
Bam4d Jun 4, 2023
cf0d7c3
trying to fix
Bam4d Jun 4, 2023
69220fa
more fiddling
Bam4d Jun 4, 2023
d3e3d8d
build not build-wheels
Bam4d Jun 4, 2023
4b33bc3
try to run the tests in the docker container too
Bam4d Jun 4, 2023
b79c955
these should be executable
Bam4d Jun 4, 2023
e480368
remove 3.11 for now because tensorflow doesn't support it
Bam4d Jun 4, 2023
c518a13
only do the publish if we are on master or release-test
Bam4d Jun 4, 2023
b1c6d26
try and use .head_ref for PR
Bam4d Jun 4, 2023
409310e
fixing python steps
Bam4d Jun 5, 2023
73d47e4
another attempt at pushing
Bam4d Jun 12, 2023
238126a
again try to build each wheelyboi
Bam4d Jun 12, 2023
4f7dba8
download all artifacts not just wheels which no longer exists
Bam4d Jun 12, 2023
3467950
testing wheely bits
Bam4d Jun 14, 2023
31035a2
more fiddle
Bam4d Jun 14, 2023
02d6207
dont need to install ninja because conan does that
Bam4d Jun 14, 2023
43c1175
fixing download
Bam4d Jun 14, 2023
36d272c
seriously though
Bam4d Jun 14, 2023
ca96f8e
trying to understand why the wheels are wrong
Bam4d Jun 15, 2023
75f92d9
try to use docker container for all steps
Bam4d Jun 20, 2023
74725d2
fixing paths
Bam4d Jun 20, 2023
4b0810d
fixing executable paths
Bam4d Jun 20, 2023
f10417f
another attempt at paths
Bam4d Jun 20, 2023
7423698
remove sudo
Bam4d Jun 20, 2023
4bea896
manylinux already has all the pythons so we should not install anothe…
Bam4d Jun 21, 2023
6d036dc
add the right python to the path
Bam4d Jun 21, 2023
ae1ea47
dont need these manylinux build files anymore, also run the tests wit…
Bam4d Jun 21, 2023
0a925db
manylinux builds working and now trying to upload to test pypi
Bam4d Jun 21, 2023
3354e21
another attempt at publishing
Bam4d Jun 22, 2023
9c5789b
release test working
Bam4d Jun 22, 2023
3f12e51
pinning conan version
Bam4d Jun 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: Griddly Build

on:
push:
branches: ["master", "develop"]
# Run on all pull requests
pull_request:


jobs:
build-wasm:
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v2

# Install Conan
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install python3-pip
pip3 install conan==1.59.0

# Build
- name: Build
run: |
conan install deps/wasm/conanfile_wasm.txt -pr:h=deps/wasm/emscripten.profile -pr:b=default -s build_type=Release --build missing -if build_wasm
cmake . -B build_wasm -GNinja -DWASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
cmake --build build_wasm --config Release

- name: Upload WASM
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test')
uses: actions/upload-artifact@v3
with:
name: griddlyjs.wasm
path: Release/bin/griddlyjs.wasm

- name: Upload JS
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test')
uses: actions/upload-artifact@v3
with:
name: griddlyjs.js
path: Release/bin/griddlyjs.js

build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
manylinux_config:
- python-version: "3.8"
py-bin: cp38-cp38
platform: manylinux_2_28_x86_64
- python-version: "3.9"
py-bin: cp39-cp39
platform: manylinux_2_28_x86_64
- python-version: "3.10"
py-bin: cp310-cp310
platform: manylinux_2_28_x86_64
# - python-version: "3.11"
# py-bin: cp311-cp311
# platform: manylinux_2_28_x86_64
- python-version: "3.8"
py-bin: cp38-cp38
platform: manylinux2014_x86_64
- python-version: "3.9"
py-bin: cp39-cp39
platform: manylinux2014_x86_64
- python-version: "3.10"
py-bin: cp310-cp310
platform: manylinux2014_x86_64
container:
image: quay.io/pypa/${{ matrix.manylinux_config.platform }}
env:
PYBIN: ${{ matrix.manylinux_config.py-bin }}
PYVERSION: ${{ matrix.manylinux_config.python-version }}
PLATFORM: ${{ matrix.manylinux_config.platform }}

steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v3

# # Set python version
# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: ${{ matrix.manylinux_config.python-version }}

# Install Build Dependencies
- name: Install Build Dependencies
run: |
/opt/python/$PYBIN/bin/pip install poetry cmake conan==1.59.0


# Configure conan for release build
- name: Build
run: |
export CONAN_SYSREQUIRES_SUDO=0
export PATH=$PATH:/opt/python/$PYBIN/bin
/opt/python/$PYBIN/bin/conan install deps/conanfile.txt -pr:b=default -pr:h=default -pr:h=deps/build.profile -s build_type=Release --build=* -if build_manylinux
/opt/python/$PYBIN/bin/cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DPython_ROOT_DIR:STRING=/opt/python/$PYBIN -DPYTHON_EXECUTABLE:FILEPATH=/opt/python/$PYBIN/bin/python -S . -B build_manylinux
/opt/python/$PYBIN/bin/cmake --build build_manylinux --config Release

# Run the tests
- name: Test
run: |
export GTEST_FILTER=-*BlockObserverTest*:*SpriteObserverTest*
/opt/python/$PYBIN/bin/ctest --test-dir build_manylinux

# Setup python environment
- name: Poetry install
run: |
cd python
/opt/python/$PYBIN/bin/poetry install

# Run python tests
- name: Python tests
run: |
cd python
/opt/python/$PYBIN/bin/poetry run pytest .

- name: Python Package
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test')
run: |
cd python
/opt/python/$PYBIN/bin/poetry build --format=wheel

# Upload the built wheels
- name: Upload wheel artifacts
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test')
uses: actions/upload-artifact@v3
with:
path: python/dist/*.whl

publish-wheels:
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test')
needs: build-linux
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v3

- name: Download wheel artifacts
uses: actions/download-artifact@v3
with:
path: python/dist

- name: Unpack wheels
run: |
ls -lah python/dist/artifact
mv python/dist/artifact/*.whl python/dist/

- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install python3-pip
pip3 install poetry

- name: Pypi upload (test)
if: contains(github.head_ref, 'release-test')
run: |
cd python
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.PYPI_TEST_TOKEN }}
poetry publish -r test-pypi

- name: Pypi upload (prod)
if: github.ref == 'refs/heads/master'
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish

# build-macos:
# runs-on: macos-latest

# build-windows:
# runs-on: windows-latest
24 changes: 0 additions & 24 deletions .gitmodules

This file was deleted.

4 changes: 2 additions & 2 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ echo $PLATFORM

if [[ $PLATFORM == "WASM" ]]
then
conan install deps/wasm/conanfile_wasm.txt --profile:host deps/wasm/emscripten.profile --profile:build default -s build_type=$BUILD --build missing -if build_wasm
conan install deps/wasm/conanfile_wasm.txt -pr:h=deps/wasm/emscripten.profile -pr:b=default -s build_type=$BUILD --build missing -if build_wasm
else
conan install deps/conanfile.txt --profile default --profile deps/build.profile -s build_type=$BUILD --build $CONAN_BUILD -if build
conan install deps/conanfile.txt -pr:b=default -pr:h=default -pr:h=deps/build.profile -s build_type=$BUILD --build $CONAN_BUILD -if build
fi

File renamed without changes.
29 changes: 0 additions & 29 deletions python/manylinux/build-wheels.sh

This file was deleted.

10 changes: 0 additions & 10 deletions python/manylinux/manylinux-build.sh

This file was deleted.

1 change: 1 addition & 0 deletions python/tools/package_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def build(setup_kwargs):
griddly_lib_dir.mkdir(parents=True, exist_ok=True)

for lib in libs_to_copy:
print(f" {lib}")
shutil.copy(lib, griddly_lib_dir)

# Destination for resources
Expand Down
4 changes: 2 additions & 2 deletions src/Griddly/Core/Observers/SpriteObserver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ enum class TilingMode {
};

struct SpriteDefinition {
std::vector<std::string> images;
std::vector<std::string> images{};
TilingMode tilingMode = TilingMode::NONE;
glm::vec2 offset = {0, 0};
float scale = 1.0;
};

struct SpriteObserverConfig : public VulkanGridObserverConfig {
std::map<std::string, SpriteDefinition> spriteDefinitions;
std::map<std::string, SpriteDefinition> spriteDefinitions{};
};

class SpriteObserver : public VulkanGridObserver {
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Griddly/Core/Observers/VectorObserverTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ TEST(VectorObserverTest, defaultObserver_global_variables) {
0,
0,
false, false};

config.globalVariableMapping = {"lightingR", "lightingB"};

uint8_t expectedData[5][5][6] = {
Expand Down
29 changes: 29 additions & 0 deletions tests/src/Griddly/Core/Observers/VulkanObserverTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#define STB_IMAGE_STATIC
#define STB_IMAGE_WRITE_STATIC
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <stb_image.h>
#include <stb_image_write.h>
#include <stdexcept>

namespace griddly {

std::unique_ptr<uint8_t[]> loadExpectedImage(std::string filename) {
int width, height, channels;

stbi_uc* pixels = stbi_load(filename.c_str(), &width, &height, &channels, STBI_rgb_alpha);

if (!pixels) {
throw std::runtime_error("Failed to load texture image.");
}

std::unique_ptr<uint8_t[]> spriteData(pixels);

return std::move(spriteData);
}

int write_image(std::string filename, uint8_t* imageData, int stride, int width, int height) {
return stbi_write_png(filename.c_str(), width, height, STBI_rgb_alpha, imageData, stride);
}

} // namespace griddly
22 changes: 3 additions & 19 deletions tests/src/Griddly/Core/Observers/VulkanObserverTest.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#define STB_IMAGE_STATIC
#define STB_IMAGE_WRITE_STATIC
#define STB_IMAGE_IMPLEMENTATION
Expand All @@ -6,31 +7,14 @@
#include <stb_image.h>
#include <stb_image_write.h>

#include <memory>

using ::testing::Return;

namespace griddly {

inline std::unique_ptr<uint8_t[]> loadExpectedImage(std::string filename) {
int width, height, channels;

stbi_uc* pixels = stbi_load(filename.c_str(), &width, &height, &channels, STBI_rgb_alpha);

if (!pixels) {
throw std::runtime_error("Failed to load texture image.");
}

auto spriteSize = width * height * channels;

std::unique_ptr<uint8_t[]> spriteData(pixels);
std::unique_ptr<uint8_t[]> loadExpectedImage(std::string filename);

return std::move(spriteData);
}
int write_image(std::string filename, uint8_t* imageData, int stride, int width, int height);

inline int write_image(std::string filename, uint8_t* imageData, int stride, int width, int height) {
return stbi_write_png(filename.c_str(), width, height, STBI_rgb_alpha, imageData, stride);
}

MATCHER_P3(ObservationResultMatcher, shape, strides, imageData, "") {
for (int x = 0; x < shape[1]; x++) {
Expand Down
Loading