Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 39 additions & 3 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
fail-fast: false

matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
build_type: [RelWithDebInfo]
c_compiler: [gcc, clang]
c_win_sys: [mingw64]
include:
- os: macos-latest
c_compiler: clang
Expand All @@ -25,32 +26,67 @@ jobs:
- os: ubuntu-latest
c_compiler: clang
exclude:
- os: linux-latest
c_win_sys: mingw64
- os: macos-latest
c_win_sys: mingw64
c_compiler: gcc
- os: windows-latest
c_win_sys: mingw64
c_compiler: clang

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Install Linux dependencies
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: >
sudo apt install -y libcurl4-openssl-dev libxml2-dev rsync

- name: 'Install dependencies (Windows)'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.c_win_sys}}
install: >-
git
make
pacboy: >-
toolchain:p
cmake:p
libxml2:x
if: matrix.os == 'windows-latest'

- name: Configure CMake (Windows)
shell: msys2 {0}
run: >
cmake -B "${{ steps.strings.outputs.build-output-dir }}"
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S "${{ github.workspace }}"
if: runner.os == 'Windows'

- name: Build (Windows)
shell: msys2 {0}
run: cmake --build "${{ steps.strings.outputs.build-output-dir }}" --config ${{ matrix.build_type }}
if: runner.os == 'Windows'

- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
if: runner.os != 'Windows'

- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
if: runner.os != 'Windows'

# TODO: Write ctests
#- name: Test
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
add_compile_options(${win_cflags})
endif()

link_libraries(curl)
if (WIN32)
link_libraries(shlwapi)
endif ()
add_subdirectory(src)

set(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}")
Expand Down
106 changes: 53 additions & 53 deletions examples/template/example.ini
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
[meta]
; (string) Mission type: hst, jwst
mission =

; (string) Name of delivery
name =

; (string) A codename is only used when mission is set to "hst"
codename =

; (string) Version of the delivery
version =

; (string) Release Candidate of delivery.
; NOTE: Ignored when final is true.
rc =

; (boolean) Enable delivery finalization routines
final =

; (string) URL of Conda environment YAML
; NOTE: Generally the final release of a older delivery
based_on =

; (string) Target version of Python
python =

[conda]
installer_name = Miniforge3
installer_version = 23.3.1-1
installer_platform = ${OMC_CONDA_PLATFORM}
installer_arch = ${OMC_CONDA_ARCH}
installer_baseurl = https://github.com/conda-forge/miniforge/releases/latest/download

; (list) Conda packages to install
conda_packages =

; (list) Python packages to install
pip_packages =

[runtime]
; (string) Environment variable key pairs
; key=value

[test:name] ; where test:"name" denotes the package name
; (string) Version of tested package
version =

; (string) Git repository of tested package
repository =

; (list) Commands to execute against tested package
script =
[meta]
; (string) Mission type: hst, jwst
mission =
; (string) Name of delivery
name =
; (string) A codename is only used when mission is set to "hst"
codename =
; (string) Version of the delivery
version =
; (string) Release Candidate of delivery.
; NOTE: Ignored when final is true.
rc =
; (boolean) Enable delivery finalization routines
final =
; (string) URL of Conda environment YAML
; NOTE: Generally the final release of a older delivery
based_on =
; (string) Target version of Python
python =
[conda]
installer_name = Miniforge3
installer_version = 23.3.1-1
installer_platform = ${OMC_CONDA_PLATFORM}
installer_arch = ${OMC_CONDA_ARCH}
installer_baseurl = https://github.com/conda-forge/miniforge/releases/latest/download
; (list) Conda packages to install
conda_packages =
; (list) Python packages to install
pip_packages =
[runtime]
; (string) Environment variable key pairs
; key=value
[test:name] ; where test:"name" denotes the package name
; (string) Version of tested package
version =
; (string) Git repository of tested package
repository =
; (list) Commands to execute against tested package
script =
1 change: 1 addition & 0 deletions include/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
#define OMC_OS_WINDOWS
#include "os_windows.h"

#elif defined(__linux__)
#define OMC_OS_LINUX
Expand Down
4 changes: 2 additions & 2 deletions include/deliverable.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/utsname.h>

#include "omc.h"

#define DELIVERY_PLATFORM_MAX 4
Expand Down Expand Up @@ -139,7 +139,7 @@ struct Delivery {
* \brief Global runtime variables
*/
struct Runtime {
RuntimeEnv *environ; ///< Environment variables
struct StrList *env; ///< Environment variables
} runtime;

/*! \struct Test
Expand Down
3 changes: 2 additions & 1 deletion include/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include "environment.h"
#include "omc.h"

typedef struct StrList RuntimeEnv;

Expand All @@ -20,4 +20,5 @@ char *runtime_expand_var(RuntimeEnv *env, char *input);
void runtime_export(RuntimeEnv *env, char **keys);
void runtime_apply(RuntimeEnv *env);
void runtime_free(RuntimeEnv *env);

#endif //OMC_ENVIRONMENT_H
10 changes: 5 additions & 5 deletions include/ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ struct INIFILE *ini_open(const char *filename);
struct INISection *ini_section_search(struct INIFILE **ini, unsigned mode, char *value);

/**
*
* @param ini
* @param section
* @param key
* @return
*
* @param ini
* @param section
* @param key
* @return
*/
int ini_has_key(struct INIFILE *ini, const char *section, const char *key);

Expand Down
12 changes: 6 additions & 6 deletions include/omc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <sys/statvfs.h>
#include "config.h"

#define SYSERROR(MSG, ...) do { \
fprintf(stderr, "%s:%s:%d:%s - ", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno) ? "info" : strerror(errno)); \
fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \
} while (0)

#define OMC_BUFSIZ 8192
#define OMC_NAME_MAX 255
#define OMC_DIRSTACK_MAX 1024
#define OMC_TIME_STR_MAX 128
#define HTTP_ERROR(X) X >= 400

#include "config.h"
#include "template.h"

#include "strlist.h"
#include "str.h"
#include "environment.h"
#include "utils.h"
#include "copy.h"
#include "ini.h"
#include "conda.h"
#include "environment.h"
#include "artifactory.h"
#include "docker.h"
#include "deliverable.h"
#include "str.h"
#include "strlist.h"
#include "system.h"
#include "download.h"
#include "recipe.h"
#include "relocation.h"
#include "wheel.h"
#include "junitxml.h"
#include "deliverable.h"

#define guard_runtime_free(X) do { if (X) { runtime_free(X); X = NULL; } } while (0)
#define guard_strlist_free(X) do { if ((*X)) { strlist_free(X); (*X) = NULL; } } while (0)
Expand Down
3 changes: 3 additions & 0 deletions include/os_darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define OMC_OS_DARWIN_H

#include <sys/mount.h>
#include <sys/utsname.h>

#ifndef __DARWIN_64_BIT_INO_T
#define statvfs statfs
Expand All @@ -20,6 +21,8 @@
#include <sys/syslimits.h>
#endif

#include <sys/wait.h>

extern char **environ;
#define __environ environ

Expand Down
3 changes: 3 additions & 0 deletions include/os_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#define OMC_OS_LINUX_H

#include <limits.h>
#include <sys/statvfs.h>
#include <sys/utsname.h>
#include <sys/wait.h>

#ifndef PATH_MAX
#include <linux/limits.h>
Expand Down
22 changes: 22 additions & 0 deletions include/os_windows.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Created by jhunk on 5/19/2024.
//

#ifndef OMC_OS_WINDOWS_H
#define OMC_OS_WINDOWS_H


#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#define lstat stat
#define NAME_MAX 256
#define MAXNAMLEN 256
#define __environ _environ
#undef mkdir
#define mkdir(X, Y) _mkdir(X)

int setenv(const char *key, const char *value, int overwrite);
char *realpath(const char *path, char **dest);

#endif //OMC_OS_WINDOWS_H
2 changes: 1 addition & 1 deletion include/relocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string.h>
#if defined(OMC_OS_DARWIN)
#include <limits.h>
# else
#elif defined(OMC_OS_LINUX)
#include <linux/limits.h>
#endif
#include <unistd.h>
Expand Down
4 changes: 4 additions & 0 deletions include/str.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,9 @@ char *tolower_s(char *s);
* @return pointer to new string
*/
char *to_short_version(const char *s);
#if defined(OMC_OS_WINDOWS)
char *strsep(char **str, const char *delim);
char *strndup(const char *str, size_t nelem);
#endif

#endif //OMC_STR_H
2 changes: 2 additions & 0 deletions include/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#include <errno.h>
#include <unistd.h>
#include <limits.h>
#if defined(OMC_OS_UNIX)
#include <sys/wait.h>
#endif
#include <sys/stat.h>

struct Process {
Expand Down
Empty file added rules/hst.ini
Empty file.
Loading