Skip to content
Closed
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
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# If this file is renamed, the incrementing run attempt number will be reset.

name: CI

on:
push:
branches: [ "dev", "main" ]
pull_request:
branches: [ "dev", "main" ]

env:
CI_BUILD_NUMBER_BASE: ${{ github.run_number }}
CI_TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}

jobs:
build-windows:
name: Build (Windows)
runs-on: windows-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Setup
shell: pwsh
run: ./build/Setup.Windows.ps1
- name: Compute build number
shell: bash
run: |
echo "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER_BASE+2300))" >> $GITHUB_ENV

- name: Build and Publish
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
run: |
./build/Build.Windows.ps1

build-linux:
name: Build (Linux)
runs-on: ubuntu-24.04

permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Setup
shell: bash
run: ./build/setup.linux.sh
- name: Compute build number
shell: bash
run: |
echo "CI_BUILD_NUMBER=$(($CI_BUILD_NUMBER_BASE+2300))" >> $GITHUB_ENV

- name: Build and Publish
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
run: |
./build/Build.Linux.ps1
12 changes: 0 additions & 12 deletions Build.Common.ps1

This file was deleted.

56 changes: 0 additions & 56 deletions appveyor.yml

This file was deleted.

14 changes: 14 additions & 0 deletions build/Build.Common.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function Get-SemVer()
{
$branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER]
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "main" -and $revision -ne "local"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]

if ($suffix) {
$shortver + "-" + $suffix
} else {
$shortver
}
}
28 changes: 17 additions & 11 deletions Build.Docker.ps1 → build/Build.Linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ Push-Location $PSScriptRoot

. ./Build.Common.ps1

$IsCIBuild = $null -ne $env:APPVEYOR_BUILD_NUMBER
$IsPublishedBuild = ($env:APPVEYOR_REPO_BRANCH -eq "main" -or $env:APPVEYOR_REPO_BRANCH -eq "dev") -and $null -eq $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
$IsPublishedBuild = $null -ne $env:DOCKER_TOKEN

$version = Get-SemVer(@{ $true = $env:APPVEYOR_BUILD_VERSION; $false = "99.99.99" }[$env:APPVEYOR_BUILD_VERSION -ne $NULL])
$version = Get-SemVer()
$framework = "net9.0"
$image = "datalust/seqcli"
$archs = @(
Expand Down Expand Up @@ -42,14 +41,19 @@ function Build-DockerImage($arch)
if($LASTEXITCODE -ne 0) { exit 3 }
}

function Publish-DockerImage($arch)
function Login-ToDocker()
{
$ErrorActionPreference = "SilentlyContinue"

if ($IsCIBuild) {
Write-Output "$env:DOCKER_TOKEN" | docker login -u $env:DOCKER_USER --password-stdin
if ($LASTEXITCODE) { exit 3 }
}
Write-Output "$env:DOCKER_TOKEN" | docker login -u $env:DOCKER_USER --password-stdin
if ($LASTEXITCODE) { exit 3 }

$ErrorActionPreference = "Stop"
}

function Publish-DockerImage($arch)
{
$ErrorActionPreference = "SilentlyContinue"

& docker push "$image-ci:$version-$($arch.rid)"
if($LASTEXITCODE -ne 0) { exit 3 }
Expand All @@ -76,13 +80,15 @@ Execute-Tests

foreach ($arch in $archs) {
Build-DockerImage($arch)
}

if ($IsPublishedBuild) {
Login-ToDocker()

if ($IsPublishedBuild) {
foreach ($arch in $archs) {
Publish-DockerImage($arch)
}
}

if ($IsPublishedBuild) {
Publish-DockerManifest($archs)
}

Expand Down
2 changes: 1 addition & 1 deletion Build.ps1 → build/Build.Windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Push-Location $PSScriptRoot

$ErrorActionPreference = 'Stop'

$version = Get-SemVer(@{ $true = $env:APPVEYOR_BUILD_VERSION; $false = "99.99.99" }[$env:APPVEYOR_BUILD_VERSION -ne $NULL])
$version = Get-SemVer()
$framework = 'net9.0'
$windowsTfmSuffix = '-windows'

Expand Down
File renamed without changes.
File renamed without changes.
59 changes: 0 additions & 59 deletions docker-publish.ps1

This file was deleted.

Loading