[squeak-dev] The Trunk: System-mt.1248.mcz
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Nov 22 10:26:06 UTC 2021
> The biggest issue is, though, that we have no simple way to get the DateAndTime of the latest build job. I have to parse the HTML page ... -.-"
Hmm, my strategy would have been to post this information as part of the GitHub workflow itself and post it, for instance, to a GitHub gist. I have applied this strategy for a custom badge in SqueakInboxTalk, see:
* https://github.com/hpi-swa-lab/squeak-inbox-talk/blob/3d3bc8834785da9a7fd877b92b762a3e67ee49b8/README.md?plain=1#L5
* https://gist.github.com/LinqLover/36dd3c4a155eed5aa7e874415cd60eea
* https://github.com/hpi-swa-lab/squeak-inbox-talk/blob/3d3bc8834785da9a7fd877b92b762a3e67ee49b8/packages/SqueakInboxTalkTests.package/TalkPipelineJobs.class/instance/testFlagsBadge.st
Then you would only need an API token to update the gist but you could access it anonymously in a structured format, and during the GitHub workflow, ${{ github.token }} is already available.
If you are interested in this kind of solution, I could update squeak-app and #ciStatusTimestamp accordingly. Should be not be overly complicated. :-)
Otherwise, should we at least honor Smalltalk isLowerPerformance before downloading the entire HTML page? :-)
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 22. November 2021 11:13 Uhr
An: squeak-dev
Betreff: Re: [squeak-dev] The Trunk: System-mt.1248.mcz
Yes. The biggest issue is, though, that we have no simple way to get the DateAndTime of the latest build job. I have to parse the HTML page ... -.-"
Setting up an account-specific API key seems not worth the effort for such a little piece of information.
In TravisCI, that info was free like the badge.
Best,
Marcel
Am 22.11.2021 11:08:09 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:
Ah. You did not use the badge URL from GitHub itself <https://github.com/squeak-smalltalk/squeak-app/actions/workflows/bundle.yml/badge.svg?branch=squeak-trunk> because they only offer SVGs as of today. Yeah, maybe we should have an SVG solution right in the Trunk at someday... :-)
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Montag, 22. November 2021 10:12:00
An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
Betreff: [squeak-dev] The Trunk: System-mt.1248.mcz
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1248.mcz
==================== Summary ====================
Name: System-mt.1248
Author: mt
Time: 22 November 2021, 10:11:55.950785 am
UUID: 26002484-3fff-e74e-8a15-9cf025fe7395
Ancestors: System-mt.1247
Fixes CI status in update dialog.
=============== Diff against System-mt.1247 ===============
Item was added:
+ ----- Method: SystemVersion>>ciBranch (in category 'continuous integration') -----
+ ciBranch
+ "Convert the receiver into the corresponding branch name on github.com/squeak-smalltalk/squeak-app."
+
+ | branch |
+ branch := 'squeak-{1}{2}{3}' format: {
+ self isRelease ifTrue: [self majorVersionNumber] ifFalse: [''].
+ self isRelease ifTrue: ['.'] ifFalse: ['trunk'].
+ self isRelease ifTrue: [self minorVersionNumber] ifFalse: [''] }.
+
+ ^ branch!
Item was changed:
----- Method: SystemVersion>>ciStatusBadgeUrl (in category 'continuous integration') -----
ciStatusBadgeUrl
+ "shields.io needs a workflow's descriptive name, not the name of the .yml file."
-
- | branch |
- branch := 'squeak-{1}{2}{3}' format: {
- self isRelease ifTrue: [self majorVersionNumber] ifFalse: [''].
- self isRelease ifTrue: ['.'] ifFalse: ['trunk'].
- self isRelease ifTrue: [self minorVersionNumber] ifFalse: [''] }.
+ ^ 'https://raster.shields.io/github/workflow/status/squeak-smalltalk/squeak-app/{1}/{2}?style=flat&logo=github'
+ format: {self ciWorkflowName encodeForHTTP. self ciBranch}!
- ^ 'https://api.travis-ci.com/squeak-smalltalk/squeak-app.png?branch=', branch!
Item was changed:
----- Method: SystemVersion>>ciStatusPageUrl (in category 'continuous integration') -----
ciStatusPageUrl
- "In a release image, let the user see the overview of branches to choose from. I am not aware of a permanent link for a specific branch. In a trunk image, just let Travis report the state of the main branch, which is usually for trunk builds."
+ ^ 'https://github.com/squeak-smalltalk/squeak-app/actions/workflows/{1}?query=branch%3A{2}+is%3Acompleted+event%3Aschedule'
+ format: {self ciWorkflow. self ciBranch}!
- ^ 'http://travis-ci.com/squeak-smalltalk/squeak-app{1}' format: {
- self isRelease ifFalse: [''] ifTrue: ['/branches'] }!
Item was changed:
----- Method: SystemVersion>>ciStatusTimestamp (in category 'continuous integration') -----
ciStatusTimestamp
+ "Slow. Fetch HTML page, extract first occurrence of
+ ... <time-ago datetime='2021-08-04T14:24:20Z' ... "
+ | statusPage begin end dateAndTime |
+ statusPage := (WebClient httpGet: self ciStatusPageUrl) content.
+ begin := statusPage findString: 'datetime' startingAt: 100000. "Skip the first X bytes decoration."
+ end := statusPage findString: 'Z' startingAt: begin.
+ dateAndTime := DateAndTime readFrom: (statusPage copyFrom: begin + 10 to: end) readStream.
- | stamp " 'Mon, 05 Jul 2021 17:52:11 GMT' " dateAndTime |
- stamp := (WebClient httpGet: self ciStatusBadgeUrl) headerAt: 'last-modified'.
- stamp ifEmpty: [^ stamp].
- dateAndTime := DateAndTime readFrom: (((stamp allButFirst: 4) allButLast: 4), ' Z') readStream.
^ String streamContents: [:s |
dateAndTime asDate = Date today
ifTrue: [s nextPutAll: 'Today' translated, ',']
ifFalse: [dateAndTime asDate = Date yesterday
ifTrue: [s nextPutAll: 'Yesterday' translated, ',']
ifFalse: [dateAndTime printYMDOn: s]].
s space.
dateAndTime printHMSOn: s]!
Item was added:
+ ----- Method: SystemVersion>>ciWorkflow (in category 'continuous integration') -----
+ ciWorkflow
+ "See https://github.com/squeak-smalltalk/squeak-app/tree/squeak-trunk/.github/workflows"
+
+ ^ 'bundle.yml'!
Item was added:
+ ----- Method: SystemVersion>>ciWorkflowName (in category 'continuous integration') -----
+ ciWorkflowName
+ "See 'name' in #ciWorkflow .yml file. Case sensitive."
+
+ ^ 'Bundle'!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211122/182964db/attachment.html>
More information about the Squeak-dev
mailing list
|