Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into add-ile-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyz32 committed Jul 31, 2024
2 parents b40b117 + 8050555 commit ac91800
Show file tree
Hide file tree
Showing 24 changed files with 279 additions and 105 deletions.
9 changes: 9 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IBM i password is not included in this file because setting up passwordless ssh is recommended
# IBM i user
USER=""

# IBM i host
HOST=""

# Tests to run. If left empty all tests will run. Ex. TESTS=("msg/snd2file")
TESTS=("")
8 changes: 3 additions & 5 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
env:
remote_build_dir: /home/${{ secrets.IBMI_USER }}/build/${{ github.sha }}/
jar_file: manzan-installer-${{ github.ref_name }}.jar
build_lib: MANZANBLD
dist_lib: MANZAN
BUILDLIB: MANZAN

jobs:
build:
Expand Down Expand Up @@ -63,9 +62,8 @@ jobs:
run: |
ici \
--rcwd "${{ env.remote_build_dir }}" \
--ignore --cl "dltlib ${{ env.build_lib }}" \
--ignore --cl "dltlib ${{ env.dist_lib }}" \
--ignore --cmd "rm -fr ${{ env.remote_build_dir }} /QOpenSys/etc/manzan /opt/manzan"
--cmd "/QOpenSys/pkgs/bin/gmake BUILDLIB=${{ env.BUILDLIB }} uninstall"
--ignore --cmd "rm -fr ${{ env.remote_build_dir }}"
env:
IBMI_HOST: ${{ secrets.IBMI_HOST }}
IBMI_USER: ${{ secrets.IBMI_USER }}
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/ibmi.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This workflow will test Manzan

name: Test Manzan

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

env:
remote_build_dir: /home/${{ secrets.IBMI_USER }}/testbuild/
BUILDLIB: MZNTEST

jobs:
test:
runs-on: ubuntu-latest

environment: OSSBUILD
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: maven

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
always-auth: true

- name: Install NPM Dependencies
run: npm i -g @ibm/ibmi-ci

- name: Install Manzan
run: |
ici \
--rcwd "${{ env.remote_build_dir }}" \
--push "." \
--cmd "/QOpenSys/pkgs/bin/gmake BUILDLIB=${{ env.BUILDLIB }} install" \
env:
IBMI_HOST: ${{ secrets.IBMI_HOST }}
IBMI_USER: ${{ secrets.IBMI_USER }}
IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }}
IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }}

- name: Test Manzan
working-directory: test
run: |
ici \
--rcwd "${{ env.remote_build_dir }}" \
--cmd "/QOpenSys/pkgs/bin/gmake testonly;" \
env:
IBMI_HOST: ${{ secrets.IBMI_HOST }}
IBMI_USER: ${{ secrets.IBMI_USER }}
IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }}
IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }}

- name: Cleanup
if: always()
run: |
ici \
--rcwd "${{ env.remote_build_dir }}" \
--cmd "/QOpenSys/pkgs/bin/gmake BUILDLIB=${{ env.BUILDLIB }} uninstall" \
env:
IBMI_HOST: ${{ secrets.IBMI_HOST }}
IBMI_USER: ${{ secrets.IBMI_USER }}
IBMI_PASSWORD: ${{ secrets.IBMI_PASSWORD }}
IBMI_SSH_PORT: ${{ secrets.IBMI_SSH_PORT }}
16 changes: 12 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.vscode/
camel/.vscode
camel/.settings
camel/.classpath
Expand All @@ -11,9 +10,18 @@ camel/app.ini
camel/test.txt
config/app.ini
*.txt
*.ini
/data.ini
/dests.ini
/app.ini
ile/src/mzversion.h
camel/src/main/java/com/github/theprez/manzan/Version.java
appinstall.jar
manzan-installer-*.jar
.env
.env

test/test.iml
.secrets
.idea
camel.out
install.out
tests.out
/ile/.metadata
45 changes: 45 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format

// Testing tasks
"version": "2.0.0",
"tasks": [
{
"label": "deploy",
"type": "shell",
"command": "./deploy.sh",
"problemMatcher": []
},
{
"label": "deployAndBuildAll",
"type": "shell",
"command": "./deployAndBuildAll.sh",
"problemMatcher": []
},
{
"label": "deployAndBuildCamel",
"type": "shell",
"command": "./deployAndBuildCamel.sh",
"problemMatcher": []
},
{
"label": "deployAndTest",
"type": "shell",
"command": "./deployAndTest.sh",
"problemMatcher": []
},
{
"label": "deployBuildAllAndTest",
"type": "shell",
"command": "./deployBuildAllAndTest.sh",
"problemMatcher": []
},
{
"label": "deployBuildCamelAndTest",
"type": "shell",
"command": "./deployBuildCamelAndTest.sh",
"problemMatcher": []
}
]
}
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ To build only the ILE component, you can use `ile` as the target:

```sh
gmake ile
```
```

### Recommended tools for development
- ShellCheck vscode extension
- act https://github.com/nektos/act (github actions local runner)
- c/c++ vscode extensions
- Code Spell Checker
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
BUILDLIB:=MANZAN
MANZAN_TEMPLIB:=MANZANBLD
BUILDLIB?=MANZAN
BUILDVERSION:="Development build \(built with Make\)"

.PHONY: ile camel test

ile:
gmake -C ile
gmake -C ile BUILDLIB=${BUILDLIB}

camel:
gmake -C camel
Expand All @@ -19,13 +18,13 @@ testonly:
all: ile camel

install:
gmake -C config install
gmake -C ile
gmake -C config install BUILDLIB=${BUILDLIB}
gmake -C ile BUILDLIB=${BUILDLIB}
gmake -C camel install

uninstall:
gmake -C ile uninstall
gmake -C config uninstall
gmake -C ile uninstall BUILDLIB=${BUILDLIB}
gmake -C config uninstall BUILDLIB=${BUILDLIB}

/QOpenSys/pkgs/bin/zip:
/QOpenSys/pkgs/bin/yum install zip
Expand All @@ -38,12 +37,11 @@ appinstall.jar: /QOpenSys/pkgs/bin/wget

manzan-installer-v%.jar: /QOpenSys/pkgs/bin/zip appinstall.jar
echo "Building version $*"
system "clrlib ${MANZAN_TEMPLIB}" || system "crtlib ${MANZAN_TEMPLIB}"
system "dltlib ${BUILDLIB}" || echo "could not delete"
system "crtlib ${BUILDLIB}"
system "dltlib ${BUILDLIB}"
rm -fr /QOpenSys/etc/manzan
gmake -C config BUILDVERSION="$*" install
gmake -C ile BUILDVERSION="$*"
gmake -C config BUILDVERSION="$*" install BUILDLIB=${BUILDLIB}
gmake -C ile BUILDVERSION="$*" BUILDLIB=${BUILDLIB}
gmake -C camel BUILDVERSION="$*" clean install
/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -jar appinstall.jar --qsys manzan --dir /QOpenSys/etc/manzan --file /opt/manzan -o $@
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ Many other destinations will be available. Examples include:
- [Mezmo](http://mezmo.com)
- [ElasticSearch](http://elastic.co)


# Running tests
- First copy the .env.sample file to .env and fill out the values
- Run tests by executing one of the following tasks
- deployAndTest: Sync the files to your IBM i, and run the tests
- deployBuildAllAndTest: Sync the files to your IBM i, build manzan including the ile component and run the tests
- deployBuildCamelAndTest: Sync the files to your IBM i, only build the java code and then run the tests

# Why the name "Manzan"?

Expand Down
2 changes: 1 addition & 1 deletion config/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

BUILDLIB:=MANZAN
BUILDLIB?=MANZAN

.PHONY: mkdirs app.ini

Expand Down
5 changes: 5 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Deploy Manzan to IBM i

source ./.env
rsync --exclude camel/target --exclude out -avz -e ssh . $USER@$HOST:~/mnzntest
6 changes: 6 additions & 0 deletions deployAndBuildAll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# Deploy Manzan to IBM i, and build the java and ile code

source ./.env
./deploy.sh
ssh $USER@$HOST "cd /home/$USER/mnzntest; gmake install" | tee install.out
6 changes: 6 additions & 0 deletions deployAndBuildCamel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# Deploy Manzan to IBM i, and build the java code

source ./.env
./deploy.sh
ssh $USER@$HOST "cd /home/$USER/mnzntest; gmake camel" | tee camel.out
5 changes: 5 additions & 0 deletions deployBuildAllAndTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Deploy Manzan to IBM i, build the java and ile code, and run the tests

./deployAndBuildAll.sh
./test.sh
5 changes: 5 additions & 0 deletions deployBuildCamelAndTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Deploy Manzan to IBM i, build the java code and run the tests

./deployAndBuildCamel.sh
./test.sh
5 changes: 5 additions & 0 deletions deployandtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Deploy Manzan to IBM i, and run the tests

./deploy.sh
./test.sh
8 changes: 4 additions & 4 deletions ile/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BUILDLIB:=MANZAN
BUILDLIB?=MANZAN
BUILDVERSION:="Development build \(built with Make\)"

all: init /qsys.lib/${BUILDLIB}.lib/handler.pgm
Expand All @@ -25,10 +25,10 @@ src/mzversion.h:
system "CRTPGM PGM(${BUILDLIB}/$*) MODULE($(patsubst %.module,$(BUILDLIB)/%,$(notdir $^))) ACTGRP(*CALLER)"

/qsys.lib/${BUILDLIB}.lib/%.module: src/%.cpp src/mzversion.h
system "CRTCPPMOD MODULE(${BUILDLIB}/$*) SRCSTMF('$<') OPTION(*EVENTF) SYSIFCOPT(*IFS64IO) DBGVIEW(*SOURCE) TERASPACE(*YES *TSIFC) STGMDL(*SNGLVL) DTAMDL(*p128) DEFINE(DEBUG_ENABLED)"
system "CRTCPPMOD MODULE(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$<') OPTION(*EVENTF) SYSIFCOPT(*IFS64IO) DBGVIEW(*SOURCE) TERASPACE(*YES *TSIFC) STGMDL(*SNGLVL) DTAMDL(*p128) DEFINE(DEBUG_ENABLED)"

/qsys.lib/${BUILDLIB}.lib/%.module: src/%.sqlc
system "CRTSQLCI OBJ(${BUILDLIB}/$*) SRCSTMF('$^') COMMIT(*NONE) DATFMT(*ISO) TIMFMT(*ISO) CVTCCSID(*JOB) COMPILEOPT('INCDIR(''src'')') SQLPATH(${BUILDLIB}) DFTRDBCOL(${BUILDLIB}) OPTION(*SQL)"
system "CRTSQLCI OBJ(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$^') COMMIT(*NONE) DATFMT(*ISO) TIMFMT(*ISO) DBGVIEW(*SOURCE) CVTCCSID(*JOB) COMPILEOPT('INCDIR(''src'')') SQLPATH(${BUILDLIB}) DFTRDBCOL(${BUILDLIB}) OPTION(*SQL)"

/qsys.lib/${BUILDLIB.lib}:
-system "RUNSQL SQL('create schema ${BUILDLIB}') NAMING(*SYS)"
Expand All @@ -42,7 +42,7 @@ src/mzversion.h:
system -kKv "CRTMSGQ MSGQ(${BUILDLIB}/$*) TEXT('Testing queue') CCSID(1208)"

/qsys.lib/${BUILDLIB}.lib/%.file: install_tasks/%.sql
system -kKv "RUNSQLSTM SRCSTMF('$<') COMMIT(*NONE) DFTRDBCOL(${BUILDLIB})"
system -kKv "RUNSQLSTM SRCSTMF('$(CURDIR)/$<') COMMIT(*NONE) DFTRDBCOL(${BUILDLIB})"
echo "Success"

uninstall:
Expand Down
Loading

0 comments on commit ac91800

Please sign in to comment.