1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-27 23:22:31 +02:00

Fix badge shebang and enable badges from workflow files (#327)

* Fix badge shebang and enable badges from workflow files

* Remove chmod +x from documentation
This commit is contained in:
Guillaume Chatelet 2023-08-31 12:11:42 +00:00 committed by GitHub
parent b39a27d694
commit fd4ffc1632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,19 @@
#!/usr/bin/env -S docker run --rm -it -v .:/src dlanguage/dmd dmd -run generate_badges.d #!/usr/bin/env -S docker run --rm -v ${PWD}/scripts:/scripts -v ${PWD}/.github/workflows:/.github/workflows dlanguage/dmd dmd -run /scripts/generate_badges.d
// To run this script:
// cd /path/to/cpu_features
// ./scripts/generate_badges.d
import std.algorithm : each, map, cartesianProduct, filter, joiner, sort, uniq; import std.algorithm : each, map, cartesianProduct, filter, joiner, sort, uniq;
import std.array; import std.array;
import std.base64 : Base64;
import std.conv : to; import std.conv : to;
import std.file : exists;
import std.format; import std.format;
import std.range : chain, only; import std.range : chain, only;
import std.stdio; import std.stdio;
import std.traits : EnumMembers;
import std.string : representation; import std.string : representation;
import std.base64 : Base64; import std.traits : EnumMembers;
immutable string bazel_svg = `<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6 .16l5.786 5.786L6 11.732.214 5.946 6 .161zM0 6.214V12l5.786 5.786V12L0 6.214zM18 .16l5.786 5.786L18 11.732l-5.786-5.786L18 .161zM24 6.214V12l-5.786 5.786V12L24 6.214zM12 6.16l5.786 5.786L12 17.732l-5.786-5.786L12 6.161zM11.84 18.054v5.785l-5.786-5.785v-5.786l5.785 5.786zM12.16 18.054l5.786-5.786v5.786l-5.785 5.785v-5.785z" stroke="transparent" fill="white"/></svg>`; immutable string bazel_svg = `<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6 .16l5.786 5.786L6 11.732.214 5.946 6 .161zM0 6.214V12l5.786 5.786V12L0 6.214zM18 .16l5.786 5.786L18 11.732l-5.786-5.786L18 .161zM24 6.214V12l-5.786 5.786V12L24 6.214zM12 6.16l5.786 5.786L12 17.732l-5.786-5.786L12 6.161zM11.84 18.054v5.785l-5.786-5.785v-5.786l5.785 5.786zM12.16 18.054l5.786-5.786v5.786l-5.785 5.785v-5.785z" stroke="transparent" fill="white"/></svg>`;
const string bazel_svg_base64 = Base64.encode(representation(bazel_svg)); const string bazel_svg_base64 = Base64.encode(representation(bazel_svg));
@ -63,20 +69,6 @@ private:
return format("[i%s]", id()); return format("[i%s]", id());
} }
bool enabled()
{
if (cpu == Cpu.LOONGARCH)
return false;
final switch (build_system)
{
case BuildSystem.CMake:
return os == Os.Linux || cpu == Cpu.amd64;
case BuildSystem.Bazel:
return (os == Os.Linux && (cpu == Cpu.amd64 || cpu == Cpu.AArch64))
|| (os == Os.MacOS && cpu == Cpu.amd64);
}
}
string filename() string filename()
{ {
import std.uni : toLower; import std.uni : toLower;
@ -84,6 +76,11 @@ private:
return toLower(format("%s_%s_%s.yml", cpu, os, build_system)); return toLower(format("%s_%s_%s.yml", cpu, os, build_system));
} }
bool enabled()
{
return exists("../.github/workflows/" ~ filename());
}
string append_logo(string url) string append_logo(string url)
{ {
final switch (build_system) final switch (build_system)