+++ /dev/null
-name: Add binary to release
-description: Add cvc5 binary to the current release
-inputs:
- binary:
- description: file name of binary
- release-name:
- description: name of binary in release
- github-token:
- description: token to upload binary
-runs:
- using: composite
- steps:
- - name: Rename binaries for release
- shell: bash
- run: |
- cp ${{ inputs.binary }} ${{ inputs.release-name }}
-
- - name: Add binaries to release
- uses: softprops/action-gh-release@v1
- with:
- token: ${{ inputs.github-token }}
- files: ${{ inputs.release-name }}
--- /dev/null
+name: Store binary
+description: Store cvc5 binary to the latest tag or the current release
+inputs:
+ binary:
+ description: file name of binary
+ binary-name:
+ description: target name of binary
+ github-token:
+ description: token to upload binary
+runs:
+ using: composite
+ steps:
+ - name: Rename binary
+ shell: bash
+ run: |
+ cp ${{ inputs.binary }} ${{ inputs.binary-name }}
+
+ - name: install pyGithub
+ shell: bash
+ run: |
+ python3 -m pip install pyGithub
+
+ - name: store to latest
+ if: github.ref == 'refs/heads/master'
+ shell: 'python3 {0}'
+ env:
+ GITHUB_TOKEN: ${{ inputs.github-token }}
+ BINARY: ${{ inputs.binary-name }}
+ run: |
+ import datetime
+ import os
+ from github import Github
+
+ sha = os.getenv('GITHUB_SHA')
+
+ gh = Github(os.getenv('GITHUB_TOKEN'))
+ repo = gh.get_repo(os.getenv('GITHUB_REPOSITORY'))
+
+ try:
+ # update "latest" to current commit
+ repo.get_git_ref('tags/latest').edit(sha)
+ except:
+ print('tag `latest` does not exist.')
+ exit
+
+ try:
+ rel = repo.get_release('latest')
+ except:
+ print('New `latest` release')
+ rel = repo.create_git_release('latest', 'latest', 'Latest builds')
+
+ # generate new filename
+ binary = os.getenv('BINARY')
+ name,ext = os.path.splitext(binary)
+ curtime = repo.get_git_commit(sha).committer.date.strftime('%Y-%m-%d')
+ samedayprefix = '{}-{}-'.format(name, curtime)
+ filename = '{}-{}-{}{}'.format(name, curtime, sha[:7], ext)
+
+ # prune old commits
+ assets = list(rel.get_assets())
+ assets.sort(key=lambda x: x.created_at, reverse=True)
+
+ for cnt,asset in enumerate(assets):
+ delete = False
+ if cnt >= 30:
+ delete = True
+ if asset.name.startswith(samedayprefix):
+ delete = True
+ age = datetime.datetime.now() - asset.created_at
+ if age.days > 7:
+ delete = True
+ if delete:
+ asset.delete_asset()
+
+ # upload as asset with proper name
+ rel.upload_asset(binary, name=filename)
+
+ - name: store to release
+ if: startsWith(github.ref, 'refs/tags/')
+ shell: 'python3 {0}'
+ env:
+ GITHUB_TOKEN: ${{ inputs.github-token }}
+ BINARY: ${{ inputs.binary-name }}
+ run: |
+ import os
+ from github import Github
+
+ refname = os.getenv('GITHUB_REF_NAME')
+ gh = Github(os.getenv('GITHUB_TOKEN'))
+ repo = gh.get_repo(os.getenv('GITHUB_REPOSITORY'))
+ try:
+ rel = repo.get_release(refname)
+ except:
+ print("New release from " + refname)
+ ref = repo.get_git_ref('tags/' + refname)
+ commit = repo.get_git_commit(ref.object.sha)
+ rel = repo.create_git_release(refname, refname, commit.message)
+ rel.upload_asset(os.getenv('BINARY'))
+
python-bindings: true
build-documentation: true
check-examples: true
- store-to-release-name: cvc5-Linux
+ binary-name: cvc5-Linux
exclude_regress: 3-4
run_regression_args: --tester base --tester model --tester synth --tester abduct --tester dump
strip-bin: strip
python-bindings: true
check-examples: true
- store-to-release-name: cvc5-macOS
+ binary-name: cvc5-macOS
exclude_regress: 3-4
run_regression_args: --tester base --tester model --tester synth --tester abduct --tester dump
cache-key: productionwin64
strip-bin: x86_64-w64-mingw32-strip
windows-build: true
- store-to-release-name: cvc5-Win64.exe
+ binary-name: cvc5-Win64.exe
binary-ext: .exe
- name: ubuntu:production-clang
with:
build-dir: ${{ steps.configure-and-build.outputs.shared-build-dir }}
- - name: Add binary to release
- if: matrix.store-to-release-binary && startsWith(github.ref, 'refs/tags/')
- uses: ./.github/actions/add-to-release
+ - name: Add binary to latest and release
+ if: matrix.binary-name && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
+ uses: ./.github/actions/store-binary
with:
binary: ${{ steps.configure-and-build.outputs.static-build-dir }}/bin/cvc5${{ matrix.binary-ext }}
- release-name: ${{ matrix.store-to-release-name }}
+ binary-name: ${{ matrix.binary-name }}
github-token: ${{ secrets.GITHUB_TOKEN }}
-
update-pr:
runs-on: ubuntu-latest
if: github.repository == 'cvc5/cvc5' && github.event_name == 'push'