-
Notifications
You must be signed in to change notification settings - Fork 57
139 lines (137 loc) · 4.79 KB
/
run-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Tests
on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
tests:
name: Integration and Unit tests
runs-on:
group: ${{ matrix.runner.group }}
strategy:
fail-fast: true
matrix:
runner:
- os: ubuntu-latest
group: Default
# - os: macos-13
# group: macos-gh
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Checkout actions
uses: actions/checkout@v3
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- name: Identify target test runner OS
run: echo "test_runner_os=$(echo "${{ matrix.runner.os }}" | cut -d"-" -f1)" >> $GITHUB_ENV
- name: Build and run tests
uses: ./.github/workflows/composite/unit-integration-test-runner
with:
os: ${{ env.test_runner_os }}
version: 1.6.0
pubNubPubKey: ${{ secrets.PUBNUB_PUBKEY }}
pubNubSubKey: ${{ secrets.PUBNUB_KEYSUB }}
- name: Cancel workflow runs for commit on error
if: ${{ failure() }}
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
acceptance-tests:
name: Acceptance tests
runs-on:
group: Default
steps:
- name: Setup environment
shell: bash
run: |
sudo apt-get install -y ninja-build libboost-all-dev libssl-dev
sudo gem install cucumber
- name: Checkout project
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Checkout mock-server action
uses: actions/checkout@v4
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- name: Run mock server action
uses: ./.github/.release/actions/actions/mock-server
with:
token: ${{ secrets.GH_TOKEN }}
- name: Pull Cucumber cache
id: cucumber-cpp
uses: actions/cache@v4
with:
path: |
cucumber-cpp
key: ${{ runner.os }}-cucumber-cpp-c79100eb70fbb34f6ea10030cec051c2cc9f7961
restore-keys: |
${{ runner.os }}-cucumber-cpp-
- name: Checkout Cucumber
if: steps.cucumber-cpp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: cucumber/cucumber-cpp
ref: c79100eb70fbb34f6ea10030cec051c2cc9f7961
path: cucumber-cpp-src
- name: Build Cucumber
if: steps.cucumber-cpp.outputs.cache-hit != 'true'
shell: bash
run: |
cd ./cucumber-cpp-src
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug
cd "$GITHUB_WORKSPACE"
mkdir -p cucumber-cpp
mv cucumber-cpp-src/build cucumber-cpp/build
mv cucumber-cpp-src/include cucumber-cpp/include
rm -rf cucumber-cpp-src
- name: Build acceptance tests
shell: bash
run: |
cd cpp
make -f posix_openssl.mk openssl/pubnub_sync
cd "$GITHUB_WORKSPACE"
g++ -std=c++11 -g -o BoostSteps.o -c features/step_definitions/BoostSteps.cpp -Icucumber-cpp/include -Icucumber-cpp/build/src/ -Iposix -Icore -I. -Icpp -D PUBNUB_CRYPTO_API=1 -D PUBNUB_USE_SSL=0
g++ -o steps BoostSteps.o cpp/pubnub_sync.a cucumber-cpp/build/src/libcucumber-cpp.a -Lboost -lboost_unit_test_framework -lpthread -lboost_regex -lboost_thread -lboost_program_options -lboost_filesystem -lssl -lcrypto -D PUBNUB_USE_SSL=0
- name: Run acceptance tests
shell: bash
env:
PAM_PUB_KEY: "pub_key"
PAM_SUB_KEY: "sub_key"
PAM_SEC_KEY: "sec_key"
run: |
mv sdk-specifications/features/access features
sudo python3 run_contract_tests.py features/access/grant-token.feature
sudo python3 run_contract_tests.py features/access/revoke-token.feature
ls -la results
- name: Expose acceptance tests reports
if: always()
uses: actions/upload-artifact@v4
with:
name: acceptance-test-reports
path: ./results/**
retention-days: 7
- name: Cancel workflow runs for commit on error
if: ${{ failure() }}
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
all-tests:
name: Tests
needs: [tests, acceptance-tests]
runs-on:
group: Default
steps:
- name: Tests summary
run: echo -e "\033[38;2;95;215;0m\033[1mAll test successfully passed"