Enhance 'make dist', add GitHub release workflow #17
Workflow file for this run
This file contains 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
# This workflow takes care of creating release archives for the | |
# Flint distribution. It is run for all PR and branch pushes as usual, | |
# but also on tags whose name starts with `vX.Y` with X, Y numbers | |
# (the idea is to use v1.2.3 or v1.2.3-beta3) | |
# | |
# For builds triggered by a tag, the tag is turned into a GitHub release and | |
# the produced archives are attached to that. | |
name: "Wrap releases" | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- v[1-9]+.[0-9]+.[0-9] # allow v1.2.3 | |
- v[1-9]+.[0-9]+.[0-9]-* # allow v1.2.3-beta3 etc. | |
branches: | |
- trunk | |
- flint-* | |
schedule: | |
# Every day at 3:33 AM UTC | |
- cron: '33 3 * * *' | |
concurrency: | |
# group by workflow and ref; the last slightly strange component ensures that for pull | |
# requests, we limit to 1 concurrent job, but for the trunk branch we don't | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/trunk' || github.run_number }} | |
# Cancel intermediate builds, but only if it is a pull request build. | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
jobs: | |
make-archive: | |
runs-on: ubuntu-latest | |
outputs: | |
get-version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup" | |
run: | | |
sudo apt install -y libgmp-dev | |
sudo apt install -y libmpfr-dev | |
sudo apt install -y autoconf | |
sudo apt install -y libtool-bin | |
gcc --version | |
gcov --version | |
make --version | |
autoconf --version | |
libtool --version | |
# special treatment for tags: these are used for actual releases, | |
# so enforce that the version in configure.ac and in the tag match | |
- name: "Patch configure.ac" | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
run: | | |
dev/patch_version.sh ${GITHUB_REF#refs/tags/} | |
- name: "Configure" | |
run: | | |
./bootstrap.sh | |
./configure | |
- name: "Record FLINT version" | |
id: get-version | |
run: | | |
FLINT_VERSION=$(make get_version) | |
echo "steps.get-version.outputs.version = ${FLINT_VERSION}" | |
echo "version=${FLINT_VERSION}" >> $GITHUB_OUTPUT | |
- name: "Create source archive" | |
run: make dist | |
- name: "Upload source archive as artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: flint | |
path: flint-${{ steps.get-version.outputs.version }}.tar.gz | |
retention-days: 1 | |
# test-archive: | |
# needs: make-archive | |
# runs-on: ubuntu-latest | |
# env: | |
# FLINT_VERSION: ${{ needs.make-archive.outputs.get-version }} | |
# MAKE: "make -j --output-sync=target" | |
# TESTCFLAGS: "-Wall -O1" | |
# steps: | |
# - name: "Download archive from previous job" | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: flint | |
# | |
# - name: "Setup" | |
# run: | | |
# sudo apt install -y libgmp-dev | |
# sudo apt install -y libmpfr-dev | |
# # now *remove* autotools to verify we can build with out it | |
# sudo apt remove -y autoconf | |
# sudo apt remove -y automake | |
# sudo apt remove -y libtool-bin | |
# | |
# - name: "Extract" | |
# run: | | |
# tar -xf flint-$FLINT_VERSION.tar.gz | |
# mv flint-$FLINT_VERSION flint # to simplify code | |
# | |
# - name: "Configure" | |
# run: | | |
# cd flint | |
# # *no* call to bootstrap.sh ! | |
# ./configure | |
# | |
# - name: "Compile library" | |
# run: | | |
# cd flint | |
# $MAKE | |
# ldd libflint.so | |
# | |
# - name: "Compile tests" | |
# run: | | |
# cd flint | |
# export FLINT_TEST_MULTIPLIER=0.1 | |
# $MAKE tests | |
# | |
# - name: "Check" | |
# run: | | |
# cd flint | |
# export FLINT_TEST_MULTIPLIER=0.1 | |
# $MAKE check | |
upload-archive: | |
needs: make-archive | |
# needs: test-archive | |
# needs: [make-archive, test-archive] | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
#env: | |
# FLINT_VERSION: ${{ needs.make-archive.outputs.get-version }} | |
steps: | |
- name: "Download archive from previous job" | |
uses: actions/download-artifact@v3 | |
with: | |
name: flint | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: flint-${{ steps.get-version.outputs.version }}.tar.gz | |
# TODO: also trigger a documentation build and upload the result? | |
# TODO: if desired, we could e.g. also upload the archive to a server via scp |