diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3b50cf25..a057c1f0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -143,6 +143,9 @@ jobs: - "arch.dockerfile" - "fedora.dockerfile" - "ubuntu.dockerfile" + - "arch-mingw.dockerfile" + - "fedora-mingw.dockerfile" + - "ubuntu-mingw.dockerfile" steps: - uses: actions/checkout@v3 with: diff --git a/dev/docker/__tests__/arch.mingw.dockerfile b/dev/docker/__tests__/arch-mingw.dockerfile similarity index 92% rename from dev/docker/__tests__/arch.mingw.dockerfile rename to dev/docker/__tests__/arch-mingw.dockerfile index 00c6d09d..5d2b68ed 100644 --- a/dev/docker/__tests__/arch.mingw.dockerfile +++ b/dev/docker/__tests__/arch-mingw.dockerfile @@ -21,7 +21,7 @@ RUN pacman -Syuu --noconfirm && \ --gcovr true \ --doxygen true \ --ccache true \ - --powerchell true && \ + --powershell true && \ # arch cleanup pacman -Scc --noconfirm && \ rm -rf /var/cache/pacman/pkg/* && \ @@ -30,10 +30,9 @@ RUN pacman -Syuu --noconfirm && \ ENTRYPOINT ["/bin/bash"] #### Cross Building (example) -FROM setup-cpp-arch-mingw AS builder +FROM setup-cpp-arch-mingw AS builder-mingw COPY ./dev/cpp_vcpkg_project /home/app WORKDIR /home/app RUN bash -c 'source ~/.cpprc \ && task build_cross_mingw' - diff --git a/dev/docker/__tests__/arch.mingw.yml b/dev/docker/__tests__/arch-mingw.yml similarity index 100% rename from dev/docker/__tests__/arch.mingw.yml rename to dev/docker/__tests__/arch-mingw.yml diff --git a/dev/docker/__tests__/arch.dockerfile b/dev/docker/__tests__/arch.dockerfile index 3b6bc740..cc77a7e8 100644 --- a/dev/docker/__tests__/arch.dockerfile +++ b/dev/docker/__tests__/arch.dockerfile @@ -44,3 +44,11 @@ FROM archlinux:base as runner COPY --from=builder /home/app/build/my_exe/Release/ /home/app/ WORKDIR /home/app/ ENTRYPOINT ["./my_exe"] + +#### Cross Building (example) +FROM setup-cpp-arch-mingw AS builder-mingw + +COPY ./dev/cpp_vcpkg_project /home/app +WORKDIR /home/app +RUN bash -c 'source ~/.cpprc \ + && task build_cross_mingw' diff --git a/dev/docker/__tests__/fedora.mingw.dockerfile b/dev/docker/__tests__/fedora-mingw.dockerfile similarity index 86% rename from dev/docker/__tests__/fedora.mingw.dockerfile rename to dev/docker/__tests__/fedora-mingw.dockerfile index 3ca2f4a0..ed581bd1 100644 --- a/dev/docker/__tests__/fedora.mingw.dockerfile +++ b/dev/docker/__tests__/fedora-mingw.dockerfile @@ -19,15 +19,15 @@ RUN dnf -y install nodejs npm && \ --gcovr true \ --doxygen true \ --ccache true \ - --powerchell true && \ + --powershell true && \ # cleanup dnf clean all && \ rm -rf /tmp/* ENTRYPOINT ["/bin/bash"] -#### Building (example) -FROM setup-cpp-fedora AS builder +#### Cross Building (example) +FROM setup-cpp-fedora-mingw AS builder-mingw COPY ./dev/cpp_vcpkg_project /home/app WORKDIR /home/app diff --git a/dev/docker/__tests__/fedora.mingw.yml b/dev/docker/__tests__/fedora-mingw.yml similarity index 100% rename from dev/docker/__tests__/fedora.mingw.yml rename to dev/docker/__tests__/fedora-mingw.yml diff --git a/dev/docker/__tests__/fedora.dockerfile b/dev/docker/__tests__/fedora.dockerfile index 7cbe205a..55c8f19e 100644 --- a/dev/docker/__tests__/fedora.dockerfile +++ b/dev/docker/__tests__/fedora.dockerfile @@ -41,3 +41,11 @@ FROM fedora:38 as runner COPY --from=builder /home/app/build/my_exe/Release/ /home/app/ WORKDIR /home/app/ ENTRYPOINT ["./my_exe"] + +#### Cross Building (example) +FROM setup-cpp-fedora-mingw AS builder-mingw + +COPY ./dev/cpp_vcpkg_project /home/app +WORKDIR /home/app +RUN bash -c 'source ~/.cpprc \ + && task build_cross_mingw' \ No newline at end of file diff --git a/dev/scripts/generate-docker-tests.mjs b/dev/docker/__tests__/generate-docker-tests.mjs similarity index 91% rename from dev/scripts/generate-docker-tests.mjs rename to dev/docker/__tests__/generate-docker-tests.mjs index 472d0af4..3ed408ca 100644 --- a/dev/scripts/generate-docker-tests.mjs +++ b/dev/docker/__tests__/generate-docker-tests.mjs @@ -1,7 +1,7 @@ import { readFile, writeFile } from "fs/promises" async function main() { - const dockerFiles = ["ubuntu", "arch", "fedora"] + const dockerFiles = ["ubuntu", "arch", "fedora", "ubuntu-mingw", "arch-mingw", "fedora-mingw"] await Promise.all( dockerFiles.map(async (dockerFile) => { const dockerFileContent = await readFile(`./dev/docker/setup-cpp-${dockerFile}.dockerfile`, "utf-8") diff --git a/dev/docker/__tests__/ubuntu.mingw.dockerfile b/dev/docker/__tests__/ubuntu-mingw.dockerfile similarity index 92% rename from dev/docker/__tests__/ubuntu.mingw.dockerfile rename to dev/docker/__tests__/ubuntu-mingw.dockerfile index 1b9f8fb8..9737e97a 100644 --- a/dev/docker/__tests__/ubuntu.mingw.dockerfile +++ b/dev/docker/__tests__/ubuntu-mingw.dockerfile @@ -21,7 +21,7 @@ RUN apt-get update -qq && \ --gcovr true \ --doxygen true \ --ccache true \ - --powerchell true && \ + --powershell true && \ # cleanup nala autoremove -y && \ nala autopurge -y && \ @@ -33,10 +33,9 @@ RUN apt-get update -qq && \ ENTRYPOINT ["/bin/bash"] #### Cross Building (example) -FROM setup-cpp-ubuntu-mingw AS builder +FROM setup-cpp-ubuntu-mingw AS builder-mingw COPY ./dev/cpp_vcpkg_project /home/app WORKDIR /home/app RUN bash -c 'source ~/.cpprc \ && task build_cross_mingw' - diff --git a/dev/docker/__tests__/ubuntu.mingw.yml b/dev/docker/__tests__/ubuntu-mingw.yml similarity index 100% rename from dev/docker/__tests__/ubuntu.mingw.yml rename to dev/docker/__tests__/ubuntu-mingw.yml diff --git a/dev/docker/__tests__/ubuntu.dockerfile b/dev/docker/__tests__/ubuntu.dockerfile index 4e0ffd80..1f752edb 100644 --- a/dev/docker/__tests__/ubuntu.dockerfile +++ b/dev/docker/__tests__/ubuntu.dockerfile @@ -47,3 +47,11 @@ FROM ubuntu:22.04 as runner COPY --from=builder /home/app/build/my_exe/Release/ /home/app/ WORKDIR /home/app/ ENTRYPOINT ["./my_exe"] + +#### Cross Building (example) +FROM setup-cpp-ubuntu-mingw AS builder-mingw + +COPY ./dev/cpp_vcpkg_project /home/app +WORKDIR /home/app +RUN bash -c 'source ~/.cpprc \ + && task build_cross_mingw' \ No newline at end of file diff --git a/dev/docker/arch-mingw.dockerfile b/dev/docker/arch-mingw.dockerfile new file mode 100644 index 00000000..ddbd080e --- /dev/null +++ b/dev/docker/arch-mingw.dockerfile @@ -0,0 +1,7 @@ +#### Cross Building (example) +FROM setup-cpp-arch-mingw AS builder-mingw + +COPY ./dev/cpp_vcpkg_project /home/app +WORKDIR /home/app +RUN bash -c 'source ~/.cpprc \ + && task build_cross_mingw' diff --git a/dev/docker/fedora-mingw.dockerfile b/dev/docker/fedora-mingw.dockerfile new file mode 100644 index 00000000..1511924c --- /dev/null +++ b/dev/docker/fedora-mingw.dockerfile @@ -0,0 +1,7 @@ +#### Cross Building (example) +FROM setup-cpp-fedora-mingw AS builder-mingw + +COPY ./dev/cpp_vcpkg_project /home/app +WORKDIR /home/app +RUN bash -c 'source ~/.cpprc \ + && task build_cross_mingw' diff --git a/dev/docker/setup-cpp-arch-mingw.dockerfile b/dev/docker/setup-cpp-arch-mingw.dockerfile new file mode 100644 index 00000000..48b236bb --- /dev/null +++ b/dev/docker/setup-cpp-arch-mingw.dockerfile @@ -0,0 +1,29 @@ +## base image +FROM archlinux:base as setup-cpp-arch-mingw + +RUN pacman -Syuu --noconfirm && \ + pacman-db-upgrade && \ + # install nodejs + pacman -S --noconfirm --needed nodejs npm && \ + # install setup-cpp + npm install -g setup-cpp@v0.32.1 && \ + # install the compiler and tools + setup-cpp \ + --compiler mingw \ + --cmake true \ + --ninja true \ + --task true \ + --vcpkg true \ + --python true \ + --make true \ + --cppcheck true \ + --gcovr true \ + --doxygen true \ + --ccache true \ + --powershell true && \ + # arch cleanup + pacman -Scc --noconfirm && \ + rm -rf /var/cache/pacman/pkg/* && \ + rm -rf /tmp/* + +ENTRYPOINT ["/bin/bash"] diff --git a/dev/docker/setup-cpp-fedora-mingw.dockerfile b/dev/docker/setup-cpp-fedora-mingw.dockerfile new file mode 100644 index 00000000..4e8424d0 --- /dev/null +++ b/dev/docker/setup-cpp-fedora-mingw.dockerfile @@ -0,0 +1,26 @@ +## base image +FROM fedora:38 as setup-cpp-fedora-mingw + +# install nodejs +RUN dnf -y install nodejs npm && \ + # install setup-cpp + npm install -g setup-cpp@v0.32.1 && \ + # install the compiler and tools + setup-cpp \ + --compiler mingw \ + --cmake true \ + --ninja true \ + --task true \ + --vcpkg true \ + --python true \ + --make true \ + --cppcheck true \ + --gcovr true \ + --doxygen true \ + --ccache true \ + --powershell true && \ + # cleanup + dnf clean all && \ + rm -rf /tmp/* + +ENTRYPOINT ["/bin/bash"] diff --git a/dev/docker/setup-cpp-ubuntu-mingw.dockerfile b/dev/docker/setup-cpp-ubuntu-mingw.dockerfile new file mode 100644 index 00000000..71d81372 --- /dev/null +++ b/dev/docker/setup-cpp-ubuntu-mingw.dockerfile @@ -0,0 +1,32 @@ +#### Base Image +FROM ubuntu:22.04 as setup-cpp-ubuntu-mingw + +RUN apt-get update -qq && \ + # install nodejs + apt-get install -y --no-install-recommends nodejs npm && \ + # install setup-cpp + npm install -g setup-cpp@v0.32.1 && \ + # install the compiler and tools + setup-cpp \ + --nala true \ + --compiler mingw \ + --cmake true \ + --ninja true \ + --task true \ + --vcpkg true \ + --python true \ + --make true \ + --cppcheck true \ + --gcovr true \ + --doxygen true \ + --ccache true \ + --powershell true && \ + # cleanup + nala autoremove -y && \ + nala autopurge -y && \ + apt-get clean && \ + nala clean --lists && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /tmp/* + +ENTRYPOINT ["/bin/bash"] diff --git a/dev/docker/ubuntu-mingw.dockerfile b/dev/docker/ubuntu-mingw.dockerfile new file mode 100644 index 00000000..0325aef5 --- /dev/null +++ b/dev/docker/ubuntu-mingw.dockerfile @@ -0,0 +1,7 @@ +#### Cross Building (example) +FROM setup-cpp-ubuntu-mingw AS builder-mingw + +COPY ./dev/cpp_vcpkg_project /home/app +WORKDIR /home/app +RUN bash -c 'source ~/.cpprc \ + && task build_cross_mingw' diff --git a/package.json b/package.json index 306f1532..c6b3f1f4 100644 --- a/package.json +++ b/package.json @@ -55,19 +55,19 @@ "test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/", "test.lint.prettier": "prettier . --check", "test.unit": "jest --runInBand", - "build.docker_tests": "pnpm build && node ./dev/scripts/generate-docker-tests.mjs", + "build.docker_tests": "pnpm build && node ./dev/docker/__tests__/generate-docker-tests.mjs", "build.docker.arch": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch.dockerfile -t setup-cpp:arch .", "build.docker.fedora": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora.dockerfile -t setup-cpp:fedora .", "build.docker.ubuntu": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu.dockerfile -t setup-cpp:ubuntu .", - "build.docker.arch.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch.mingw.dockerfile -t setup-cpp:arch-mingw .", - "build.docker.fedora.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora.mingw.dockerfile -t setup-cpp:fedora-mingw .", - "build.docker.ubuntu.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu.mingw.dockerfile -t setup-cpp:ubuntu-mingw .", + "build.docker.arch.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/arch-mingw.dockerfile -t setup-cpp:arch-mingw .", + "build.docker.fedora.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/fedora-mingw.dockerfile -t setup-cpp:fedora-mingw .", + "build.docker.ubuntu.mingw": "pnpm build.docker_tests && docker build -f ./dev/docker/__tests__/ubuntu-mingw.dockerfile -t setup-cpp:ubuntu-mingw .", "test.docker.arch": "pnpm build.docker.arch && container-structure-test test --image setup-cpp:arch --config ./dev/docker/__tests__/arch.yml", "test.docker.fedora": "pnpm build.docker.fedora && container-structure-test test --image setup-cpp:fedora --config ./dev/docker/__tests__/fedora.yml", "test.docker.ubuntu": "pnpm build.docker.ubuntu && container-structure-test test --image setup-cpp:ubuntu --config ./dev/docker/__tests__/ubuntu.yml", - "test.docker.arch.mingw": "pnpm build.docker.arch.mingw && container-structure-test test --image setup-cpp:arch-mingw --config ./dev/docker/__tests__/arch.mingw.yml", - "test.docker.fedora.mingw": "pnpm build.docker.fedora.mingw && container-structure-test test --image setup-cpp:fedora-mingw --config ./dev/docker/__tests__/fedora.mingw.yml", - "test.docker.ubuntu.mingw": "pnpm build.docker.ubuntu.mingw && container-structure-test test --image setup-cpp:ubuntu-mingw --config ./dev/docker/__tests__/ubuntu.mingw.yml" + "test.docker.arch.mingw": "pnpm build.docker.arch.mingw && container-structure-test test --image setup-cpp:arch-mingw --config ./dev/docker/__tests__/arch-mingw.yml", + "test.docker.fedora.mingw": "pnpm build.docker.fedora.mingw && container-structure-test test --image setup-cpp:fedora-mingw --config ./dev/docker/__tests__/fedora-mingw.yml", + "test.docker.ubuntu.mingw": "pnpm build.docker.ubuntu.mingw && container-structure-test test --image setup-cpp:ubuntu-mingw --config ./dev/docker/__tests__/ubuntu-mingw.yml" }, "prettier": "prettier-config-atomic", "devDependencies": { @@ -198,4 +198,4 @@ "outputFormat": "commonjs" } } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 02fe3659..cf6cafaf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,5 +28,10 @@ "outDir": "./dist" }, "compileOnSave": false, - "include": ["./src", "dev/scripts", "packages/untildify-user/untildify.ts"] + "include": [ + "./src", + "dev/scripts", + "packages/untildify-user/untildify.ts", + "dev/docker/__tests__/generate-docker-tests.mjs" + ] }