Skip to content

Commit

Permalink
ci: build core examples in examples/desktop (#214)
Browse files Browse the repository at this point in the history
* ci: build examples ci

* ci:

* fix: repl desktop example
  • Loading branch information
JeremyTubongbanua authored May 3, 2024
1 parent f910b80 commit 44dff62
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
45 changes: 44 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,47 @@ jobs:
- name: Build and Run Functional Tests
working-directory: tests/functional_tests
run: |
tools/run_ctest.sh
tools/run_ctest.sh
build-examples:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Install atSDK
run: |
tools/install.sh
- name: Build at_talk
working-directory: examples/desktop/at_talk
run: |
cmake -S . -B build
cmake --build build
- name: Build all CRUD examples
working-directory: examples/desktop/crud
run: |
cmake -S . -B build -DTARGET_SRC=delete.c && cmake --build build
cmake -S . -B build -DTARGET_SRC=get_publickey.c && cmake --build build
cmake -S . -B build -DTARGET_SRC=get_selfkey.c && cmake --build build
cmake -S . -B build -DTARGET_SRC=get_sharedkey.c && cmake --build build
cmake -S . -B build -DTARGET_SRC=put_publickey.c && cmake --build build
cmake -S . -B build -DTARGET_SRC=put_selfkey.c && cmake --build build
cmake -S . -B build -DTARGET_SRC=put_sharedkey.c && cmake --build build
- name: Build events
working-directory: examples/desktop/events
run: |
cmake -S . -B build
cmake --build build
- name: Build pkam_authenticate
working-directory: examples/desktop/pkam_authenticate
run: |
cmake -S . -B build
cmake --build build
- name: Build REPL
working-directory: examples/desktop/repl
run: |
cmake -S . -B build
cmake --build build --target install
2 changes: 1 addition & 1 deletion examples/desktop/repl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cd "$SCRIPT_DIRECTORY"
cmake -S . -B build

## 2b. CMake build
sudo cmake --build build --target install
cmake --build build --target install

# 3. Run REPL
./bin/repl $@
17 changes: 10 additions & 7 deletions examples/desktop/repl/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <unistd.h>

#define TAG "REPL"
Expand All @@ -21,11 +22,18 @@ int main(int argc, char *argv[]) {
int ret = 1;
atlogger_set_logging_level(ATLOGGER_LOGGING_LEVEL_DEBUG);

const unsigned long cmdlen = 4096;
char atkeysfilepath[1024];
memset(atkeysfilepath, 0, sizeof(char) * 1024); // Clear the buffer (for safety)

const size_t bufferlen = 1024;
char buffer[bufferlen];
memset(buffer, 0, sizeof(char) * bufferlen); // Clear the buffer (for safety

const size_t cmdlen = 4096;
atclient_atbytes cmd;
atclient_atbytes_init(&cmd, cmdlen);

const unsigned long recvlen = 4096;
const size_t recvlen = 4096;
atclient_atbytes recv;
atclient_atbytes_init(&recv, recvlen);

Expand Down Expand Up @@ -68,8 +76,6 @@ int main(int argc, char *argv[]) {
goto exit;
}

char atkeysfilepath[1024];
memset(atkeysfilepath, 0, sizeof(char) * 1024); // Clear the buffer (for safety)
sprintf(atkeysfilepath, "%s/.atsign/keys/%s_key.atKeys", homedir, atsign);
if (atclient_atkeys_populate_from_path(&atkeys, atkeysfilepath) != 0) {
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "Failed to read atKeys file at path \"%s\"\n", atkeysfilepath);
Expand All @@ -94,9 +100,6 @@ int main(int argc, char *argv[]) {
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_INFO, "Successfully PKAM Authenticated with atSign \"%s\"\n",
atsign);

const unsigned long bufferlen = 1024;
char buffer[bufferlen];

int loop = 1;
do {
memset(buffer, 0, sizeof(char) * bufferlen);
Expand Down

0 comments on commit 44dff62

Please sign in to comment.