Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: IBM i CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
ssh_command: ssh ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}
scp_dist_command: scp ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/dist.savf .
remote_build_dir: /home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}
rsync_command: rsync -a --exclude='.*' --exclude='runners' --rsync-path=/QOpenSys/pkgs/bin/rsync ./ ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install private key
run: |
mkdir -p ~/.ssh
chmod 0755 ~
chmod 0700 ~/.ssh
echo "${{ secrets.IBMI_BUILD_PVTKEY }}" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
- name: Disable strict host key checking
run: |
echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
- name: Create build sandbox
run: $ssh_command "mkdir -p $remote_build_dir"
- name: Populate build sandbox
run: $rsync_command
- name: Get short SHA ID
run: |
echo "short_sha=$(echo ${{ github.sha }} | head -c 7)" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Get library name
run: |
echo "build_library=GH{{env.short_sha}}" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Perform remote build
run: $ssh_command "cd $remote_build_dir && /QOpenSys/pkgs/bin/python3.9 ./configure --library=$build_library && /QOpenSys/pkgs/bin/make clean dist"
- name: Retrieve artifact
run: $scp_dist_command
- name: Cleanup remote build lib
if: always()
run: $ssh_command "system 'dltlib $build_library'"
- name: Cleanup remote build dir
if: always()
run: $ssh_command "rm -fr $remote_build_dir"
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: IBM i build new release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

env:
ssh_command: ssh ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}
scp_dist_command: scp ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/dist.savf .
remote_build_dir: /home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}
rsync_command: rsync -a --exclude='.*' --exclude='runners' --rsync-path=/QOpenSys/pkgs/bin/rsync ./ ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install private key
run: |
mkdir -p ~/.ssh
chmod 0755 ~
chmod 0700 ~/.ssh
echo "${{ secrets.IBMI_BUILD_PVTKEY }}" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
- name: Disable strict host key checking
run: |
echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
- name: Create build sandbox
run: $ssh_command "mkdir -p $remote_build_dir"
- name: Populate build sandbox
run: $rsync_command
- name: Get short SHA ID
run: |
echo "short_sha=$(echo ${{ github.sha }} | head -c 7)" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Get library name
run: |
echo "build_library=GH{{env.short_sha}}" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Perform remote build
run: $ssh_command "cd $remote_build_dir && /QOpenSys/pkgs/bin/python3.9 ./configure --library=$build_library && /QOpenSys/pkgs/bin/make clean dist"
- name: Retrieve artifact
run: $scp_dist_command
- name: Cleanup remote build lib
if: always()
run: $ssh_command "system 'dltlib $build_library'"
- name: Cleanup remote build dir
if: always()
run: $ssh_command "rm -fr $remote_build_dir"
- name: Create the release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload *SAVF to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./dist.savf
asset_name: dist.savf
asset_content_type: application/zip
6 changes: 6 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,9 @@ xmlstoredp.srvpgm: qsrvsrc.srcpf $(XMLSTOREDP_MODULES)
%.srcpf: $(LIBRARY).lib
(system -q 'CHKOBJ $(LIBRARY)/$* *FILE' || system -q 'CRTSRCPF $(LIBRARY)/$*') && touch $@

dist.savf: build
system "CRTSAVF ${LIBRARY}/dist"
system "SAVLIB LIB(${LIBRARY}) DEV(*SAVF) SAVF(${LIBRARY}/DIST)"
cp /qsys.lib/${LIBRARY}.lib/dist.file ./dist.savf

dist: dist.savf