Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IBM i CI to build #117

Merged
merged 1 commit into from
Dec 30, 2023
Merged
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
55 changes: 25 additions & 30 deletions .github/workflows/ibmi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,39 @@ on:
- 'ile/**'

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 }}/manzan-${{ github.ref_name }}.zip .
remote_build_dir: /home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}
rsync_command: rsync -a --exclude='./.*' --exclude='./runners' --exclude='./.git' --exclude='./docs' --rsync-path=/QOpenSys/pkgs/bin/rsync ./ ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/
remote_build_dir: /home/${{ secrets.IBMI_USER }}/build/${{ github.sha }}

jobs:
build:

runs-on: ubuntu-latest
environment: OSSBUILD

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: Clean up unnecessary files
run: rm -fr ./.git ./docs
- name: Populate build sandbox
run: $rsync_command

- uses: actions/setup-node@v4
with:
always-auth: true
node-version: 18

- run: npm i -g @ibm/ibmi-ci

- name: Get short SHA ID
run: |
echo "short_sha=$(echo ${{ github.sha }} | head -c 5)" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Perform remote build
run: $ssh_command "cd $remote_build_dir && /QOpenSys/pkgs/bin/gmake -C ile BUILDLIB=MZNCI$short_sha uninstall all"
- name: Cleanup remote dist lib
if: always()
run: $ssh_command "system 'dltlib MZNCI$short_sha'"
- name: Cleanup remote build dir
if: always()
run: $ssh_command "rm -fr $remote_build_dir"

- name: Deploy to IBM i
run: |
ici \
--rcwd "$remote_build_dir" \
--push "." \
--cmd "/QOpenSys/pkgs/bin/gmake -C ile BUILDLIB=MZNCI$short_sha uninstall all" \
--ignore --cl "dltlib MZNCI$short_sha" \
--rcwd ".." \
--ignore --cmd "rm -fr $remote_build_dir"
env:
IBMI_HOST: ${{ secrets.IBMI_HOST }}
IBMI_USER: ${{ secrets.IBMI_USER }}
IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }}
IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }}