Skip to content

Commit

Permalink
update build-release-stable.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriWahl committed May 4, 2024
1 parent bafe23f commit 3716c6f
Showing 1 changed file with 108 additions and 36 deletions.
144 changes: 108 additions & 36 deletions .github/workflows/build-release-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ env:
repo_dir: nagstamon-jekyll/docs/repo
cr_image: ghcr.io/henriwahl/build-nagstamon
# to be increased if new updates of build images are necessary
cr_image_version: 3
cr_image_version: 4
# release type this file is used for
release: stable

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.9, 3.11]
python-version: [3.9, 3.11]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# somehow weird way to get the hash over the requirements to be aware if they changed
- id: requirements_hash
run: echo "HASH=$(md5sum build/requirements/linux.txt | cut -d\ -f1)" >> $GITHUB_OUTPUT
# docker login is needed for pushing the test image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -46,9 +47,9 @@ jobs:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -58,19 +59,20 @@ jobs:
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon -e DEB_BUILD_OPTIONS=nocheck ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: build/*.deb
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

fedora-37:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -80,19 +82,20 @@ jobs:
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

fedora-38:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -102,19 +105,20 @@ jobs:
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

fedora-39:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -124,19 +128,66 @@ jobs:
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

fedora-40:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

fedora-41:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# if image defined by variable cr_image_version is not pullable aka does not exist it will be created and pushed
- run: docker pull ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} || /usr/bin/docker build -t ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }} -f build/docker/Dockerfile-${{ github.job }} .
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

rhel-9:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# docker login is needed for pushing the build image
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -146,34 +197,36 @@ jobs:
- run: docker push ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
# building in precompiled image makes them way faster instead of creating the build environment every time from scratch
- run: /usr/bin/docker run -v ${{ github.workspace }}:/nagstamon ${{ env.cr_image }}-${{ github.job }}:${{ env.cr_image_version }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: build/*.rpm
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

macos:
runs-on: macos-12
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: pip3 install --no-warn-script-location -r build/requirements/macos.txt
- run: cd ${{ github.workspace }}/build; python3 build.py
env:
PYTHONPATH: ${{ github.workspace }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: build/*.dmg
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

windows-32:
# better depend on stable build image
runs-on: windows-2022
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_win_version }}
architecture: x86
Expand All @@ -187,21 +240,22 @@ jobs:
PYTHONPATH: ${{ github.workspace }}
WIN_SIGNING_CERT_BASE64: ${{ secrets.SIGNING_CERT_BASE64 }}
WIN_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: |
build/dist/*.zip
build/dist/*.exe
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

windows-64:
# better depend on stable build image
runs-on: windows-2022
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_win_version }}
architecture: x64
Expand All @@ -213,21 +267,22 @@ jobs:
PYTHONPATH: ${{ github.workspace }}
WIN_SIGNING_CERT_BASE64: ${{ secrets.SIGNING_CERT_BASE64 }}
WIN_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: |
build/dist/*.zip
build/dist/*.exe
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

windows-64-debug:
# better depend on stable build image
runs-on: windows-2022
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_win_version }}
architecture: x64
Expand All @@ -239,24 +294,29 @@ jobs:
PYTHONPATH: ${{ github.workspace }}
WIN_SIGNING_CERT_BASE64: ${{ secrets.SIGNING_CERT_BASE64 }}
WIN_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: |
build/dist/*.zip
retention-days: 1
if-no-files-found: error
name: ${{ github.job }}

# borrowed from dhcpy6d
repo-debian:
runs-on: ubuntu-latest
# try to avoid race condition and start uploading only after the last install package has been build
needs: [debian, fedora-37, fedora-38, fedora-39, rhel-9, macos, windows-32, windows-64, windows-64-debug]
needs: [debian, fedora-37, fedora-38, fedora-39, fedora-40, fedora-41, rhel-9, macos, windows-32, windows-64, windows-64-debug]
env:
family: debian
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# get binaries created by other jobs
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
pattern: 'debian*'
path: artifact
merge-multiple: true
# get secret signing key
- run: echo "${{ secrets.PACKAGE_SIGNING_KEY }}" > signing_key.asc
# organize SSH deploy key for nagstamon-jekyll repo
Expand Down Expand Up @@ -298,7 +358,11 @@ jobs:
cr_image_latest: 39
steps:
# get binaries created by other jobs
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
pattern: 'fedora*'
path: artifact
merge-multiple: true
# organize SSH deploy key for nagstamon-repo
- run: mkdir ~/.ssh
- run: echo "${{ secrets.NAGSTAMON_REPO_KEY_WEB }}" > ~/.ssh/id_ed25519
Expand Down Expand Up @@ -333,7 +397,11 @@ jobs:
version: 9
steps:
# get binaries created by other jobs
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
pattern: 'rhel*'
path: artifact
merge-multiple: true
# organize SSH deploy key for nagstamon-repo
- run: mkdir ~/.ssh
- run: echo "${{ secrets.NAGSTAMON_REPO_KEY_WEB }}" > ~/.ssh/id_ed25519
Expand Down Expand Up @@ -364,7 +432,11 @@ jobs:
runs-on: ubuntu-latest
needs: [repo-rpm-rhel]
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
pattern: '*'
path: artifact
merge-multiple: true
- run: cd artifact && md5sum *agstamon* > md5sums.txt
- run: cd artifact && sha256sum *agstamon* > sha256sums.txt
- uses: marvinpinto/action-automatic-releases@latest
Expand Down

0 comments on commit 3716c6f

Please sign in to comment.