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

Enhance 'make dist', add GitHub release workflow #1449

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

fingolfin
Copy link
Collaborator

Not much to see yet (too many interruptions) but I thought I should open a PR to make this visible. Next I'll improve make_dist.sh (see comments inside it for some things to be done). Then I'll start work on a GitHub workflow to run it.

I will probably have some questions on how things are done for tarballs. Some that come to mind right now:

  1. is there something that needs to be "built" for the documentation, and if so, how?
  2. do you usually include any of these built things inside the release tarball?
  3. are some built docs uploaded elsewhere separately (e.g. a PDF)
  4. are there other generated things (besides the build system and documentation) that I should remember to include in the release tarball?

bootstrap.sh Outdated Show resolved Hide resolved
dev/make_dist.sh Outdated Show resolved Hide resolved
@fingolfin fingolfin force-pushed the mh/dist branch 4 times, most recently from ffa8c4d to 6fd26d0 Compare October 9, 2023 20:09
@fingolfin fingolfin changed the title Start work on 'make dist' and GitHub workflow for releases Enhance 'make dist', add GitHub release workflow Oct 9, 2023
@fingolfin fingolfin marked this pull request as ready for review October 9, 2023 20:09
@fingolfin fingolfin marked this pull request as draft October 9, 2023 20:09
@fingolfin
Copy link
Collaborator Author

There is certainly a lot more to be done, but this is a first working version in so far as that the tarballs produced by make dist seem to work in tests. But since I have not year heard back about the documentation, I've also not made any efforts to include that...

Basically, someone (@fredrik-johansson ?) needs to tell me what else, if anything, should be added to the archive.

Also, which formats do you want (.tar.gz for sure; but something else? e.g. .zip, .tar.xz, .tar.zst, ... ?)

Lastly, this does not yet try to upload the generated tarballs anywhere, such as to a GitHub release. I can add something for that, but I need some more information on what is wanted. Perhaps we can briefly discuss it tomorrow.

@fingolfin
Copy link
Collaborator Author

I just realized I misunderstood @fredrik-johansson yesterday: I thought he was saying that FLINT already has the version in just one place. But that's wrong, it has it in multiple places. At least these:

  • configure.ac: variable FLINT_VERSION is 3.0.0-dev right now
  • configure.ac: variables FLINT_MAJOR + FLINT_MINOR + FLINT_PATCH
  • src/flint.h: has
    #define __FLINT_VERSION 3
    #define __FLINT_VERSION_MINOR 0
    #define __FLINT_VERSION_PATCHLEVEL 0
    #define FLINT_VERSION "3.0.0-dev"
    

That's all I am aware of right now. If you know more, please let me know.

I will unify this to a single one.

@fingolfin fingolfin force-pushed the mh/dist branch 2 times, most recently from 87b54fe to 299b3a8 Compare October 11, 2023 23:44
@fingolfin
Copy link
Collaborator Author

Done now. Example of a GitHub release created using this: https://github.com/fingolfin/flint/releases/tag/v6.2.3-dev. You can see the corresponding workflow at https://github.com/fingolfin/flint/actions/runs/6488873277.

Copy link
Contributor

@mezzarobba mezzarobba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autoconf/shell parts look good to me. I am not familiar with github workflows, so I can't really review that part.

dev/make_dist.sh Outdated Show resolved Hide resolved
dev/make_dist.sh Show resolved Hide resolved
dev/make_dist.sh Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
@fingolfin fingolfin force-pushed the mh/dist branch 3 times, most recently from 19d43f9 to 325ed22 Compare October 12, 2023 15:55
@albinahlback
Copy link
Collaborator

I'm not sure if it works, but I think it looks really good. I'd really like to see flint.h being configurable!

@albinahlback
Copy link
Collaborator

Do you mean you want it to generated from flint.h.in (which this PR does)?

Yes!

It offers some possibilities, but it also has a serious drawback in the current build system: one has to remember to edit flint.h.in, and then run ./config.status src/flint.h, otherwise it will keep using the old src/flint.h ... I have another PR in run to make it automate that, though, but I run into some bugs (?) with the build system... will open a PR and/or issue next.

Sounds good!

@fredrik-johansson
Copy link
Collaborator

If you tell me the formula... ?

Well, I think we could just do

FLINT_MAJOR_SO = FLINT_MAJOR + 15
FLINT_MINOR_SO = FLINT_MINOR
FLINT_PATCH_SO = FLINT_PATCH

but I have no idea how the minor version numbers are supposed to work for SO versioning.

@fingolfin
Copy link
Collaborator Author

FLINT_MAJOR_SO = FLINT_MAJOR + 15
FLINT_MINOR_SO = FLINT_MINOR
FLINT_PATCH_SO = FLINT_PATCH

But as I argued, that would be wrong in general... The rules for soname versioning are explained in configure.ac, right above the definition of FLINT_MINOR_SO etc.. I am happy to talk about this today.

But perhaps it would make sense to first merge this, and then apply further improvements in a new PR?

@fingolfin
Copy link
Collaborator Author

It fails with cygwin/MSVC/cmake. I tried to modify CMakeLists.txt but clearly what I did was not right or not enough.

One intermediate solution would be to revert flint.h to not be generated, and instead add a flint-version.h which is generated, and included by flint.h (and then of course also needs to be installed).

Will look into it later, now need to take some more exams...

CMakeLists.txt Outdated Show resolved Hide resolved
@fredrik-johansson
Copy link
Collaborator

I believe doc/source/conf.py needs to be updated to read VERSION.

@fingolfin
Copy link
Collaborator Author

Will update doc/source/conf.py. But that file is weird:

# The short X.Y version
version = u''


for _line in open("../../configure.ac").readlines():
    if _line.startswith("define(FLINT_VERSION,"):
        _i1 = _line.find('[')
        _i2 = _line.find(']', _i1 + 1)
        version = _line[_i1+1:_i2]

# The full version, including alpha/beta/rc tags
release = version

So the comments say release and version are different, but in practice they are defined to the same value... Is that intentional or just a bug?

@fredrik-johansson
Copy link
Collaborator

So the comments say release and version are different, but in practice they are defined to the same value... Is that intentional or just a bug?

I think it currently doesn't matter since the documentation isn't versioned.

@fingolfin fingolfin force-pushed the mh/dist branch 2 times, most recently from 4d7cecf to ea98611 Compare October 13, 2023 09:45

# The short X.Y version
version = '.'.join(release.split('.')[0:2])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to "fix" the computation of version in docs/source/conf.py, too. And release now uses the VERSION file as it should.

- a new file VERSION is the only place storing the FLINT version
- generate src/flint.h from src/flint.h.in so we can insert the version
- revise `make dist` to call a helper script `dev/make_dist.sh`, which
  creates all relevant archives, which include files generated by autoconf
- add GitHub Workflows to tests creation and usability of these archives
  on various conditions
@fingolfin
Copy link
Collaborator Author

The problem on Cygwin seems to be caused by VERSION having a trailing newline, which then is converted to "CRLF" on Windows... For now I "solved" this by removing this newline. The dev/make_dist.sh script also now uses printf instead of echo to ensure it keeps that way.

If desired I could also make a modification which makes configure.ac more robust against that, but perhaps it can wait for a follow-up PR so that @fredrik-johansson does not have to wait even longer.

@fredrik-johansson
Copy link
Collaborator

All green; I will take it :-)

@fredrik-johansson fredrik-johansson merged commit dc6bf00 into flintlib:trunk Oct 13, 2023
13 checks passed
@albinahlback
Copy link
Collaborator

FLINT v3, let's go!

@fingolfin fingolfin deleted the mh/dist branch October 13, 2023 14:57
@fingolfin
Copy link
Collaborator Author

🏎️

@edgarcosta
Copy link
Member

FLINT_MAJOR_SO = FLINT_MAJOR + 15
FLINT_MINOR_SO = FLINT_MINOR
FLINT_PATCH_SO = FLINT_PATCH

But as I argued, that would be wrong in general... The rules for soname versioning are explained in configure.ac, right above the definition of FLINT_MINOR_SO etc.. I am happy to talk about this today.

But perhaps it would make sense to first merge this, and then apply further improvements in a new PR?

What is the the historical reason for the + 15?

@fredrik-johansson
Copy link
Collaborator

I have tried to make a v3.0.0-rc1 on the flint-3.0 branch, but on that branch Cygwin CI is still failing with:

checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/cygdrive/d/a/flint/flint':
configure: error: C compiler cannot create executables
See `config.log' for more details
Error: Process completed with exit code 77.

@fredrik-johansson
Copy link
Collaborator

Obviously, I failed to remove the newline. Well, this isn't very convenient.

@fingolfin
Copy link
Collaborator Author

You should not have modified the VERSION file in the first place, though, just create the tag and it'll do that for you

@fredrik-johansson
Copy link
Collaborator

fredrik-johansson commented Oct 13, 2023

OK. I tried to tag again and this time Cygwin passes configure. However, the release workflow isn't being run for some reason.

Edit: now it is.

I think I'm having an aneurysm doing this on train wifi.

@fredrik-johansson
Copy link
Collaborator

There is now a 3.0.0-rc1 release which may or may not be correct. You're welcome to test it.

@fingolfin
Copy link
Collaborator Author

hmm? https://github.com/flintlib/flint/actions Shows it did run?

@fredrik-johansson
Copy link
Collaborator

Yes indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants