Skip to content

Commit

Permalink
Merge build and test jobs, upload built artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Martynas Gurskas <martynas.gurskas@nordsec.com>
  • Loading branch information
Lipt0nas committed Mar 13, 2024
1 parent 70580f7 commit ccea9ac
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,55 @@ env:

jobs:
build:
runs-on: ubuntu-latest
container:
image: rust:1.72-bullseye
steps:
- uses: actions/checkout@v3
- name: Build
run: |
cargo build --release --package uniffi-bindgen-cpp
test-bindings:
runs-on: ubuntu-latest
container:
image: ghcr.io/nordsecurity/uniffi-bindgen-cpp-test-runner:v0.3.0
steps:
- uses: actions/checkout@v3
- name: Test bindings
- name: Build bindgen
shell: bash
env:
# Github sets HOME to /github/home and breaks dependencies in Docker image..
# https://github.com/actions/runner/issues/863
HOME: /root
run: |
source ~/.bashrc
./build_bindgen.sh
- name: Build bindings
shell: bash
env:
HOME: /root
run: |
source ~/.bashrc
./build_bindings.sh
- name: Run tests
shell: bash
env:
HOME: /root
run: |
source ~/.bashrc
./test_bindings.sh
- uses: actions/upload-artifact@v3
with:
name: scaffolding_lib
path: cpp-tests/build/libuniffi_fixtures.so

test-scaffolding-go:
runs-on: ubuntu-latest
container:
image: ghcr.io/nordsecurity/uniffi-bindgen-cpp-test-runner:v0.3.0
needs: build
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: scaffolding_lib
path: cpp-tests/build/
- name: Test scaffolding Go
shell: bash
env:
# Github sets HOME to /github/home and breaks dependencies in Docker image..
# https://github.com/actions/runner/issues/863
HOME: /root
run: |
source ~/.bashrc
Expand Down
4 changes: 4 additions & 0 deletions build_bindgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euxo pipefail

cargo build --release --package uniffi-bindgen-cpp
7 changes: 7 additions & 0 deletions build_bindings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euxo pipefail

mkdir -p cpp-tests/build
cd cpp-tests/build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
3 changes: 0 additions & 3 deletions test_bindings.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash
set -euxo pipefail

mkdir -p cpp-tests/build
cd cpp-tests/build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
CTEST_OUTPUT_ON_FAILURE=1 make test
9 changes: 0 additions & 9 deletions test_scaffolding_go.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/bin/bash
set -euxo pipefail

mkdir -p cpp-tests/build
pushd cpp-tests/build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make uniffi_fixtures

popd

SCRIPT_DIR="${SCRIPT_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )}"
ROOT_DIR="$SCRIPT_DIR"

Expand All @@ -19,9 +12,7 @@ pushd $GENERATOR_DIR
cargo build
./build_bindings.sh


pushd $BINDINGS_DIR

# We exclude tests that are not part of the main Rust fixtures
EXCLUDE_LIST="custom_types_test\
|destroy_test\
Expand Down

0 comments on commit ccea9ac

Please sign in to comment.