Repository navigation
Take the free data files from the asset cache in every job, and run the download test once in its own job - #142
Closed
jwrosewell wants to merge 9 commits into
Closed
jwrosewell wants to merge 9 commits into
jwrosewell wants to merge 9 commits into
Conversation
…from nothing The mixed on-premise console example is run with both extensions loaded from a php.ini and no data file set for one engine or both, with the variables that name a data file left out, and must show both engines' results and end with Find out more (#105). The existing case with both data files set must not start PHP again. DownloadDataFileTests downloads the free ASN file with the examples' own code into a new folder holding a copy of the data repository's scripts and the file's link, and says plainly when the distributor refuses the file (#106).
ExampleUtils::startWithBothEngines runs the example again in a PHP started with a data file for each engine PHP did not build, the IP Intelligence one found by getDataFile and the Device Detection one by the new getDeviceDetectionDataFile, which takes the launcher's logic so that serve.php and the console example share one copy. An engine PHP built from php.ini is still used. A PHP started with a Device Detection data file it built no engine from stops with a message rather than starting again (#105).
…amples look ip-intelligence/ci/fetch-assets.ps1 also fetches the free ASN file, and links the cached Lite and ASN files into cxx/data/ip-intelligence under the data repository's names, as device-detection/onpremise/ci/fetch-assets.ps1 does for the Lite hash file, so the tests that run the examples with nothing set no longer download them from the distributor in every job. The root ci/fetch-assets.ps1 lists every asset the package scripts fetch, because common-ci keys the day's asset cache on that file's text alone (#106).
…to ci/free-files-from-cache
… it from the asset cache Each free data file sits in cxx/data as a .link file, and the packages' fetch-assets scripts link the run's cached copy beside it. After every package's unit and integration tests, ci/check-no-data-file-downloads.ps1 looks for a file beside a link that is not itself a link, which a test or an example downloaded during the job, and fails the job naming it.
DownloadDataFileTests downloads the free ASN file from the distributor with the examples' own code. It moves from the IP Intelligence Integration suite, which every job of the build matrix runs, to a Download suite that only the new Data file download workflow runs, once for each push.
Contributor
Author
|
Closed as superseded by #108, whose branch holds this draft's commits and whose body describes them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Superseded by #108. The review of #108 asked for the download test to leave the suite every job runs, so #108's branch was moved forward to this draft's head, dd6abbb, and #108 now holds these three commits and describes them. This draft is to be closed as superseded by #108.
Every job of the build matrix now takes the free data files from the run's asset cache, a check fails any job whose tests downloaded one, and the test of the download itself runs once, in a job of its own.
This branch holds the commits of #108 (merged in at a8da3e1 from its head 82f8c1f), because #108 adds the free ASN file to the cache and the download test this draft moves. So it merges after #108. Once #108 is on
rcand this branch has takenrc, the diff is the three commits under "What changed".The rule
James Rosewell set the rule at 22:23 UTC on 14 November 2026.
So in GitHub Actions a job takes the free data files (the Device Detection Lite hash file and the IP Intelligence Lite and ASN files) from the run's asset cache, as 51degrees-cxx#153 and 51degrees-go#113 do, and never downloads them in each job. A test of the download itself downloads once, in its own job.
Every place CI could download a free data file
Checked on
rcat b01029ae and on #108's head 82f8c1f0, against the download lines of full build 43564508164 of #91's head 6cea14f, whose eight jobs (Ubuntu PHP 7.4 to 8.5 and Windows PHP 8.3) all passed.prefetch_assetsaction runs the rootci/fetch-assets.ps1when it finds no cache for the day's key, and saves theassetsfolder. That is the one fetch the rule wants, and it is unchanged. In 43564508164 it found main's cache for the day (Cache hit for: 20261114-D08993235BC59D4245755D798844D1F982A792C9).nightly-pull-request.build-and-test.ps1line 49) after restoring the cache (nightly-pull-request.ymllines 159 to 165), and common-ci'ssteps/fetch-assets.ps1line 119 skips an asset the cache holds and downloads one it does not. In 43564508164 each job printedalready present in cache, skipping downloadfor every asset its packages list, so this step downloaded nothing.device-detection/onpremise/ci/fetch-assets.ps1line 19 links the cached Lite hash file intocxx/data/device-detection, where the tests and examples look.rc,ip-intelligence/ci/fetch-assets.ps1line 17 lists only the Lite file and links it intoip-intelligence/assets. Run the mixed console example with nothing set, and link every cached free data file where the examples look #108 adds the ASN file and links both free files intocxx/data/ip-intelligence(lines 25 to 30 and 53 to 66 at 82f8c1f0).ExamplesWithoutSettingsTests.phpline 49,IniSettingsTests.phpline 57,RequestTests.phpline 135 andStartWithoutDataFileTests.phpline 465 call the examples'ExampleUtils::downloadMissingDataFilefor the Lite file incxx/data/device-detection, and the examples run with nothing set reach it throughgetDataFile(lines 332 and 347). Each finds the linked file, and no job of 43564508164 printed a download line for it.ExamplesWithoutSettingsTests.phpline 214,IpIntelligenceOnPremiseTests.phpline 936,MixedExamplesTests.phplines 383 and 427,WebExamplesWithoutSettingsTests.phpline 101 and the launcher,serve.phpline 145, whichServeWebExamplesTests.phpruns, callExampleUtils::downloadMissingDataFile. They take the Lite file fromip-intelligence/assetsfirst, and the Device Detection Lite file fromcxx/data/device-detection. The ASN file was not cached, soExamplesWithoutSettingsTests.phpline 100 downloaded it in each of the six jobs that build the extensions (Ubuntu PHP 8.0 to 8.5), each printing51Degrees-IPIV4AsnIpiV41.ipi is missing, so it is being downloaded by runningandSaved ip-intelligence/51Degrees-IPIV4AsnIpiV41.ipi, 6 MB. That is #106, which Run the mixed console example with nothing set, and link every cached free data file where the examples look #108 fixes.DownloadDataFileTests.phpdownloads the ASN file from nothing on purpose, as a fresh clone does, and Run the mixed console example with nothing set, and link every cached free data file where the examples look #108 put it in the Integration suite (phpunit.xmlline 30 at 82f8c1f0), which every matrix job runs.Get-SkipReasoninci/packages.ps1), and neither printed a download line in 43564508164. Device Detection's performance test reads the TAC file and20000 User Agents.csvfrom the cachedassetsfolder (run-performance-tests.ps1lines 12 and 25).What changed
ci/check-no-data-file-downloads.ps1is new, andci/run-integration-tests.ps1runs it after every package's unit and integration tests. For each.linkfile incxx/data, it fails the job when the file beside the link exists and is not a symbolic link, because Fetch Assets links every cached file there and any other copy was downloaded during the job. It names the file in an error annotation and says to add its asset to the package'sci/fetch-assets.ps1. A test that downloads a free file in every job then fails the build rather than going unnoticed, as the ASN file did.DownloadDataFileTests.phpmoves from the IP Intelligence Integration suite to a new Download suite (ip-intelligence/phpunit.xmllines 31 to 36). common-ci'sphp/run-unit-tests.ps1andphp/run-integration-tests.ps1run only the Unit and Integration suites, so no matrix job runs it..github/workflows/data-file-download.ymlis new and runs the Download suite in one job, for pull requests and for pushes tomainandrc. It checks outcxxand itsdatasubmodule, writes the package's autoloader withcomposer dump-autoload --devwithout installing anything, and runs PHPUnit 9.6.34, which common-ci gives the matrix.The root
ci/fetch-assets.ps1is unchanged, so common-ci's asset cache key does not move. No environment variable name is added, read, renamed or removed.Runs
The red and green runs use a throwaway workflow with one job that does what a matrix job does, in the same order and through common-ci's
steps/run-script.ps1, with no secrets. It restores main's cache for 14 November (20261114-D08993235BC59D4245755D798844D1F982A792C9), then runs the rootfetch-assets,setup-environment,build-project,run-unit-testsandrun-integration-testsscripts on Ubuntu 24.04 with PHP 8.3.tmp/fixer-assets-redf614f72, which isrcb01029a with only the check (934908f, the same change as 7f8e8c8 here) and the throwaway workflow. Fetch Assets took every listed file from the cache. The IP Intelligence integration tests then printed51Degrees-IPIV4AsnIpiV41.ipi is missing, so it is being downloaded by running,Downloading ip-intelligence/51Degrees-IPIV4AsnIpiV41.ipiandSaved ip-intelligence/51Degrees-IPIV4AsnIpiV41.ipi, 6 MB, every suite passed, and the check failed the job withcxx/data/ip-intelligence/51Degrees-IPIV4AsnIpiV41.ipi was downloaded during this job. Add its asset to the package's ci/fetch-assets.ps1 and link the cached copy there, so that every job takes it from the run's asset cache.tmp/fixer-assets-green0c714b4, which is this branch at 461f1f0 with the throwaway workflow. 461f1f0 differs from the head only in the download workflow, which this job does not use. Fetch Assets took the five files the cache held, and because the cache had been filled before Run the mixed console example with nothing set, and link every cached free data file where the examples look #108 added the ASN file to the list, fetched that file itself (Fetching '51Degrees-IPIV4AsnIpiV41.ipi'andSaved ip-intelligence/51Degrees-IPIV4AsnIpiV41.ipi, 6.3 MB) and linked both free files (Linked '51Degrees-LiteIpiV41.ipi' into .../cxx/data/ip-intelligence as '51Degrees-LiteV41.ipi', and the same for the ASN file). No test printed a download line, every suite passed, and the check printedNo data file was downloaded during this job.tmp/fixer-assets-greenb53f862, whose workflow differs from the head's only in one comment and the throwaway branch in its triggers.OK (1 test, 5 assertions)with PHPUnit 9.6.34 on PHP 8.5.12. The test checks that the examples' code wrote51Degrees-IPIV4AsnIpiV41.ipi is missing, so it is being downloadedand that the file arrived. The first run of the workflow, 43649421675, failed withClass "fiftyone\pipeline\ipintelligence\examples\classes\ExampleConstants" not found, becausecomposer dump-autoloadwith no earlier install leaves out theautoload-devclasses, so the step now passes--dev.Overlap with other drafts
DownloadDataFileTests.phpentry, which git shows as unchanged.Invoke-PackageScriptcall inci/run-integration-tests.ps1, just above the lines this draft adds, so the second of the two to merge may need its lines put back together.ip-intelligence/phpunit.xml. A test file added to the Integration suite goes before the closing tag this draft adds.What remains
ci/fetch-assets.ps1only (action.ymlline 35, common-ci#329), so a cache filled from a list without the ASN file keeps being restored that day, and each job fetches the 6.3 MB file in its Fetch Assets step, as the green run did. When no pull request is ready to build, the nightly buildsrcitself (nightly-pull-requests.get-prs.ps1line 23 andsteps/get-target-branch.ps1line 24) and fills main's cache for the day fromrc's lists, as the nightly of 14 November did (run 43538727785, whose Configure for pull request 0 ran from 01:28 to 03:03 and saved the cache the runs above restored). So from the first nightly after Run the mixed console example with nothing set, and link every cached free data file where the examples look #108 reachesrc, the cache holds the ASN file and no job fetches it. Changing the root script instead would move the key, so a full build of any branch whose root script differs from the one the day's cache was filled from would miss that cache and fetch every data file again in Configure, the paid IP Intelligence file included, as Run the mixed console example with nothing set, and link every cached free data file where the examples look #108's full build 43579401232 did for 42 minutes.device-detection/onpremise/phpunit.xmland a second step of the new workflow.Build
The rule for CI-only drafts, from James Rosewell at 11:35 UTC on 12 November, is "rebuild and include, but the change doesn't impact the code so no need to run the full builds." It covers a draft that changes only CI scripts and their notes, which merges into
rcon green quick checks and an independent review.This draft's own three commits change CI scripts, a new workflow, the suite one test sits in, and AGENTS.md, with no package code and no test code. Until #108 is on
rc, the draft also carries #108's examples and tests, so the full build has not run yet. Once #108 is onrcand this branch has takenrc, the diff is CI-only and the rule above applies.The quick checks on head dd6abbb all passed.
OK (1 test, 5 assertions)with PHPUnit 9.6.34 on PHP 8.5.12. This is the new workflow on the head itself.