Skip to content

Commit beb1789

Browse files
committed
Merge branch 'ps/ci-rust' into dk/ci-rust-fix
* ps/ci-rust: rust: support for Windows ci: verify minimum supported Rust version ci: check for common Rust mistakes via Clippy rust/varint: add safety comments ci: check formatting of our Rust code ci: deduplicate calls to `apt-get update` t8020: fix test failure due to indeterministic tag sorting gitlab-ci: upload Meson test logs as JUnit reports gitlab-ci: drop workaround for Python certificate store on Windows gitlab-ci: ignore failures to disable realtime monitoring gitlab-ci: dedup instructions to disable realtime monitoring ci: enable Rust for breaking-changes jobs ci: convert "pedantic" job into full build with breaking changes BreakingChanges: announce Rust becoming mandatory varint: reimplement as test balloon for Rust varint: use explicit width for integers help: report on whether or not Rust is enabled Makefile: introduce infrastructure to build internal Rust library Makefile: reorder sources after includes meson: add infrastructure to build internal Rust library
2 parents 45547b6 + e509b5b commit beb1789

22 files changed

Lines changed: 544 additions & 162 deletions

.github/workflows/main.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ jobs:
379379
- jobname: linux-breaking-changes
380380
cc: gcc
381381
image: ubuntu:rolling
382+
- jobname: fedora-breaking-changes-meson
383+
image: fedora:latest
382384
- jobname: linux-leaks
383385
image: ubuntu:rolling
384386
cc: gcc
@@ -396,8 +398,6 @@ jobs:
396398
# Supported until 2025-04-02.
397399
- jobname: linux32
398400
image: i386/ubuntu:focal
399-
- jobname: pedantic
400-
image: fedora:latest
401401
# A RHEL 8 compatible distro. Supported until 2029-05-31.
402402
- jobname: almalinux-8
403403
image: almalinux:8
@@ -458,6 +458,21 @@ jobs:
458458
- run: ci/install-dependencies.sh
459459
- run: ci/run-static-analysis.sh
460460
- run: ci/check-directional-formatting.bash
461+
rust-analysis:
462+
needs: ci-config
463+
if: needs.ci-config.outputs.enabled == 'yes'
464+
env:
465+
jobname: RustAnalysis
466+
CI_JOB_IMAGE: ubuntu:rolling
467+
runs-on: ubuntu-latest
468+
container: ubuntu:rolling
469+
concurrency:
470+
group: rust-analysis-${{ github.ref }}
471+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
472+
steps:
473+
- uses: actions/checkout@v4
474+
- run: ci/install-dependencies.sh
475+
- run: ci/run-rust-checks.sh
461476
sparse:
462477
needs: ci-config
463478
if: needs.ci-config.outputs.enabled == 'yes'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/fuzz_corpora
2+
/target/
3+
/Cargo.lock
24
/GIT-BUILD-DIR
35
/GIT-BUILD-OPTIONS
46
/GIT-CFLAGS

.gitlab-ci.yml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ test:linux:
4545
- jobname: linux-breaking-changes
4646
image: ubuntu:20.04
4747
CC: gcc
48+
- jobname: fedora-breaking-changes-meson
49+
image: fedora:latest
4850
- jobname: linux-TEST-vars
4951
image: ubuntu:20.04
5052
CC: gcc
@@ -58,8 +60,6 @@ test:linux:
5860
- jobname: linux-asan-ubsan
5961
image: ubuntu:rolling
6062
CC: clang
61-
- jobname: pedantic
62-
image: fedora:latest
6363
- jobname: linux-musl-meson
6464
image: alpine:latest
6565
- jobname: linux32
@@ -70,6 +70,8 @@ test:linux:
7070
artifacts:
7171
paths:
7272
- t/failed-test-artifacts
73+
reports:
74+
junit: build/meson-logs/testlog.junit.xml
7375
when: on_failure
7476

7577
test:osx:
@@ -110,16 +112,24 @@ test:osx:
110112
artifacts:
111113
paths:
112114
- t/failed-test-artifacts
115+
reports:
116+
junit: build/meson-logs/testlog.junit.xml
113117
when: on_failure
114118

119+
.windows_before_script: &windows_before_script
120+
# Disabling realtime monitoring fails on some of the runners, but it
121+
# significantly speeds up test execution in the case where it works. We thus
122+
# try our luck, but ignore any failures.
123+
- Set-MpPreference -DisableRealtimeMonitoring $true; $true
124+
115125
build:mingw64:
116126
stage: build
117127
tags:
118128
- saas-windows-medium-amd64
119129
variables:
120130
NO_PERL: 1
121131
before_script:
122-
- Set-MpPreference -DisableRealtimeMonitoring $true
132+
- *windows_before_script
123133
- ./ci/install-sdk.ps1 -directory "git-sdk"
124134
script:
125135
- git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
@@ -136,7 +146,7 @@ test:mingw64:
136146
- job: "build:mingw64"
137147
artifacts: true
138148
before_script:
139-
- Set-MpPreference -DisableRealtimeMonitoring $true
149+
- *windows_before_script
140150
- git-sdk/usr/bin/bash.exe -l -c 'tar xf artifacts/artifacts.tar.gz'
141151
- New-Item -Path .git/info -ItemType Directory
142152
- New-Item .git/info/exclude -ItemType File -Value "/git-sdk"
@@ -150,18 +160,10 @@ test:mingw64:
150160
tags:
151161
- saas-windows-medium-amd64
152162
before_script:
153-
- Set-MpPreference -DisableRealtimeMonitoring $true
154-
- choco install -y git meson ninja openssl
163+
- *windows_before_script
164+
- choco install -y git meson ninja rust-ms
155165
- Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
156166
- refreshenv
157-
# The certificate store for Python on Windows is broken and fails to fetch
158-
# certificates, see https://bugs.python.org/issue36011. This seems to
159-
# mostly be an issue with how the GitLab image is set up as it is a
160-
# non-issue on GitHub Actions. Work around the issue by importing
161-
# cetrificates manually.
162-
- Invoke-WebRequest https://curl.haxx.se/ca/cacert.pem -OutFile cacert.pem
163-
- openssl pkcs12 -export -nokeys -in cacert.pem -out certs.pfx -passout "pass:"
164-
- Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx
165167

166168
build:msvc-meson:
167169
extends: .msvc-meson
@@ -183,6 +185,9 @@ test:msvc-meson:
183185
script:
184186
- meson test -C build --no-rebuild --print-errorlogs --slice $Env:CI_NODE_INDEX/$Env:CI_NODE_TOTAL
185187
parallel: 10
188+
artifacts:
189+
reports:
190+
junit: build/meson-logs/testlog.junit.xml
186191

187192
test:fuzz-smoke-tests:
188193
image: ubuntu:latest
@@ -207,6 +212,17 @@ static-analysis:
207212
- ./ci/run-static-analysis.sh
208213
- ./ci/check-directional-formatting.bash
209214

215+
rust-analysis:
216+
image: ubuntu:rolling
217+
stage: analyze
218+
needs: [ ]
219+
variables:
220+
jobname: RustAnalysis
221+
before_script:
222+
- ./ci/install-dependencies.sh
223+
script:
224+
- ./ci/run-rust-checks.sh
225+
210226
check-whitespace:
211227
image: ubuntu:latest
212228
stage: analyze

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "gitcore"
3+
version = "0.1.0"
4+
edition = "2018"
5+
rust-version = "1.49.0"
6+
7+
[lib]
8+
crate-type = ["staticlib"]
9+
10+
[dependencies]

Documentation/BreakingChanges.adoc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,51 @@ JGit, libgit2 and Gitoxide need to support it.
171171
matches the default branch name used in new repositories by many of the
172172
big Git forges.
173173

174+
* Git will require Rust as a mandatory part of the build process. While Git
175+
already started to adopt Rust in Git 2.49, all parts written in Rust are
176+
optional for the time being. This includes:
177+
+
178+
** The Rust wrapper around libgit.a that is part of "contrib/" and which has
179+
been introduced in Git 2.49.
180+
** Subsystems that have an alternative implementation in Rust to test
181+
interoperability between our C and Rust codebase.
182+
** Newly written features that are not mission critical for a fully functional
183+
Git client.
184+
+
185+
These changes are meant as test balloons to allow distributors of Git to prepare
186+
for Rust becoming a mandatory part of the build process. There will be multiple
187+
milestones for the introduction of Rust:
188+
+
189+
--
190+
1. Initially, with Git 2.52, support for Rust will be auto-detected by Meson and
191+
disabled in our Makefile so that the project can sort out the initial
192+
infrastructure.
193+
2. In Git 2.53, both build systems will default-enable support for Rust.
194+
Consequently, builds will break by default if Rust is not available on the
195+
build host. The use of Rust can still be explicitly disabled via build
196+
flags.
197+
3. In Git 3.0, the build options will be removed and support for Rust is
198+
mandatory.
199+
--
200+
+
201+
You can explicitly ask both Meson and our Makefile-based system to enable Rust
202+
by saying `meson configure -Drust=enabled` and `make WITH_RUST=YesPlease`,
203+
respectively.
204+
+
205+
The Git project will declare the last version before Git 3.0 to be a long-term
206+
support release. This long-term release will receive important bug fixes for at
207+
least four release cycles and security fixes for six release cycles. The Git
208+
project will hand over maintainership of the long-term release to distributors
209+
in case they need to extend the life of that long-term release even further.
210+
Details of how this long-term release will be handed over to the community will
211+
be discussed once the Git project decides to stop officially supporting it.
212+
+
213+
We will evaluate the impact on downstream distributions before making Rust
214+
mandatory in Git 3.0. If we see that the impact on downstream distributions
215+
would be significant, we may decide to defer this change to a subsequent minor
216+
release. This evaluation will also take into account our own experience with
217+
how painful it is to keep Rust an optional component.
218+
174219
=== Removals
175220

176221
* Support for grafting commits has long been superseded by git-replace(1).

0 commit comments

Comments
 (0)