Generate lockfile automatically on new tag

This commit is contained in:
Antoine Martin 2024-09-09 19:24:23 -04:00
parent a5268f5c32
commit 020a43fd90
Signed by: forge
GPG key ID: D62A472A4AA7D541
3 changed files with 76 additions and 44 deletions

View file

@ -0,0 +1,18 @@
Support ghc-9.8 by widening a lot of constraints.
This patch can be removed once upstream supports ghc 9.8 offically.
diff -uprN git-annex-10.20240227.orig/cabal.project git-annex-10.20240227/cabal.project
--- git-annex-10.20240227.orig/cabal.project 1970-01-01 01:00:00.000000000 +0100
+++ git-annex-10.20240227/cabal.project 2024-04-28 13:30:14.061706299 +0200
@@ -0,0 +1,10 @@
+packages: *.cabal
+
+allow-newer: dav
+allow-newer: haskeline:filepath
+allow-newer: haskeline:directory
+allow-newer: xml-hamlet
+allow-newer: aws:filepath
+allow-newer: dbus:network
+allow-newer: dbus:filepath
+allow-newer: microstache:filepath

View file

@ -6,6 +6,10 @@ on:
required: true required: true
type: string type: string
push:
tags:
- '*'
jobs: jobs:
cabal-config-edge: cabal-config-edge:
name: Generate cabal config for edge name: Generate cabal config for edge
@ -13,58 +17,52 @@ jobs:
container: container:
image: alpine:edge image: alpine:edge
env: env:
CI_PROJECT_NAME: git-annex
CI_ALPINE_TARGET_RELEASE: edge CI_ALPINE_TARGET_RELEASE: edge
steps: steps:
- name: Environment setup - name: Environment setup
run: apk add nodejs git cabal patch wget run: apk add nodejs git cabal patch
- name: Repo pull - name: Repo pull
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 500 fetch-depth: 1
ref: ${{ inputs.ref_name }} ref: ${{ inputs.ref_name }}
- name: Config generation - name: Config generation
run: | run: |
wget 'https://lab.ilot.io/mirrors/git-annex/-/raw/gitlab-ci/ghc-9.8.patch' patch -p1 -i .forgejo/patches/ghc-9.8.patch
patch -p1 -i ghc-9.8.patch
HOME="${{ github.workspace}}"/cabal_cache cabal update HOME="${{ github.workspace}}"/cabal_cache cabal update
HOME="${{ github.workspace}}"/cabal_cache cabal v2-freeze --shadow-installed-packages --strong-flags --flags="+assistant +webapp +pairing +production +torrentparser +magicmime +benchmark -debuglocks +dbus +networkbsd +gitlfs +httpclientrestricted" HOME="${{ github.workspace}}"/cabal_cache cabal v2-freeze --shadow-installed-packages --strong-flags --flags="+assistant +webapp +pairing +production +torrentparser +magicmime +benchmark -debuglocks +dbus +networkbsd +gitlfs +httpclientrestricted"
find . mv cabal.project.freeze git-annex.config
mv cabal.project.freeze git-annex-${{ input.ref_name }}-$CI_ALPINE_TARGET_RELEASE.config
- name: Package upload - name: Package upload
uses: forgejo/upload-artifact@v3 uses: forgejo/upload-artifact@v3
with: with:
name: cabalconfigedge name: cabalconfigedge
path: git-annex* path: git-annex*.config
cabal-config-v320: cabal-config-v320:
name: Generate cabal config for edge name: Generate cabal config for edge
runs-on: x86_64 runs-on: x86_64
container: container:
image: alpine:3.20 image: alpine:3.20
env: env:
CI_PROJECT_NAME: git-annex
CI_ALPINE_TARGET_RELEASE: v3.20 CI_ALPINE_TARGET_RELEASE: v3.20
steps: steps:
- name: Environment setup - name: Environment setup
run: apk add nodejs git cabal patch wget run: apk add nodejs git cabal patch
- name: Repo pull - name: Repo pull
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 500 fetch-depth: 1
ref: ${{ inputs.ref_name }} ref: ${{ inputs.ref_name }}
- name: Config generation - name: Config generation
run: | run: |
wget 'https://lab.ilot.io/mirrors/git-annex/-/raw/gitlab-ci/ghc-9.8.patch' patch -p1 -i .forgejo/patches/ghc-9.8.patch
patch -p1 -i ghc-9.8.patch
HOME="${{ github.workspace }}"/cabal_cache cabal update HOME="${{ github.workspace }}"/cabal_cache cabal update
HOME="${{ github.workspace }}"/cabal_cache cabal v2-freeze --shadow-installed-packages --strong-flags --flags="+assistant +webapp +pairing +production +torrentparser +magicmime +benchmark -debuglocks +dbus +networkbsd +gitlfs +httpclientrestricted" HOME="${{ github.workspace }}"/cabal_cache cabal v2-freeze --shadow-installed-packages --strong-flags --flags="+assistant +webapp +pairing +production +torrentparser +magicmime +benchmark -debuglocks +dbus +networkbsd +gitlfs +httpclientrestricted"
mv cabal.project.freeze git-annex-${{ input.ref_name }}-$CI_ALPINE_TARGET_RELEASE.config mv cabal.project.freeze git-annex.config
find .
- name: Package upload - name: Package upload
uses: forgejo/upload-artifact@v3 uses: forgejo/upload-artifact@v3
with: with:
name: cabalconfig320 name: cabalconfig320
path: git-annex* path: git-annex*.config
upload-tarball: upload-tarball:
name: Upload to generic repo name: Upload to generic repo
runs-on: x86_64 runs-on: x86_64
@ -78,6 +76,10 @@ jobs:
uses: forgejo/download-artifact@v3 uses: forgejo/download-artifact@v3
- name: Package deployment - name: Package deployment
run: | run: |
find . if test $GITHUB_REF_NAME == "ci" ; then
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./cabalconfigedge/git-annex.cabal ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/${{ inputs.ref_name }}/git-annex-${{ inputs.ref_name }}-edge.cabal CI_REF_NAME=${{ inputs.ref_name }}
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./cabalconfig320/git-annex.cabal ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/${{ inputs.ref_name }}/git-annex-${{ inputs.ref_name }}-v320.cabal else
CI_REF_NAME=$GITHUB_REF_NAME
fi
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./cabalconfigedge/git-annex.config ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/$CI_REF_NAME/git-annex-$CI_REF_NAME-edge.cabal
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./cabalconfig320/git-annex.config ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/$CI_REF_NAME/git-annex-$CI_REF_NAME-v320.cabal

View file

@ -4,35 +4,47 @@ on:
schedule: schedule:
- cron: '@hourly' - cron: '@hourly'
push:
branches:
- 'master'
jobs: jobs:
mirror: mirror:
name: Pull from upstream name: Pull from upstream
runs-on: x86_64 runs-on: x86_64
container: container:
image: 'docker.io/node:20-bookworm' image: alpine:latest
env:
upstream: https://git.joeyh.name/git/git-annex.git
tags: '10.2024*'
steps: steps:
- name: git mirror branches {v*/,}master & tags - name: Environment setup
run: apk add grep git sed coreutils bash nodejs
- name: Fetch destination
uses: actions/checkout@v4
with:
fetch_depth: 1
ref: ci
token: ${{ secrets.CODE_FORGEJO_TOKEN }}
- name: Missing tag detecting
run: | run: |
git init --bare . git ls-remote $upstream "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > upstream_tags
git remote add origin https://git.joeyh.name/git/git-annex.git git ls-remote ${{ github.server_url}}/${{ github.repository }} "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > destination_tags
git fetch origin refs/heads/master:refs/mirror/master cat upstream_tags destination_tags | tr ' ' '\n' | sort | uniq -u > missing_tags
git ls-remote origin refs/heads/v*/master | while read sha full_ref ; do echo "Missing tags:"
ref=${full_ref#refs/heads/} cat missing_tags
git fetch origin $full_ref:refs/mirror/$ref - name: Missing tag fetch
tag=${ref%/master} run: |
git fetch origin refs/tags/${tag}*:refs/mirror-tags/${tag}* git remote add upstream $upstream
done while read tag; do
if test "${{ vars.TEST }}" != true ; then git fetch upstream tag $tag --no-tags
token=${{ secrets.CODE_FORGEJO_TOKEN }} done < missing_tags
destination=${{ vars.DESTINATION }} - name: Packaging workflow injection
owner=${{ vars.OWNER }} run: |
else while read tag; do
token=${{ secrets.TEST_FORGEJO_TOKEN }} git checkout $tag
destination=${{ vars.TEST_DESTINATION }} git tag -d $tag
owner=${{ vars.TEST_OWNER }} git checkout ci -- ./.forgejo
fi git config user.name "forgejo-actions[bot]"
git push --force https://any:$token@$destination/$owner/git-annex refs/mirror/*:refs/heads/* refs/mirror-tags/*:refs/tags/* --tags git config user.email "dev@ayakael.net"
git commit -m 'Inject custom workflow'
git tag -a $tag -m $tag
done < missing_tags
- name: Push to destination
run: git push --force origin refs/tags/*:refs/tags/* --tags