Skip to content

Commit

Permalink
Automated Packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
aazam-gh committed Aug 22, 2024
0 parents commit 215b358
Show file tree
Hide file tree
Showing 44 changed files with 1,662 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/buildzthin_deb_tar
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
# Copyright 2017 IBM Corp.
# Copyright 2024 Contributors to the Open Mainframe Project.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#------------------------------------------------------------------------------

# build scripts for zthin ubuntu

REPO=https://github.com/openmainframeproject/feilong
REPOTOP=feilong
ZTHIN=zthin-parts

git clone $REPO
cd $REPOTOP/$ZTHIN

mkdir -p debian

# Copy files with error handling
echo "Attempting to copy zvmsdklogs to $REPOTOP:"
cp ../../zthinlogs . || { echo "Failed to copy zvmsdklogs"; exit 1; }
cp -r ../../zthindeb/* debian/ || { echo "Failed to copy files to debian directory"; exit 1; }

# start the real debian build
dpkg-buildpackage -S
33 changes: 33 additions & 0 deletions .github/buildzthin_tar
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
# Copyright 2017 IBM Corp.
# Copyright 2024 Contributors to the Open Mainframe Project.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#------------------------------------------------------------------------------

REPO=https://github.com/openmainframeproject/feilong
REPOTOP=feilong
ZTHINTOP=zthin-parts

# Clone the repository
git clone $REPO
# Change to the cloned directory
cd $REPOTOP

# Copy files to the build directory with error handling
echo "Attempting to copy zthinlogs to $ZTHINTOP:"
cp ../zthinlogs $ZTHINTOP/ || { echo "Failed to copy zthinlogs"; exit 1; }

# Create the tarball
tar czf zthin-build.tar.gz $ZTHINTOP
35 changes: 35 additions & 0 deletions .github/buildzvmsdk_deb_tar
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
# Copyright 2017 IBM Corp.
# Copyright 2024 Contributors to the Open Mainframe Project.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#------------------------------------------------------------------------------

REPO=https://github.com/openmainframeproject/feilong
REPOTOP=feilong

# Clone the repository
git clone $REPO
cd $REPOTOP || { echo "Failed to change directory to $REPOTOP"; exit 1; }

mkdir -p debian || { echo "Failed to create debian directory"; exit 1; }

# Copy files with error handling
echo "Attempting to copy zvmsdklogs to $REPOTOP:"
cp ../zvmsdklogs . || { echo "Failed to copy zvmsdklogs"; exit 1; }
cp ../vhost_deb.config . || { echo "Failed to copy vhost_deb"; exit 1; }
cp -r ../sdkdeb/* debian/ || { echo "Failed to copy files to debian directory"; exit 1; }

# Build the package
dpkg-buildpackage -S
33 changes: 33 additions & 0 deletions .github/buildzvmsdk_tar
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
# Copyright 2017 IBM Corp.
# Copyright 2024 Contributors to the Open Mainframe Project.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

REPO=https://github.com/openmainframeproject/feilong
REPOTOP=feilong
SDK=zvmsdk

# Clone the repository
git clone $REPO
# Change to the cloned directory
cd $REPOTOP

# Copy files to the build directory with error handling
echo "Attempting to copy zvmsdklogs to $REPOTOP:"
cp ../zvmsdklogs . || { echo "Failed to copy zvmsdklogs"; exit 1; }

# Create the tarball
cd ..
tar czf zvmsdk.tar.gz --exclude "$REPOTOP/.git" --exclude "$REPOTOP/zthin-parts" $REPOTOP
121 changes: 121 additions & 0 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Package Feilong

on:
workflow_dispatch:
repository_dispatch:
types: [obs-package]

jobs:
zthin_tarball:
runs-on: ubuntu-latest
steps:
- name: Check out build-zvmsdk repository
uses: actions/checkout@v4

- name: Make buildzthin_tar executable
run: chmod +x ./.github/buildzthin_tar

- name: Run buildzthin_tar script
run: ./.github/buildzthin_tar master

- name: Upload zthin tarball artifact
uses: actions/upload-artifact@v4
with:
name: zthin-tarball
path: feilong/zthin-build.tar.gz
compression-level: 0

zvmsdk_tarball:
runs-on: ubuntu-latest
steps:
- name: Check out build-zvmsdk repository
uses: actions/checkout@v4

- name: Make buildzvmsdk_tar executable
run: chmod +x ./.github/buildzvmsdk_tar

- name: Run buildzvmsdk_tar script
run: ./.github/buildzvmsdk_tar master

- name: Upload zvmsdk RPM artifact
uses: actions/upload-artifact@v4
with:
name: zvmsdk-tarball
path: zvmsdk.tar.gz
compression-level: 0 # no compression

zthin_deb_tarball:
runs-on: ubuntu-latest
steps:
- name: Check out build-zvmsdk repository
uses: actions/checkout@v4

- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y debhelper dh-make dh-python python3-all
- name: Make buildzthin_deb_tar executable
run: chmod +x ./.github/buildzthin_deb_tar


- name: Run buildzthin_deb_tar script
run: ./.github/buildzthin_deb_tar master

- name: Upload zthin RPM artifact
uses: actions/upload-artifact@v4
with:
name: zthin-deb-tarball
path: |
feilong/zthin_3.1.2.tar.gz
feilong/zthin_3.1.2.dsc
compression-level: 0

zvmsdk_deb_tarball:
runs-on: ubuntu-latest
steps:
- name: Check out build-zvmsdk repository
uses: actions/checkout@v4

- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y debhelper dh-make dh-python python3-all
- name: Make buildzvmsdk_deb_tar executable
run: chmod +x ./.github/buildzvmsdk_deb_tar

- name: Run buildzvmsdk_deb_tar script
run: ./.github/buildzvmsdk_deb_tar master

- name: Upload zvmsdk RPM artifact
uses: actions/upload-artifact@v4
with:
name: zvmsdk-deb-tarball
path: |
zvmsdk_1.4.0.dsc
zvmsdk_1.4.0.tar.gz
compression-level: 0

push_artifacts:
needs: [ zthin_tarball, zvmsdk_tarball, zthin_deb_tarball, zvmsdk_deb_tarball ]
runs-on: ubuntu-latest
steps:
- name: Check out build-zvmsdk repository
uses: actions/checkout@v4

- name: Download tarballs from artifact
uses: actions/download-artifact@v4
with:
path: obs-artifacts
merge-multiple: true
- run: ls -R obs-artifacts

- name: Push to the repository
run: |
cd obs-artifacts
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Updated tarballs "
git push
23 changes: 23 additions & 0 deletions .obs/workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
workflow:
steps:
- trigger_services:
project: home:Aazam:feilong
package: zthin_deb
package: zthin_rhel
package: zthin_sles
package: zvmsdk_deb
package: zvmsdk_rhel
package: zvmsdk_sles
- rebuild_package:
project: home:Aazam:feilong
package: zthin_deb
package: zthin_rhel
package: zthin_sles
package: zvmsdk_deb
package: zvmsdk_rhel
package: zvmsdk_sles
filters:
branches:
only:
- master
event: push
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# build-zvmsdk

Empty file added README.rst
Empty file.
65 changes: 65 additions & 0 deletions buildzthindeb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
# Copyright 2017 IBM Corp.
# Copyright 2024 Contributors to the Open Mainframe Project.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#------------------------------------------------------------------------------

# build scripts for zthin ubuntu

# Check whether branch is given
if [[ -z "$1" ]]; then
{
echo "A branch must be specified"
exit 1
}
fi

BRANCH=$1

# copy from
REPO=https://github.com/openmainframeproject/feilong
REPOTOP=feilong
ZTHIN=zthin-parts

# real copy
EXISTS=$(git ls-remote -h $REPO | grep "$BRANCH"$ | wc -l )
if [ "$EXISTS" == 0 ] ; then
{
echo "Branch $BRANCH does not exist on $REPO"
echo "Try choosing one of the following branches: "
git ls-remote --heads $REPO | awk -F "heads/" '{print $2}'
exit 1
}
fi

echo "===>Erasing old $REPOTOP, then cloning: $REPO -b $BRANCH"

# Remove old stuffs and create a new one
rm -rf ./$REPOTOP
git clone $REPO -b $BRANCH

# make dir, currently it's ./python-zvm-sdk/zthin-parts/debian
mkdir $REPOTOP/$ZTHIN/debian

# copy all pre-created debian build files into build dir
# zthinlogs is used for log rotate
cp -r zthindeb/* $REPOTOP/$ZTHIN/debian
cp ./zthinlogs $REPOTOP/$ZTHIN

# Enter build directory, it's ./feilong/zthin-parts
cd $REPOTOP/$ZTHIN

# start the real debian build
dpkg-buildpackage -uc -us
Loading

0 comments on commit 215b358

Please sign in to comment.