Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add packages lockfile #1875

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<LangVersion>12.0</LangVersion>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<Nullable>enable</Nullable>
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RunSettingsFilePath>$(MSBuildThisFileDirectory)\nunit.runsettings</RunSettingsFilePath>
<RuntimeIdentifiers>linux-x64;win-x64;osx-arm64</RuntimeIdentifiers>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
Expand Down
6 changes: 6 additions & 0 deletions bin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ def start_containers(
)
run(cmd)
raise

def is_ci() -> bool:
ci = os.environ.get("CI", None)
if ci is None:
return False
return ci == "1" or ci.lower() == "true"
15 changes: 15 additions & 0 deletions bin/smi/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,27 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
)
C.run(cmd)

# NOTE This isn't necessarily needed, but the lockfile processing isn't
# otherwise transparent in the build output
if C.is_ci():
cmd = (
"dotnet",
"restore",
"-warnaserror",
"--use-current-runtime",
"--nologo",
"--locked-mode",
"--force",
)
C.run(cmd)

cmd = (
"dotnet",
"build",
"-warnaserror",
"--use-current-runtime",
"--configuration", args.configuration,
"--no-restore" if C.is_ci() else "",
"--verbosity", "quiet",
"--nologo",
)
Expand Down
6 changes: 5 additions & 1 deletion bin/smi/buildTestPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def main() -> int:
return rc

# Package
rc = DP.main((*cfg_args, args.tag))
rc = DP.main((
*cfg_args,
"--no-build",
args.tag,
))

return rc

Expand Down
11 changes: 2 additions & 9 deletions bin/smi/writeDatabaseStrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
assert _TEST_DBS_TXT.is_file()


def _is_ci() -> bool:
ci = os.environ.get("CI", None)
if ci is None:
return False
return ci == "1" or ci.lower() == "true"


def main() -> int:

parser = argparse.ArgumentParser()
Expand All @@ -41,7 +34,7 @@ def main() -> int:
f.write(f"SqlServer: 'Server={args.mssql_server};User Id=sa;Password={args.db_password};TrustServerCertificate=true;'\n")

# NOTE(rkm 2022-02-27) We don't run MySQL in Windows in GitHub actions
if not (os.name == "nt" and _is_ci()):
if not (os.name == "nt" and C.is_ci()):
f.write(f"MySql: 'server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None'\n")

with open(_RELATIONAL_YAML) as f:
Expand All @@ -53,7 +46,7 @@ def main() -> int:
f.write("Prefix: TEST_\n")
f.write("Username: sa\n")
f.write(f"Password: {args.db_password}\n")
if not (os.name == "nt" and _is_ci()):
if not (os.name == "nt" and C.is_ci()):
f.write(f"MySql: server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None\n")

with open(_TEST_DBS_TXT) as f:
Expand Down
1 change: 1 addition & 0 deletions news/1875-meta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable Nuget packages restore with lockfile
Loading