From f5b3334be591c8908ec0c50833fcad09b8935e02 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Mon, 7 Oct 2024 11:44:30 +0100 Subject: [PATCH] .github: Add workflows. --- .../workflows/create-quarterly-feature.yml | 57 +++++++ .github/workflows/rebase.yml | 139 ++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 .github/workflows/create-quarterly-feature.yml create mode 100644 .github/workflows/rebase.yml diff --git a/.github/workflows/create-quarterly-feature.yml b/.github/workflows/create-quarterly-feature.yml new file mode 100644 index 000000000000..bb5a6d71399c --- /dev/null +++ b/.github/workflows/create-quarterly-feature.yml @@ -0,0 +1,57 @@ +name: Create quarterly feature branches + +on: + workflow_dispatch: + inputs: + quarter: + description: 'Quarterly branch (e.g. 2025Q4)' + required: true + +permissions: + contents: write + +concurrency: + group: ${{ github.workflow }}-${{ inputs.quarter }} + cancel-in-progress: true + +jobs: + create-features: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + feature: + - macos + - miscfix + - pbulk + - pbulkmulti + - performance + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Configure github-actions bot + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Fetch NetBSD/pkgsrc.git + run: | + git remote add netbsd https://github.com/NetBSD/pkgsrc.git + git fetch netbsd + + - name: Create feature/${{ matrix.feature }}/${{ inputs.quarter }} + env: + QUARTER: ${{ inputs.quarter }} + run: | + git checkout -B feature/${{ matrix.feature }}/"$QUARTER" origin/feature/${{ matrix.feature }}/trunk + git rebase --committer-date-is-author-date --onto netbsd/pkgsrc-"$QUARTER" netbsd/trunk + + - name: Push feature/${{ matrix.feature }}/${{ inputs.quarter }} + env: + QUARTER: ${{ inputs.quarter }} + run: | + git push --force origin feature/${{ matrix.feature }}/"$QUARTER" diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 000000000000..acef28ce3d1a --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,139 @@ +name: Rebase branches against NetBSD + +on: + schedule: + - cron: "17 * * * *" + workflow_dispatch: + inputs: + illumos: + description: 'Rebase release/trunk branch' + type: boolean + default: false + macos: + description: 'Rebase release/macos branch' + type: boolean + default: false + +permissions: + contents: write + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + features: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + branch: + - feature/macos/trunk + - feature/miscfix/trunk + - feature/pbulk/trunk + - feature/pbulkmulti/trunk + - feature/performance/trunk + - trunk + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Configure github-actions bot + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Fetch NetBSD/pkgsrc.git + run: | + git remote add netbsd https://github.com/NetBSD/pkgsrc.git + git fetch netbsd + + - name: Rebase ${{ matrix.branch }} + run: | + git checkout ${{ matrix.branch }} + git rebase --committer-date-is-author-date netbsd/trunk + + - name: Push ${{ matrix.branch }} + run: | + git push --force origin ${{ matrix.branch }} + + illumos: + needs: features + if: ${{ github.event_name != 'workflow_dispatch' || inputs.illumos }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: true + + - name: Configure github-actions bot + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Rebase release/trunk + run: | + git checkout release/trunk + git submodule update --init --recursive + git submodule foreach ' + git fetch --all + main=$(git remote show origin | awk "/HEAD branch/ {print \$NF}") + git checkout $main + git pull + ' + git reset --hard origin/feature/miscfix/trunk + for feature in pbulk pbulkmulti performance; do + git merge --no-edit origin/feature/${feature}/trunk + done + git submodule add https://github.com/TritonDataCenter/pkgsrc-extra.git extra + git submodule add https://github.com/TritonDataCenter/pkgsrc-joyent.git joyent + git submodule add https://github.com/TritonDataCenter/pkgsrc-wip.git wip + git add .gitmodules + git commit -m "Add submodules." + if [ "$(git rev-parse HEAD^{tree})" = "$(git rev-parse origin/release/trunk^{tree})" ]; then + echo "No upstream changes, skipping push." + exit 0 + fi + git push --force origin release/trunk + + macos: + needs: features + if: ${{ github.event_name != 'workflow_dispatch' || inputs.macos }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: true + + - name: Configure github-actions bot + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Rebase release/macos + run: | + git checkout release/macos + git submodule update --init --recursive + git submodule foreach ' + git fetch --all + main=$(git remote show origin | awk "/HEAD branch/ {print \$NF}") + git checkout $main + git pull + ' + git reset --hard origin/feature/macos/trunk + git merge --no-edit origin/feature/performance/trunk + git submodule add https://github.com/TritonDataCenter/pkgsrc-extra.git extra + git add .gitmodules + git commit -m "Add submodules." + if [ "$(git rev-parse HEAD^{tree})" = "$(git rev-parse origin/release/macos^{tree})" ]; then + echo "No upstream changes, skipping push." + exit 0 + fi + git push --force origin release/macos