diff --git a/.github/workflows/zig_update.yaml b/.github/workflows/zig_update.yaml new file mode 100644 index 00000000..13d2dbf2 --- /dev/null +++ b/.github/workflows/zig_update.yaml @@ -0,0 +1,28 @@ +name: Zig Update + +on: + schedule: + - cron: 0 0 * * 1 + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Update + run: | + OLD_VERSION="$(grep -m 1 -oP '^\s+"\K\d+\.\d+\.\d+(?=":)' zig/private/versions.bzl)" + bazel run //util:update_zig_versions + [ -z "$(git status --porcelain=v1 zig/private/versions.bzl 2>/dev/null)" ] || { + NEW_VERSION="$(grep -m 1 -oP '^\s+"\K\d+\.\d+\.\d+(?=":)' zig/private/versions.bzl)" + git add zig/private/versions.bzl + readarray -t FILES < <(git grep -l -F "$OLD_VERSION" -- ':(exclude)zig/private/versions.bzl') + sed -i "s/${OLD_VERSION//./\\.}/$NEW_VERSION/g" "${FILES[@]}" + git add "${FILES[@]}" + git commit -m 'update Zig versions' + gh pr create \ + --title "chore: update Zig versions up to $NEW_VERSION" \ + --body "- [ ] Check that the automatic version replacements make sense." + } diff --git a/util/update_zig_versions.py b/util/update_zig_versions.py index 4fd1aa82..6c619433 100755 --- a/util/update_zig_versions.py +++ b/util/update_zig_versions.py @@ -110,7 +110,7 @@ def generate_bzl_content(url, data, unsupported_versions, supported_platforms): content.append(' },') - content.append('}') + content.append('}\n') return '\n'.join(content) diff --git a/zig/private/common/filetypes.bzl b/zig/private/common/filetypes.bzl index b581ef8c..86679de3 100644 --- a/zig/private/common/filetypes.bzl +++ b/zig/private/common/filetypes.bzl @@ -3,9 +3,9 @@ ZIG_SOURCE_EXTENSIONS = [".zig"] # Based on the file-type classification in the Zig compiler -# https://github.com/ziglang/zig/blob/0.10.1/src/Compilation.zig#L4679-L4709 +# https://github.com/ziglang/zig/blob/b57081f039bd3f8f82210e8896e336e3c3a6869b/src/Compilation.zig#L4679-L4709 # And which of these files are treated as C sources -# https://github.com/ziglang/zig/blob/0.10.1/src/main.zig#L1349-L1354 +# https://github.com/ziglang/zig/blob/b57081f039bd3f8f82210e8896e336e3c3a6869b/src/main.zig#L1349-L1354 ZIG_C_SOURCE_EXTENSIONS = [ # .assembly ".s",