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

Nexus Agent #2

Merged
merged 16 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
109 changes: 76 additions & 33 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ on:
push:
branches:
- master
- dev

tags:
- '*'

pull_request:
branches:
- master

jobs:

build:
Expand Down Expand Up @@ -36,41 +39,54 @@ jobs:
if: ${{ env.IS_RELEASE == 'true' }}
run: python build/create_tag_body.py

- name: Set up Python
uses: actions/setup-python@v3
- name: Set up dotnet
uses: actions/setup-dotnet@v4
with:
python-version: '3.9'
dotnet-version: "9.0.x"
dotnet-quality: "preview"

- name: Install
run: |
sudo apt install jq
npm install -g pyright
python -m pip install build wheel pytest pytest-asyncio
python -m pip install --pre --index-url https://www.myget.org/F/apollo3zehn-dev/python/ nexus-extensibility
# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: '3.9'

- name: Prepare
run: |
chmod +x tests/Nexus.Sources.Remote.Tests/bash/remote.sh
- name: Create Docker Output Folder
run: mkdir --parent artifacts/images

# - name: Install
# run: |
# npm install -g pyright
# python -m pip install build wheel pytest pytest-asyncio
# python -m pip install --pre --index-url https://www.myget.org/F/apollo3zehn-dev/python/ nexus-extensibility

- name: Docker Setup
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build
run: |
dotnet build -c Release /p:GeneratePackage=true src/remoting/dotnet-remoting/dotnet-remoting.csproj
python -m build --wheel --outdir artifacts/package --no-isolation src/remoting/python-remoting
dotnet publish -c Release -o app /p:GeneratePackage=true src/Nexus.Agent/Nexus.Agent.csproj
# python -m build --wheel --outdir artifacts/package --no-isolation src/remoting/python-remoting

- name: Test
run: |
dotnet test -c Release --filter TestCategory=local
pyright
pytest
sudo bash tests/Nexus.Sources.Remote.Tests/SetupDockerTests.sh
dotnet test -c Release
# pyright
# pytest

- name: Docker Build
run: |
docker build -t nexus-main/nexus-agent:v_next -f src/Nexus.Agent/Dockerfile .
docker save --output artifacts/images/nexus_agent_image.tar nexus-main/nexus-agent:v_next

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
artifacts/tag_body.txt
artifacts/*.txt
artifacts/package/
artifacts/images/

outputs:
is_release: ${{ env.IS_RELEASE }}
Expand All @@ -92,17 +108,30 @@ jobs:
name: artifacts
path: artifacts

# GitHub Package Registry is broken by design: https://github.community/t/download-from-github-package-registry-without-authentication/14407/138
- name: Docker Load Image
run: docker load --input artifacts/images/nexus_agent_image.tar

- name: Nuget package (MyGet)
run: dotnet nuget push 'artifacts/package/release/*.nupkg' --api-key ${MYGET_API_KEY} --source https://www.myget.org/F/apollo3zehn-dev/api/v3/index.json
env:
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}

# GitHub Package Registry does not support Python packages: https://github.community/t/pypi-compatible-github-package-registry/14615
- name: Python package (MyGet)
run: 'for filePath in artifacts/package/*.whl; do curl -k -X POST https://www.myget.org/F/apollo3zehn-dev/python/upload -H "Authorization: Bearer ${MYGET_API_KEY}" -F "data=@$filePath"; done'
env:
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}
# - name: Python package (MyGet)
# run: 'for filePath in artifacts/package/*.whl; do curl -k -X POST https://www.myget.org/F/apollo3zehn-dev/python/upload -H "Authorization: Bearer ${MYGET_API_KEY}" -F "data=@$filePath"; done'
# env:
# MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}

- name: Docker Login (Github Container Registry)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Push
run: |
docker tag nexus-main/nexus-agent:v_next ghcr.io/nexus-main/nexus-agent:${{ needs.build.outputs.version }}
docker push ghcr.io/nexus-main/nexus-agent:${{ needs.build.outputs.version }}

publish_release:

Expand All @@ -114,16 +143,19 @@ jobs:

steps:

- name: Install
run: |
python -m pip install twine
# - name: Install
# run: |
# python -m pip install twine

- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: artifacts

- name: Docker Load Image
run: docker load --input artifacts/images/nexus_agent_image.tar

- name: GitHub Release Artifacts
uses: softprops/action-gh-release@v1
with:
Expand All @@ -134,7 +166,18 @@ jobs:
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

- name: Python Package (PyPI)
run: twine upload artifacts/package/*.whl -u__token__ -p"${PYPI_API_KEY}"
env:
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
# - name: Python Package (PyPI)
# run: twine upload artifacts/package/*.whl -u__token__ -p"${PYPI_API_KEY}"
# env:
# PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}

- name: Docker Login (Docker Hub)
uses: docker/login-action@v1
with:
username: nexusmain
password: ${{ secrets.DOCKER_API_KEY }}

- name: Docker Push
run: |
docker tag nexus-main/nexus-agent:v_next nexusmain/nexus-agent:${{ needs.build.outputs.version }}
docker push nexusmain/nexus-agent:${{ needs.build.outputs.version }}
10 changes: 10 additions & 0 deletions .nexus-agent/config/packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"c05b592f-e198-472d-9902-3f60cf0a6332": {
"Provider": "local",
"Configuration": {
"path": "../../tests/Nexus.Sources.Remote.Tests/dotnet",
"version": "v1",
"csproj": "remote.csproj"
}
}
}
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Nexus.Agent",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-nexus-agent",
"program": "${workspaceFolder}/artifacts/bin/Nexus.Agent/debug/Nexus.Agent.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Nexus.Agent",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"NEXUSAGENT_Paths__Config": "../../.nexus-agent/config"
}
}
]
}
18 changes: 9 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
"version": "2.0.0",
"tasks": [
{
"label": "build",
"label": "build-nexus-agent",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/Nexus.Sources.Remote/Nexus.Sources.Remote.csproj",
"${workspaceFolder}/src/Nexus.Agent/Nexus.Agent.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"build",
"${workspaceFolder}/src/Nexus.Sources.Remote/Nexus.Sources.Remote.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/src/Nexus.Sources.Remote/Nexus.Sources.Remote.csproj"
"publish",
"${workspaceFolder}/src/Nexus.Sources.Remote/Nexus.Sources.Remote.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v2.0.0-beta.39 - 2025-01-08

- Release Nexus.Agent.

## v2.0.0-beta.24 - 2024-03-15

- Follow Nexus changes.
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworkVersion>net8.0</TargetFrameworkVersion>
<TargetFrameworkVersion>net9.0</TargetFrameworkVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand Down
7 changes: 7 additions & 0 deletions Remote.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nexus.Benchmarks", "benchmarks\Nexus.Benchmarks\Nexus.Benchmarks.csproj", "{B602750B-5E89-453F-841B-8D7F22DE58EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nexus.Agent", "src\Nexus.Agent\Nexus.Agent.csproj", "{71F41120-5BC2-4684-ADB7-C8C97CCE8EAF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -41,6 +43,10 @@ Global
{B602750B-5E89-453F-841B-8D7F22DE58EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B602750B-5E89-453F-841B-8D7F22DE58EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B602750B-5E89-453F-841B-8D7F22DE58EB}.Release|Any CPU.Build.0 = Release|Any CPU
{71F41120-5BC2-4684-ADB7-C8C97CCE8EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71F41120-5BC2-4684-ADB7-C8C97CCE8EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71F41120-5BC2-4684-ADB7-C8C97CCE8EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71F41120-5BC2-4684-ADB7-C8C97CCE8EAF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -51,6 +57,7 @@ Global
{59CBCE56-7832-4B55-854F-C9B5E4FBEA86} = {F226553B-2E5B-4910-AF31-0B718872AF18}
{FC047115-277B-448E-854F-275B5B8343A5} = {59CBCE56-7832-4B55-854F-C9B5E4FBEA86}
{B602750B-5E89-453F-841B-8D7F22DE58EB} = {40C5CF08-E45E-4F25-BE8F-B5BBD4B0EDB3}
{71F41120-5BC2-4684-ADB7-C8C97CCE8EAF} = {F226553B-2E5B-4910-AF31-0B718872AF18}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B035E550-8A68-427B-92F1-9B1A6977BF8F}
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Nexus.Benchmarks/Nexus.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion benchmarks/Nexus.Benchmarks/PipeVsTcp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void GlobalSetup()
{
Arguments = $"{assemblyPath} pipe",
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardInput = false,
RedirectStandardOutput = true,
RedirectStandardError = true
};
Expand Down
18 changes: 0 additions & 18 deletions setup/README.md

This file was deleted.

27 changes: 0 additions & 27 deletions setup/docker/docker-compose.yml

This file was deleted.

27 changes: 0 additions & 27 deletions setup/docker/dotnet/satellite.sh

This file was deleted.

Loading
Loading