.forgejo: initial ci

This commit is contained in:
Antoine Martin 2024-08-12 02:04:32 -04:00
commit 5652fa5cc4
Signed by: forge
GPG key ID: D62A472A4AA7D541
2 changed files with 119 additions and 0 deletions

View file

@ -0,0 +1,81 @@
on:
workflow_dispatch:
inputs:
ref_name:
description: 'Tag or commit'
required: true
type: string
jobs:
cabal-config-edge:
name: Generate cabal config for edge
runs-on: x86_64
container:
image: alpine:edge
env:
CI_PROJECT_NAME: git-annex
CI_ALPINE_TARGET_RELEASE: edge
steps:
- name: Environment setup
run: apk add nodejs git cabal patch
- name: Repo pull
uses: actions/checkout@v4
with:
fetch-depth: 500
ref: ${{ inputs.ref_name }}
- name: Config generation
run: |
wget 'https://lab.ilot.io/mirrors/git-annex/-/raw/gitlab-ci/ghc-9.8.patch'
patch -p1 -i ghc-9.8.patch
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"
mv cabal.project.freeze git-annex-${{ input.ref_name }}-$CI_ALPINE_TARGET_RELEASE.config
- name: Package upload
uses: forgejo/upload-artifact@v3
with:
name: cabal-config-${{ input.ref_name }}
path: git-annex${{ input.ref_name }}*
cabal-config-v320:
name: Generate cabal config for edge
runs-on: x86_64
container:
image: alpine:
env:
CI_PROJECT_NAME: git-annex
CI_ALPINE_TARGET_RELEASE: v3.20
steps:
- name: Environment setup
run: apk add nodejs git cabal patch
- name: Repo pull
uses: actions/checkout@v4
with:
fetch-depth: 500
ref: ${{ inputs.ref_name }}
- name: Config generation
run: |
wget 'https://lab.ilot.io/mirrors/git-annex/-/raw/gitlab-ci/ghc-9.8.patch'
patch -p1 -i ghc-9.8.patch
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"
mv cabal.project.freeze git-annex-${{ input.ref_name }}-$CI_ALPINE_TARGET_RELEASE.config
- name: Package upload
uses: forgejo/upload-artifact@v3
with:
name: cabal-config-${{ input.ref_name }}
path: git-annex${{ input.ref_name }}*
upload-tarball:
name: Upload to generic repo
runs-on: x86_64
needs: [build-tarball]
container:
image: alpine:3.20
steps:
- name: Environment setup
run: apk add nodejs curl findutils
- name: Package download
uses: forgejo/download-artifact@v3
- name: Package deployment
run: |
find .
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/git-annex-${{ inputs.ref_name }}.tar.gz ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/${{ inputs.ref_name }}/git-annex-${{ inputs.ref_name}}.tar.gz
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/git-annex-${{ inputs.ref_name }}.tar.gz.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/git-annex/${{ inputs.ref_name }}/git-annex-${{ inputs.ref_name}}.tar.gz.sha512sum

View file

@ -0,0 +1,38 @@
on:
workflow_dispatch:
schedule:
- cron: '@hourly'
push:
branches:
- 'master'
jobs:
mirror:
name: Pull from upstream
runs-on: x86_64
container:
image: 'docker.io/node:20-bookworm'
steps:
- name: git mirror branches {v*/,}master & tags
run: |
git init --bare .
git remote add origin https://git.joeyh.name/git/git-annex.git
git fetch origin refs/heads/master:refs/mirror/master
git ls-remote origin refs/heads/v*/master | while read sha full_ref ; do
ref=${full_ref#refs/heads/}
git fetch origin $full_ref:refs/mirror/$ref
tag=${ref%/master}
git fetch origin refs/tags/${tag}*:refs/mirror-tags/${tag}*
done
if test "${{ vars.TEST }}" != true ; then
token=${{ secrets.CODE_FORGEJO_TOKEN }}
destination=${{ vars.DESTINATION }}
owner=${{ vars.OWNER }}
else
token=${{ secrets.TEST_FORGEJO_TOKEN }}
destination=${{ vars.TEST_DESTINATION }}
owner=${{ vars.TEST_OWNER }}
fi
git push --force https://any:$token@$destination/$owner/git-annex refs/mirror/*:refs/heads/* refs/mirror-tags/*:refs/tags/* --tags