Files
packages/.github/workflows/autobuild.yml
T
2022-10-23 03:06:33 -07:00

96 lines
3.6 KiB
YAML

# for each folder in anda/
# generate a new workflow for each folder in anda/
name: Automatically build packages
on:
push:
paths:
- anda/**
branches:
- main
workflow_dispatch:
workflow_call:
jobs:
manifest:
runs-on: ubuntu-latest
outputs:
build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }}
container:
image: registry.fedoraproject.org/fedora:37
options: --cap-add=SYS_ADMIN --privileged
# check out the repo
steps:
- name: Set up dependencies
run: |
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://github.com/terrapkg/subatomic-repos/raw/main/terra37.repo
sudo dnf install -y anda mock rpm-build git-core
# add to safe directory
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- 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: |
# # 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: |
anda ci >> $GITHUB_OUTPUT
build:
needs: manifest
strategy:
matrix:
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: registry.fedoraproject.org/fedora:37
options: --cap-add=SYS_ADMIN --privileged
steps:
- 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 anda-mock-configs subatomic-cli anda mock rpm-build mock-scm
- uses: terrapkg/anda-build@main
with:
name: "${{ matrix.pkg.pkg }}"
mockConfig: anda-${{ matrix.version }}-${{ matrix.pkg.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${{ matrix.version }}.repo
- name: Install Subatomic client
run: sudo dnf install -y subatomic-cli
- name: Upload packages to subatomic
run: |
subatomic-cli upload --prune \
--server https://subatomic.fyralabs.com \
--token ${{ secrets.SUBATOMIC_TOKEN }} \
terra${{ matrix.version }} anda-build/rpm/rpms/*