134 lines
6.2 KiB
YAML
134 lines
6.2 KiB
YAML
# Temporary probe of the Gitea runner (deleted after use): tools, contexts, services, registry, cross-publishing.
|
|
name: Probe
|
|
|
|
on:
|
|
push:
|
|
branches: [ci-probe]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
default-image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Environment
|
|
run: |
|
|
head -3 /etc/os-release || true
|
|
for t in bash node git docker ruby curl jq python3 pwsh 7z zip unzip openssl dotnet; do printf '%-8s %s\n' "$t" "$(command -v $t || echo -)"; done
|
|
nproc; free -m || true; df -h / /tmp | cat
|
|
echo "server_url=${{ github.server_url }} api_url=${{ github.api_url }} repo=${{ github.repository }} owner=${{ github.repository_owner }} actor=${{ github.actor }}"
|
|
echo "ref=${{ github.ref }} ref_name=${{ github.ref_name }} sha=${{ github.sha }} run=${{ github.run_number }} id=${{ github.run_id }} event=${{ github.event_name }}"
|
|
echo "GITEA_ACTIONS=$GITEA_ACTIONS GITHUB_ACTIONS=$GITHUB_ACTIONS RUNNER_OS=$RUNNER_OS RUNNER_TEMP=$RUNNER_TEMP"
|
|
echo "GITHUB_STEP_SUMMARY=$GITHUB_STEP_SUMMARY GITHUB_OUTPUT=$GITHUB_OUTPUT GITHUB_ENV=$GITHUB_ENV"
|
|
echo "vars.PROBE='${{ vars.PROBE }}' secrets.RELEASES_TOKEN set: ${{ secrets.RELEASES_TOKEN != '' }}"
|
|
ls -l /var/run/docker.sock || true
|
|
docker version 2>&1 | head -20 || true
|
|
- name: Workflow commands
|
|
run: |
|
|
echo "::notice title=Probe::a notice"
|
|
echo "::warning title=Probe::a warning"
|
|
echo "::group::a group"; echo inside; echo "::endgroup::"
|
|
echo "## Summary from the probe" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
sdk:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: mcr.microsoft.com/dotnet/sdk:10.0
|
|
services:
|
|
postgres:
|
|
image: postgres:17
|
|
env:
|
|
POSTGRES_USER: titano
|
|
POSTGRES_PASSWORD: titano-ci
|
|
POSTGRES_DB: titano_test
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
DOTNET_NOLOGO: "1"
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
|
steps:
|
|
- name: Context
|
|
run: |
|
|
echo "job.services.postgres.id='${{ job.services.postgres.id }}' network='${{ job.services.postgres.network }}'"
|
|
echo "job.container.id='${{ job.container.id }}' network='${{ job.container.network }}'"
|
|
echo "hostname=$(hostname) workspace=$GITHUB_WORKSPACE pwd=$(pwd) user=$(id)"
|
|
getent hosts postgres || echo "postgres does not resolve"
|
|
ls -l /var/run/docker.sock || true
|
|
for t in node git docker ruby curl jq python3 openssl 7z zip unzip pwsh tar gzip; do printf '%-8s %s\n' "$t" "$(command -v $t || echo -)"; done
|
|
nproc; free -m; df -h / /tmp "$GITHUB_WORKSPACE" | cat
|
|
dotnet --list-sdks
|
|
head -3 /etc/os-release
|
|
- name: Checkout with git (no node)
|
|
env:
|
|
TOKEN: ${{ github.token }}
|
|
run: |
|
|
git config --global --add safe.directory "$PWD"
|
|
git init -q .
|
|
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
|
auth=$(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)
|
|
time git -c http.extraheader="Authorization: basic $auth" fetch -q --depth=1 origin "${{ github.sha }}"
|
|
git checkout -q FETCH_HEAD
|
|
git log --oneline -1
|
|
- name: PostgreSQL service reachable
|
|
run: |
|
|
for i in $(seq 1 90); do
|
|
if (echo > /dev/tcp/postgres/5432) 2>/dev/null; then echo "postgres:5432 open after ${i}s"; break; fi
|
|
sleep 1
|
|
done
|
|
- name: Build Tools, cross-publish App and Setup (win-x64)
|
|
run: |
|
|
set -o pipefail
|
|
time dotnet build src/Titano.Tools/Titano.Tools.csproj -c Release -nologo -clp:NoSummary 2>&1 | tail -5
|
|
common="-c Release -r win-x64 --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -nologo"
|
|
time dotnet publish src/Titano.App/Titano.App.csproj $common -p:PublishReadyToRun=true -o out/app 2>&1 | tail -15
|
|
time dotnet publish src/Titano.Setup/Titano.Setup.csproj $common -p:PublishReadyToRun=true -o out/setup 2>&1 | tail -15
|
|
time dotnet publish src/Titano.Server/Titano.Server.csproj $common -o out/server 2>&1 | tail -5
|
|
ls -la out/app out/setup out/server
|
|
- name: PE resources of the cross-published programs
|
|
run: |
|
|
mkdir -p /tmp/pecheck && cp .gitea/probe/pe.cs /tmp/pecheck/pe.cs
|
|
cd /tmp/pecheck && dotnet run pe.cs -- "$GITHUB_WORKSPACE/out/app/Titano.exe" "$GITHUB_WORKSPACE/out/setup/Titano.Setup.exe" "$GITHUB_WORKSPACE/out/server/Titano.Server.exe"
|
|
- name: Pack an installer on Linux
|
|
run: |
|
|
dotnet src/Titano.Tools/bin/Release/net10.0/Titano.Tools.dll pack-installer --setup out/setup/Titano.Setup.exe --product Titano \
|
|
--component "Titano=out/app" --version 0.0.1 --out out/Titano-Setup-0.0.1.exe
|
|
ls -la out/*.exe
|
|
cd /tmp/pecheck && dotnet run pe.cs -- "$GITHUB_WORKSPACE/out/Titano-Setup-0.0.1.exe"
|
|
|
|
docker-cli:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker:27-cli
|
|
steps:
|
|
- name: Host daemon through the socket
|
|
run: |
|
|
docker version
|
|
docker info --format 'name={{.Name}} os={{.OperatingSystem}} arch={{.Architecture}} cpus={{.NCPU}} mem={{.MemTotal}} root={{.DockerRootDir}}'
|
|
docker info --format '{{json .RegistryConfig.IndexConfigs}}'
|
|
docker buildx version || true
|
|
docker buildx ls || true
|
|
docker image ls --format '{{.Repository}}:{{.Tag}} {{.Size}}' | head -30
|
|
- name: Registry login (client) and pull (daemon)
|
|
env:
|
|
TOKEN: ${{ github.token }}
|
|
run: |
|
|
for host in gitea.encke-hake.ts.net 192.168.30.23:3000; do
|
|
if echo "$TOKEN" | docker login "$host" -u "${{ github.actor }}" --password-stdin; then echo "login $host OK"; else echo "login $host FAILED"; fi
|
|
docker pull "$host/balbosoft/chronos-probe-missing:latest" 2>&1 | tail -2 || true
|
|
done
|
|
|
|
ruby:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ruby:3.3-alpine
|
|
steps:
|
|
- name: Ruby
|
|
run: |
|
|
ruby -v
|
|
ruby -ryaml -e 'puts YAML.safe_load("a: 1").inspect'
|
|
command -v git || echo "no git"
|