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

feat: e2e test ci #1238

Merged
merged 31 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8168cd8
feat: download pre-release
vansangpfiev Sep 17, 2024
67fed07
Merge branch 'dev' of github.com:janhq/nitro into feat/download-pre-r…
vansangpfiev Sep 17, 2024
1efc0b6
feat: download pre-release
vansangpfiev Sep 17, 2024
24cbcf1
chore: add e2e test
vansangpfiev Sep 17, 2024
d3c36c1
fix: m
vansangpfiev Sep 17, 2024
f729364
feat: e2e test CI
vansangpfiev Sep 17, 2024
bfde9b9
f:m
vansangpfiev Sep 17, 2024
71a55cc
f:f
vansangpfiev Sep 17, 2024
10e87e4
fix: timeout
vansangpfiev Sep 17, 2024
a40594b
Merge branch 'dev' of github.com:janhq/nitro into feat/e2e-test-ci
vansangpfiev Sep 18, 2024
85ef04d
fix: exit code
vansangpfiev Sep 18, 2024
3b5ac11
Merge branch 'dev' into feat/e2e-test-ci
vansangpfiev Sep 19, 2024
dd8328b
Merge branch 'dev' of github.com:janhq/nitro into feat/e2e-test-ci
vansangpfiev Sep 19, 2024
7d603c5
Merge branch 'feat/e2e-test-ci' of github.com:janhq/nitro into feat/e…
vansangpfiev Sep 19, 2024
c2d3d92
fix: timeout None
vansangpfiev Sep 19, 2024
607629a
Merge branch 'dev' of github.com:janhq/nitro into feat/e2e-test-ci
vansangpfiev Sep 19, 2024
479cd1b
Merge branch 'dev' of github.com:janhq/nitro into feat/e2e-test-ci
vansangpfiev Oct 1, 2024
a343f4b
Merge branch 'dev' of github.com:janhq/nitro into feat/e2e-test-ci
vansangpfiev Oct 1, 2024
652363a
fix: test
vansangpfiev Oct 1, 2024
e10370f
f:m
vansangpfiev Oct 1, 2024
32cef18
f:m
vansangpfiev Oct 2, 2024
8a71cae
fix: clone exe
vansangpfiev Oct 2, 2024
ad9ac1e
fix: cd
vansangpfiev Oct 2, 2024
90f5b26
fix: temp comment
vansangpfiev Oct 2, 2024
b198911
fix: windows and macos
vansangpfiev Oct 2, 2024
14c12f8
fix: test
vansangpfiev Oct 2, 2024
8af6b78
fix: windows
vansangpfiev Oct 2, 2024
f7fdd42
fix: readable
vansangpfiev Oct 2, 2024
5c7519a
Merge branch 'dev' into feat/e2e-test-ci
hiento09 Oct 2, 2024
76e7adf
ci: e2e testing use GITHUB_TOKEN to increase github api rate limit
hiento09 Oct 2, 2024
f6ea8bd
ci: enable e2e testing in quality gate new PR
hiento09 Oct 2, 2024
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
Prev Previous commit
Next Next commit
ci: e2e testing use GITHUB_TOKEN to increase github api rate limit
  • Loading branch information
hiento09 committed Oct 2, 2024
commit 76e7adf90ad88935796c4781aaad466f9e585e55
2 changes: 2 additions & 0 deletions .github/workflows/template-build-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ jobs:
python e2e-test/main.py
rm build/cortex-nightly
rm build/cortex-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-package
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/template-build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ jobs:
python e2e-test/main.py
rm build/cortex-nightly
rm build/cortex-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-package
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/template-build-windows-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ jobs:
python e2e-test/main.py
rm build/cortex-nightly.exe
rm build/cortex-beta.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-package
run: |
Expand Down
17 changes: 16 additions & 1 deletion engine/services/engine_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ cpp::result<bool, std::string> EngineService::UninstallEngine(

cpp::result<bool, std::string> EngineService::DownloadEngine(
const std::string& engine, const std::string& version) {

// Check if GITHUB_TOKEN env exist
const char* github_token = std::getenv("GITHUB_TOKEN");

auto get_params = [&engine, &version]() -> std::vector<std::string> {
if (version == "latest") {
return {"repos", "janhq", engine, "releases", version};
Expand All @@ -232,7 +236,18 @@ cpp::result<bool, std::string> EngineService::DownloadEngine(
};

httplib::Client cli(url_obj.GetProtocolAndHost());
if (auto res = cli.Get(url_obj.GetPathAndQuery());

httplib::Headers headers;

if (github_token) {
std::string auth_header = "token " + std::string(github_token);
headers.insert({"Authorization", auth_header});
CTL_INF("Using authentication with GitHub token.");
} else {
CTL_INF("No GitHub token found. Sending request without authentication.");
}

if (auto res = cli.Get(url_obj.GetPathAndQuery(), headers);
res->status == httplib::StatusCode::OK_200) {
auto body = json::parse(res->body);
auto get_data =
Expand Down
Loading