From 53cc322b93cbbf7daf177cbad0ebcaa27535eeab Mon Sep 17 00:00:00 2001 From: madomado Date: Thu, 16 Mar 2023 23:48:57 +0800 Subject: [PATCH] feat(ci): improve workflows (#279) * feat(ci): improve workflows * feat(ci): improve workflows * fix(ci): mass-rebuild.yml * fix(ci): rename mass-rebuild-recurse.yml --- .github/workflows/autobuild.yml | 23 ------- .github/workflows/bootstrap-anda.yml | 54 ----------------- .github/workflows/bootstrap-f38.yml | 57 ------------------ .github/workflows/bootstrap-subatomic.yml | 58 ------------------ .github/workflows/bootstrap.yml | 13 +--- .github/workflows/build.yml | 2 +- .github/workflows/mass-rebuild.yml | 73 ----------------------- .github/workflows/update-comps.yml | 1 + .github/workflows/update-nightly.yml | 14 ++++- .github/workflows/update.yml | 17 ++++-- 10 files changed, 27 insertions(+), 285 deletions(-) delete mode 100644 .github/workflows/bootstrap-anda.yml delete mode 100644 .github/workflows/bootstrap-f38.yml delete mode 100644 .github/workflows/bootstrap-subatomic.yml delete mode 100644 .github/workflows/mass-rebuild.yml diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 37c9d7ee75..e992fd88a1 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -19,7 +19,6 @@ jobs: container: image: ghcr.io/terrapkg/builder:main options: --cap-add=SYS_ADMIN --privileged - # check out the repo steps: - name: Set workspace as safe run: git config --global --add safe.directory "$GITHUB_WORKSPACE" @@ -28,27 +27,6 @@ jobs: with: fetch-depth: 2 - run: git pull - #- run: git checkout HEAD^ - - # - name: Generate Build matrix - # id: generate_build_matrix - # # generate build matrix by checking out changes in anda/ - # run: | - # # get the list of changed folders in the current commit, including subfolders - # changed_folders=$(git diff --name-only HEAD^ | grep -oP 'anda\/(.+)(\/|\$)' | sort -u ) - # echo "Changed folders: $changed_folders" - # # if changed_folders is empty then set is empty to true - # if [ -z "$changed_folders" ]; then - # echo "::set-output name=is_empty::true" - # else - # echo "::set-output name=is_empty::false" - # fi - # # turn it into a json array - # build_matrix=$(echo "$changed_folders" | jq -R . | jq -s . | jq -c .) - - # echo "::set-output name=build_matrix::$build_matrix" - # #echo "::set-output name=build_matrix::$build_matrix" - - name: Generate build matrix id: generate_build_matrix run: | @@ -60,7 +38,6 @@ jobs: pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }} version: ["37"] fail-fast: false - #if: ${{ matrix.changed_folders != '' }} runs-on: ${{ matrix.pkg.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} container: image: ghcr.io/terrapkg/builder:main diff --git a/.github/workflows/bootstrap-anda.yml b/.github/workflows/bootstrap-anda.yml deleted file mode 100644 index f334dab9ad..0000000000 --- a/.github/workflows/bootstrap-anda.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Bootstrap anda - -on: - workflow_dispatch: - -jobs: - bootstrap: - strategy: - matrix: - version: ["37"] - arch: ["x86_64", "aarch64"] - fail-fast: true - runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} - container: - image: fedora:37 - options: --cap-add=SYS_ADMIN --privileged - steps: - - uses: actions/checkout@v3 - with: - repository: FyraLabs/anda - - # - name: Run shell commands - # run: | - # git config --global url.https://github.com/.insteadOf git://github.com/ - # git clone https://github.com/FyraLabs/anda.git - - uses: actions/setup-go@v3 - with: - go-version: "^1.19" - - - name: Install repositories - run: | - sudo dnf install -y dnf-plugins-core - sudo dnf config-manager --add-repo https://github.com/terrapkg/subatomic-repos/raw/main/terra${{ matrix.version }}.repo - - run: sudo dnf install -y mock createrepo_c rpm-build anda-mock-configs gcc curl wget git-core openssl-devel - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Install Anda - uses: actions-rs/cargo@v1 - with: - command: install - args: anda - - - name: Install Subatomic - run: go install github.com/FyraLabs/subatomic/subatomic-cli@latest - - - name: Build - run: anda build -c anda-37-${{ matrix.arch }} anda -p rpm - - - run: | - subatomic-cli upload --prune \ - --server https://subatomic.fyralabs.com \ - --token ${{ secrets.SUBATOMIC_TOKEN }} \ - terra${{ matrix.version }} anda-build/rpm/rpms/* diff --git a/.github/workflows/bootstrap-f38.yml b/.github/workflows/bootstrap-f38.yml deleted file mode 100644 index ad7bf33383..0000000000 --- a/.github/workflows/bootstrap-f38.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Bootstrap Andaman and Subatomic (Fedora 38) - -on: - workflow_dispatch: - -jobs: - bootstrap: - strategy: - matrix: - version: ["38"] - arch: ["x86_64", "aarch64"] - fail-fast: true - runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} - container: - image: fedora:38 - options: --cap-add=SYS_ADMIN --privileged - steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.19" - - - name: Install repositories - run: | - sudo dnf install -y dnf-plugins-core - sudo dnf config-manager --add-repo https://github.com/terrapkg/subatomic-repos/raw/main/terra${{ matrix.version }}.repo - sudo dnf install -y mock createrepo_c rpm-build anda-mock-configs gcc curl wget git-core openssl-devel - - uses: actions/checkout@v3 - with: - repository: FyraLabs/subatomic - ref: bootstrap - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Install Anda - uses: actions-rs/cargo@v1 - with: - command: install - args: anda - - - name: Build Subatomic - run: anda build -c anda-38-${{ matrix.arch }} subatomic -p rpm - - name: Install Subatomic - run: sudo dnf install -y ./anda-build/rpm/rpms/subatomic-*.rpm - - - uses: actions/checkout@v3 - with: - repository: FyraLabs/anda - - - name: Build Andaman - run: anda build -c anda-38-${{ matrix.arch }} anda -p rpm - - - name: Upload to Subatomic - run: | - subatomic-cli upload --prune \ - --server https://subatomic.fyralabs.com \ - --token ${{ secrets.SUBATOMIC_TOKEN }} \ - terra${{ matrix.version }} anda-build/rpm/rpms/* diff --git a/.github/workflows/bootstrap-subatomic.yml b/.github/workflows/bootstrap-subatomic.yml deleted file mode 100644 index b56d3cbbe5..0000000000 --- a/.github/workflows/bootstrap-subatomic.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Bootstrap subatomic - -on: - workflow_dispatch: - -jobs: - bootstrap: - strategy: - matrix: - version: ["37"] - arch: ["x86_64", "aarch64"] - fail-fast: true - runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} - container: - image: fedora:37 - options: --cap-add=SYS_ADMIN --privileged - steps: - # - name: Run shell commands - # run: | - # git config --global url.https://github.com/.insteadOf git://github.com/ - # git clone https://github.com/FyraLabs/anda.git - - - uses: actions/setup-go@v3 - with: - go-version: "^1.19" - - - name: Install repositories - run: | - sudo dnf install -y dnf-plugins-core - sudo dnf config-manager --add-repo https://github.com/terrapkg/subatomic-repos/raw/main/terra${{ matrix.version }}.repo - - run: sudo dnf install -y mock createrepo_c rpm-build anda-mock-configs gcc curl wget git-core openssl-devel - - uses: actions/checkout@v3 - with: - repository: FyraLabs/subatomic - set-safe-directory: true - fetch-depth: 1 - - name: Set up git repository - run: | - git config --global --add safe.directory "$GITHUB_WORKSPACE" - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Install Anda - uses: actions-rs/cargo@v1 - with: - command: install - args: anda - - - name: Install Subatomic - run: go install github.com/FyraLabs/subatomic/subatomic-cli@latest - - - name: Build - run: anda build -c anda-37-${{ matrix.arch }} subatomic -p rpm - - run: | - subatomic-cli upload --prune \ - --server https://subatomic.fyralabs.com \ - --token ${{ secrets.SUBATOMIC_TOKEN }} \ - terra${{ matrix.version }} anda-build/rpm/rpms/* diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 4492d8d81c..de40fabbd8 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -1,4 +1,4 @@ -name: Bootstrap Andaman and Subatomic (Fedora 37) +name: Bootstrap Andaman and Subatomic on: workflow_dispatch: @@ -43,7 +43,7 @@ jobs: - name: Build Subatomic run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" - anda build -c anda-37-${{ matrix.arch }} subatomic -p rpm -D "autogitcommit $(git log -1 --format='%H')" + anda build -c anda-${{ matrix.version }}-${{ matrix.arch }} subatomic -p rpm -D "autogitcommit $(git log -1 --format='%H')" - name: Install Subatomic run: sudo dnf install -y ./anda-build/rpm/rpms/subatomic-*.rpm @@ -52,14 +52,7 @@ jobs: repository: FyraLabs/anda - name: Build Andaman - run: anda build -c anda-37-${{ matrix.arch }} anda -p rpm - - - name: Upload to Subatomic - run: | - subatomic-cli upload --prune \ - --server https://subatomic.fyralabs.com \ - --token ${{ secrets.SUBATOMIC_TOKEN }} \ - terra${{ matrix.version }} anda-build/rpm/rpms/* + run: anda build -c anda-${{ matrix.version }}-${{ matrix.arch }} anda -p rpm - name: Upload to Subatomic run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3c9b294e4..b364f03837 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: inputs: packages: - description: "Packages to Build (pkg-a, pkg-b, ...)" + description: "Packages to Build" required: true jobs: diff --git a/.github/workflows/mass-rebuild.yml b/.github/workflows/mass-rebuild.yml deleted file mode 100644 index 9bbabd2d4a..0000000000 --- a/.github/workflows/mass-rebuild.yml +++ /dev/null @@ -1,73 +0,0 @@ -# for each folder in anda/ -# generate a new workflow for each folder in anda/ -name: Mass Rebuild -on: - workflow_dispatch: - -jobs: - manifest: - runs-on: ubuntu-latest - - outputs: - build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }} - is_empty: ${{ steps.generate_build_matrix.outputs.is_empty }} - - # check out the repo - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - run: git fetch - #- run: git checkout HEAD^ - - - name: Generate Build matrix - id: generate_build_matrix - # generate build matrix by checking out changes in anda/ - run: | - build_matrix=$(find anda/ | grep -oP 'anda\/(.+)(\/|\$)' | sort -u | jq -R -s -c 'split("\n")[:-1]') - # create build matrix with { changed_folders: [ "folder1", "folder2" ] } - echo "build_matrix=$build_matrix" >> $GITHUB_OUTPUT - #echo "::set-output name=build_matrix::$build_matrix" - build: - needs: manifest - strategy: - matrix: - pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }} - version: ["37"] - arch: ["x86_64", "aarch64"] - fail-fast: false - #if: ${{ matrix.changed_folders != '' }} - runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }} - container: - image: ghcr.io/terrapkg/builder:main - options: --cap-add=SYS_ADMIN --privileged - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - name: Check file existence - id: check_files - run: | - if test -f "${{ matrix.pkg }}anda.hcl"; then - echo "EXISTS=true" >> $GITHUB_OUTPUT - else - echo "EXISTS=false" >> $GITHUB_OUTPUT - fi - - - uses: terrapkg/anda-build@main - if: steps.check_files.outputs.EXISTS == 'true' - with: - name: "${{ matrix.pkg }}pkg" - mockConfig: anda-37-${{ matrix.arch }} - extraArgs: -D "sccache_bucket ${{secrets.SCCACHE_BUCKET}}" -D "sccache_endpoint ${{secrets.SCCACHE_ENDPOINT}}" -D "sccache_secret ${{secrets.SCCACHE_SECRET}}" -D "sccache_accesskey ${{secrets.SCCACHE_ACCESSKEY}}" - andaRepo: https://github.com/terrapkg/subatomic-repos/raw/main/terra.repo - - - name: Upload packages to subatomic - if: steps.check_files.outputs.EXISTS == 'true' - run: | - subatomic-cli upload --prune \ - --server https://subatomic.fyralabs.com \ - --token ${{ secrets.SUBATOMIC_TOKEN }} \ - terra${{ matrix.version }} anda-build/rpm/rpms/* diff --git a/.github/workflows/update-comps.yml b/.github/workflows/update-comps.yml index 971980cbb5..9301f64676 100644 --- a/.github/workflows/update-comps.yml +++ b/.github/workflows/update-comps.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - f38 paths: - comps.xml workflow_dispatch: diff --git a/.github/workflows/update-nightly.yml b/.github/workflows/update-nightly.yml index 7ea12b2694..307869ae1b 100644 --- a/.github/workflows/update-nightly.yml +++ b/.github/workflows/update-nightly.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 ssh-key: ${{ secrets.SSH_AUTHENTICATION_KEY }} - name: Install SSH signing key @@ -36,6 +36,14 @@ jobs: git config user.email "raboneko@fyralabs.com" git config gpg.format "ssh" git config user.signingkey "${{ runner.temp }}/signing_key" - git commit -S -a -m "Automatic Update: $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" - git push -u origin main + msg="bump(nightly): $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" + git commit -S -a -m "$msg" + git format-patch HEAD^ + git checkout f38 + for file in *.patch; do + git apply $file || true + done + rm *.patch + git commit -S -a -m "$msg" + git push -u origin --all fi diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index e55d3d66da..564ea80e66 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -1,6 +1,3 @@ -# for each folder in ultramarine/ -# if there is chkupdate.py -# run it every 2 hours name: Automatically check for updates on: schedule: @@ -17,7 +14,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 ssh-key: ${{ secrets.SSH_AUTHENTICATION_KEY }} - name: Install SSH signing key @@ -40,6 +37,14 @@ jobs: git config user.email "raboneko@fyralabs.com" git config gpg.format "ssh" git config user.signingkey "${{ runner.temp }}/signing_key" - git commit -S -a -m "Automatic Update: $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" - git push -u origin main + msg="bump: $(git status | grep modified | sed -r 's@.+/([^/]+)/[^/]+\n?@\1 @g' | tr -d '\n')" + git commit -S -a -m "$msg" + git format-patch HEAD^ + git checkout f38 + for file in *.patch; do + git apply $file || true + done + rm *.patch + git commit -S -a -m "$msg" + git push -u origin --all fi