diff --git a/.dockerignore b/.dockerignore index 716b782..65950ea 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,8 @@ # Project Files unneeded by docker -ci/Makefile -ci/docker -ci/doc -ci/cache +cmake/ci/Makefile +cmake/ci/docker +cmake/ci/doc +cmake/ci/cache .git .gitignore .github diff --git a/.github/workflows/aarch64_linux.yml b/.github/workflows/aarch64_linux_cmake.yml similarity index 77% rename from .github/workflows/aarch64_linux.yml rename to .github/workflows/aarch64_linux_cmake.yml index 2de7289..7147217 100644 --- a/.github/workflows/aarch64_linux.yml +++ b/.github/workflows/aarch64_linux_cmake.yml @@ -1,4 +1,4 @@ -name: aarch64 Linux +name: AArch64 Linux CMake on: push: @@ -9,7 +9,7 @@ on: jobs: # Building using the github runner environement directly. - aarch64: + make: runs-on: ubuntu-latest strategy: matrix: @@ -23,6 +23,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build - run: make --directory=ci ${TARGET}_build + run: make --directory=cmake/ci ${TARGET}_build - name: Test - run: make --directory=ci ${TARGET}_test + run: make --directory=cmake/ci ${TARGET}_test diff --git a/.github/workflows/amd64_freebsd.yml b/.github/workflows/amd64_freebsd_cmake.yml similarity index 84% rename from .github/workflows/amd64_freebsd.yml rename to .github/workflows/amd64_freebsd_cmake.yml index eeab380..8bad4f8 100644 --- a/.github/workflows/amd64_freebsd.yml +++ b/.github/workflows/amd64_freebsd_cmake.yml @@ -1,4 +1,4 @@ -name: amd64 FreeBSD +name: amd64 FreeBSD CMake on: push: @@ -10,7 +10,7 @@ on: jobs: # Only MacOS hosted runner provides virtualisation with vagrant/virtualbox installed. # see: https://github.com/actions/virtual-environments/tree/main/images/macos - freebsd: + make: runs-on: macos-10.15 steps: - uses: actions/checkout@v2 @@ -19,4 +19,4 @@ jobs: - name: VirtualBox version run: virtualbox -h - name: Build - run: cd ci/vagrant/freebsd && vagrant up + run: cd cmake/ci/vagrant/freebsd && vagrant up diff --git a/.github/workflows/amd64_linux.yml b/.github/workflows/amd64_linux.yml deleted file mode 100644 index 21f4f90..0000000 --- a/.github/workflows/amd64_linux.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: amd64 Linux - -on: - push: - pull_request: - schedule: - # min hours day(month) month day(week) - - cron: '0 0 7,22 * *' - -jobs: - # Building using the github runner environement directly. - make: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Env - run: make --directory=ci amd64_env - - name: Devel - run: make --directory=ci amd64_devel - - name: Build - run: make --directory=ci amd64_build - - name: Test - run: make --directory=ci amd64_test - - name: Install Env - run: make --directory=ci amd64_install_env - - name: Install Devel - run: make --directory=ci amd64_install_devel - - name: Install Build - run: make --directory=ci amd64_install_build - - name: Install Test - run: make --directory=ci amd64_install_test diff --git a/.github/workflows/amd64_bazel_linux.yml b/.github/workflows/amd64_linux_bazel.yml similarity index 97% rename from .github/workflows/amd64_bazel_linux.yml rename to .github/workflows/amd64_linux_bazel.yml index 6a1add3..599faf5 100644 --- a/.github/workflows/amd64_bazel_linux.yml +++ b/.github/workflows/amd64_linux_bazel.yml @@ -1,4 +1,4 @@ -name: amd64 Bazel Linux +name: amd64 Linux Bazel on: push: diff --git a/.github/workflows/amd64_linux_cmake.yml b/.github/workflows/amd64_linux_cmake.yml new file mode 100644 index 0000000..90ccc80 --- /dev/null +++ b/.github/workflows/amd64_linux_cmake.yml @@ -0,0 +1,31 @@ +name: amd64 Linux CMake + +on: + push: + pull_request: + schedule: + # min hours day(month) month day(week) + - cron: '0 0 7,22 * *' + +jobs: + # Building using the github runner environement directly. + make: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Env + run: make --directory=cmake/ci amd64_env + - name: Devel + run: make --directory=cmake/ci amd64_devel + - name: Build + run: make --directory=cmake/ci amd64_build + - name: Test + run: make --directory=cmake/ci amd64_test + - name: Install Env + run: make --directory=cmake/ci amd64_install_env + - name: Install Devel + run: make --directory=cmake/ci amd64_install_devel + - name: Install Build + run: make --directory=cmake/ci amd64_install_build + - name: Install Test + run: make --directory=cmake/ci amd64_install_test diff --git a/.github/workflows/amd64_macos.yml b/.github/workflows/amd64_macos_cmake.yml similarity index 97% rename from .github/workflows/amd64_macos.yml rename to .github/workflows/amd64_macos_cmake.yml index 19ec18c..3756500 100644 --- a/.github/workflows/amd64_macos.yml +++ b/.github/workflows/amd64_macos_cmake.yml @@ -1,4 +1,4 @@ -name: amd64 macOS +name: amd64 MacOS CMake on: push: diff --git a/.github/workflows/amd64_windows.yml b/.github/workflows/amd64_windows_cmake.yml similarity index 96% rename from .github/workflows/amd64_windows.yml rename to .github/workflows/amd64_windows_cmake.yml index 7ff1ac0..7118533 100644 --- a/.github/workflows/amd64_windows.yml +++ b/.github/workflows/amd64_windows_cmake.yml @@ -1,4 +1,4 @@ -name: amd64 Windows +name: amd64 Windows CMake on: push: diff --git a/.github/workflows/arm_linux.yml b/.github/workflows/arm_linux_cmake.yml similarity index 81% rename from .github/workflows/arm_linux.yml rename to .github/workflows/arm_linux_cmake.yml index 2272188..87bb6bb 100644 --- a/.github/workflows/arm_linux.yml +++ b/.github/workflows/arm_linux_cmake.yml @@ -1,4 +1,4 @@ -name: arm Linux +name: ARM Linux CMake on: push: @@ -9,7 +9,7 @@ on: jobs: # Building using the github runner environement directly. - arm: + make: runs-on: ubuntu-latest strategy: matrix: @@ -26,6 +26,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build - run: make --directory=ci ${TARGET}_build + run: make --directory=cmake/ci ${TARGET}_build - name: Test - run: make --directory=ci ${TARGET}_test + run: make --directory=cmake/ci ${TARGET}_test diff --git a/.github/workflows/mips_linux.yml b/.github/workflows/mips_linux_cmake.yml similarity index 78% rename from .github/workflows/mips_linux.yml rename to .github/workflows/mips_linux_cmake.yml index 571de3a..9ce7901 100644 --- a/.github/workflows/mips_linux.yml +++ b/.github/workflows/mips_linux_cmake.yml @@ -1,4 +1,4 @@ -name: mips Linux +name: MIPS Linux CMake on: push: @@ -9,7 +9,7 @@ on: jobs: # Building using the github runner environement directly. - mips: + make: runs-on: ubuntu-latest strategy: matrix: @@ -25,6 +25,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build - run: make --directory=ci ${TARGET}_build + run: make --directory=cmake/ci ${TARGET}_build - name: Test - run: make --directory=ci ${TARGET}_test + run: make --directory=cmake/ci ${TARGET}_test diff --git a/ci/Makefile b/cmake/ci/Makefile similarity index 99% rename from ci/Makefile rename to cmake/ci/Makefile index 47ea30a..dc19af8 100644 --- a/ci/Makefile +++ b/cmake/ci/Makefile @@ -113,7 +113,7 @@ $(targets_amd64): amd64_%: docker/amd64/Dockerfile --tag ${IMAGE}:amd64_$* \ --target=$* \ -f $< \ - .. + ../.. #$(info Create targets: save_amd64 $(addprefix save_amd64_, $(STAGES)) (debug).) save_targets_amd64 = $(addprefix save_amd64_, $(STAGES)) @@ -160,7 +160,7 @@ $$(targets_toolchain_$1): %_$1: docker/toolchain/Dockerfile --build-arg TARGET=$$* \ --target=$1 \ -f $$< \ - .. + ../.. #$$(info Create targets: save_toolchain_$1 $(addprefix save_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))) (debug).) save_targets_toolchain_$1 = $(addprefix save_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))) diff --git a/ci/README.md b/cmake/ci/README.md similarity index 85% rename from ci/README.md rename to cmake/ci/README.md index a7d0123..b6e6628 100644 --- a/ci/README.md +++ b/cmake/ci/README.md @@ -7,20 +7,20 @@ | Windows | [![][img_4a]][lnk_4a] | ![][img_na] | ![][img_na] | ![][img_na] | [img_na]: https://img.shields.io/badge/build-N%2FA-lightgrey -[lnk_1a]: https://github.com/google/cpu_features/actions/workflows/amd64_FreeBSD.yml -[img_1a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20FreeBSD/main -[lnk_2a]: https://github.com/google/cpu_features/actions/workflows/amd64_Linux.yml -[img_2a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20Linux/main -[lnk_3a]: https://github.com/google/cpu_features/actions/workflows/amd64_macOS.yml -[img_3a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20macOS/main -[lnk_4a]: https://github.com/google/cpu_features/actions/workflows/amd64_Windows.yml -[img_4a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20Windows/main -[lnk_2b]: https://github.com/google/cpu_features/actions/workflows/aarch64_Linux.yml -[img_2b]: https://img.shields.io/github/workflow/status/google/cpu_features/aarch64%20Linux/main -[lnk_2c]: https://github.com/google/cpu_features/actions/workflows/arm_Linux.yml -[img_2c]: https://img.shields.io/github/workflow/status/google/cpu_features/arm%20Linux/main -[lnk_2d]: https://github.com/google/cpu_features/actions/workflows/mips_Linux.yml -[img_2d]: https://img.shields.io/github/workflow/status/google/cpu_features/mips%20Linux/main +[lnk_1a]: https://github.com/google/cpu_features/actions/workflows/amd64_freebsd_cmake.yml +[img_1a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20FreeBSD%20CMake/main +[lnk_2a]: https://github.com/google/cpu_features/actions/workflows/amd64_linux_cmake.yml +[img_2a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20Linux%20CMake/main +[lnk_3a]: https://github.com/google/cpu_features/actions/workflows/amd64_macos_cmake.yml +[img_3a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20MacOS%20CMake/main +[lnk_4a]: https://github.com/google/cpu_features/actions/workflows/amd64_windows_cmake.yml +[img_4a]: https://img.shields.io/github/workflow/status/google/cpu_features/amd64%20Windows%20CMake/main +[lnk_2b]: https://github.com/google/cpu_features/actions/workflows/aarch64_linux_cmake.yml +[img_2b]: https://img.shields.io/github/workflow/status/google/cpu_features/AArch64%20Linux%20CMake/main +[lnk_2c]: https://github.com/google/cpu_features/actions/workflows/arm_linux_cmake.yml +[img_2c]: https://img.shields.io/github/workflow/status/google/cpu_features/ARM%20Linux%20CMake/main +[lnk_2d]: https://github.com/google/cpu_features/actions/workflows/mips_linux_cmake.yml +[img_2d]: https://img.shields.io/github/workflow/status/google/cpu_features/MIPS%20Linux%20CMake/main ## Makefile/Docker testing To test the build on various distro, we are using docker containers and a Makefile for orchestration. diff --git a/ci/doc/docker.dot b/cmake/ci/doc/docker.dot similarity index 100% rename from ci/doc/docker.dot rename to cmake/ci/doc/docker.dot diff --git a/ci/doc/docker.svg b/cmake/ci/doc/docker.svg similarity index 100% rename from ci/doc/docker.svg rename to cmake/ci/doc/docker.svg diff --git a/ci/doc/generate_image.sh b/cmake/ci/doc/generate_image.sh similarity index 100% rename from ci/doc/generate_image.sh rename to cmake/ci/doc/generate_image.sh diff --git a/ci/docker/amd64/Dockerfile b/cmake/ci/docker/amd64/Dockerfile similarity index 98% rename from ci/docker/amd64/Dockerfile rename to cmake/ci/docker/amd64/Dockerfile index 9b25e28..2cc3270 100644 --- a/ci/docker/amd64/Dockerfile +++ b/cmake/ci/docker/amd64/Dockerfile @@ -38,7 +38,7 @@ COPY --from=build /usr/local /usr/local/ FROM install_env AS install_devel WORKDIR /home/sample -COPY ci/sample . +COPY cmake/ci/sample . FROM install_devel AS install_build RUN cmake -S. -Bbuild diff --git a/ci/docker/toolchain/Dockerfile b/cmake/ci/docker/toolchain/Dockerfile similarity index 100% rename from ci/docker/toolchain/Dockerfile rename to cmake/ci/docker/toolchain/Dockerfile diff --git a/ci/sample/CMakeLists.txt b/cmake/ci/sample/CMakeLists.txt similarity index 100% rename from ci/sample/CMakeLists.txt rename to cmake/ci/sample/CMakeLists.txt diff --git a/ci/sample/main.cpp b/cmake/ci/sample/main.cpp similarity index 100% rename from ci/sample/main.cpp rename to cmake/ci/sample/main.cpp diff --git a/ci/vagrant/freebsd/Vagrantfile b/cmake/ci/vagrant/freebsd/Vagrantfile similarity index 89% rename from ci/vagrant/freebsd/Vagrantfile rename to cmake/ci/vagrant/freebsd/Vagrantfile index 7ef7bfa..421dc88 100644 --- a/ci/vagrant/freebsd/Vagrantfile +++ b/cmake/ci/vagrant/freebsd/Vagrantfile @@ -49,11 +49,11 @@ Vagrant.configure("2") do |config| #config.vm.synced_folder "../../..", "/home/vagrant/project" config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true - config.vm.provision "file", source: "../../../CMakeLists.txt", destination: "$HOME/project/" - config.vm.provision "file", source: "../../../cmake", destination: "$HOME/project/" - config.vm.provision "file", source: "../../../include", destination: "$HOME/project/" - config.vm.provision "file", source: "../../../src", destination: "$HOME/project/" - config.vm.provision "file", source: "../../../test", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../CMakeLists.txt", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../cmake", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../include", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../src", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../test", destination: "$HOME/project/" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. diff --git a/scripts/generate_badges.d b/scripts/generate_badges.d index 9e0cfea..8eee1fd 100644 --- a/scripts/generate_badges.d +++ b/scripts/generate_badges.d @@ -22,36 +22,6 @@ enum Os Windows } -string getWorkflowName(Cpu cpu) -{ - final switch (cpu) - { - case Cpu.amd64: - return "amd64"; - case Cpu.AArch64: - return "aarch64"; - case Cpu.ARM: - return "arm"; - case Cpu.MIPS: - return "mips"; - } -} - -string getWorkflowName(Os os) -{ - final switch (os) - { - case Os.FreeBSD: - return "FreeBSD"; - case Os.Linux: - return "Linux"; - case Os.MacOS: - return "macOS"; - case Os.Windows: - return "Windows"; - } -} - struct Configuration { const: @@ -130,10 +100,13 @@ void main() .map!(t => Configuration(t[0], t[1])) .filter!(conf => !conf.disabled) .each!((conf) { - const cpu_name = getWorkflowName(conf.cpu); - const os_name = getWorkflowName(conf.os); - writefln("%s: https://github.com/google/cpu_features/actions/workflows/%s_%s.yml", conf.link_ref, cpu_name, os_name); - writefln("%s: https://img.shields.io/github/workflow/status/google/cpu_features/%s%%20%s/main", conf - .image_ref, cpu_name, os_name); + import std.uni : toLower; + import std.uri : encode; + + const filename = toLower(format("%s_%s_%s.yml", conf.cpu, conf.os, "cmake")); + writefln("%s: https://github.com/google/cpu_features/actions/workflows/%s", conf.link_ref, filename); + + const worflow_name = encode(format("%s %s %s", conf.cpu, conf.os, "CMake")); + writefln("%s: https://img.shields.io/github/workflow/status/google/cpu_features/%s/main", conf.image_ref, worflow_name); }); }