Skip to content

Commit

Permalink
Setup GitHub workflow via github-workflows-kt
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg committed Dec 29, 2023
1 parent 7e716e9 commit fbd39da
Show file tree
Hide file tree
Showing 5 changed files with 344 additions and 134 deletions.
137 changes: 137 additions & 0 deletions .github/workflows/build.main.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#!/usr/bin/env kotlin

@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.8.0")

import io.github.typesafegithub.workflows.actions.actions.*
import io.github.typesafegithub.workflows.domain.*
import io.github.typesafegithub.workflows.domain.RunnerType.*
import io.github.typesafegithub.workflows.domain.triggers.*
import io.github.typesafegithub.workflows.dsl.*
import io.github.typesafegithub.workflows.dsl.expressions.*
import io.github.typesafegithub.workflows.yaml.*

class Configuration(
val name: String,
val runnerType: RunnerType,
// 'profile name' to 'supports shared'
val profiles: List<Pair<String, Boolean>>
)

val configurations = listOf(
Configuration(
name = "macos",
runnerType = MacOSLatest,
profiles = listOf(
"tvos-simulator-arm64" to false,
"tvos-simulator-x64" to false,
"tvos-device-arm64" to false,

"watchos-simulator-arm64" to false,
"watchos-simulator-x64" to false,
"watchos-device-arm32" to false,
"watchos-device-arm64" to false,
"watchos-device-arm64_32" to false,

"ios-device-arm64" to false,
"ios-simulator-arm64" to false,
"ios-simulator-x64" to false,

"macos-x64" to true,
"macos-arm64" to true,
)
),
Configuration(
name = "linux",
runnerType = Ubuntu2004,
profiles = listOf(
"android-arm64" to true,
"android-arm32" to true,
"android-x64" to true,
"android-x86" to true,

"linux-x64" to true,
"linux-arm64" to true,

"wasm" to false,
)
),
Configuration(
name = "windows",
runnerType = WindowsLatest,
profiles = listOf(
"mingw-x64" to true
)
)
)

fun conanCreateCommand(profile: String, version: String, shared: String): String = conanCommand(
profile, version, shared,
"create conan-center-index/recipes/openssl/3.x.x --build=missing"
)

fun conanInstallCommand(profile: String, version: String, shared: String): String = conanCommand(
profile, version, shared,
"install packages/openssl3 --output-folder build/openssl3/$profile"
)

fun conanCommand(profile: String, version: String, shared: String, command: String): String = listOf(
"conan",
command,
"--version=$version",
"-pr:b default",
"-pr:h profiles/$profile",
"-o \"*:shared=$shared\"",
).joinToString(" ")

workflow(
name = "Build",
on = listOf(
WorkflowDispatch(
inputs = mapOf(
"version" to WorkflowDispatch.Input(
description = "version of OpenSSL 3",
required = true,
type = WorkflowDispatch.Type.String
)
)
)
),
sourceFile = __FILE__.toPath(),
) {
val version = expr("inputs.version")
configurations.forEach { configuration ->
job(id = configuration.name, runsOn = configuration.runnerType) {
uses(action = CheckoutV4(submodules = true))
uses(action = SetupPythonV5(pythonVersion = "3.x"))
run(command = "pip install conan")
run(command = "conan profile detect")

if (configuration.runnerType == Ubuntu2004) {
run(command = "sudo apt update")
run(command = "sudo apt install g++-8-aarch64-linux-gnu g++-8")
}

configuration.profiles.forEach { (profile, supportsShared) ->
run(command = conanCreateCommand(profile, version, "False"))
run(command = conanInstallCommand(profile, version, "False"))
if (supportsShared) {
run(command = conanCreateCommand(profile, version, "True"))
run(command = conanInstallCommand(profile, version, "True"))
}
}

// V4 has different behaviour
@Suppress("DEPRECATION")
uses(
action = UploadArtifactV3(
name = "openssl-$version",
ifNoFilesFound = UploadArtifactV3.BehaviorIfNoFilesFound.Error,
path = listOf(
"build/openssl3/*/lib/*",
"build/openssl3/*/include/*",
)
)
)
}
}
}.writeToFile(addConsistencyCheck = false)
206 changes: 206 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# This file was generated using Kotlin DSL (.github/workflows/build.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/typesafegithub/github-workflows-kt

name: 'Build'
on:
workflow_dispatch:
inputs:
version:
description: 'version of OpenSSL 3'
type: 'string'
required: true
jobs:
macos:
runs-on: 'macos-latest'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
with:
submodules: 'true'
- id: 'step-1'
uses: 'actions/setup-python@v5'
with:
python-version: '3.x'
- id: 'step-2'
run: 'pip install conan'
- id: 'step-3'
run: 'conan profile detect'
- id: 'step-4'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/tvos-simulator-arm64 -o "*:shared=False"'
- id: 'step-5'
run: 'conan install packages/openssl3 --output-folder build/openssl3/tvos-simulator-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/tvos-simulator-arm64 -o "*:shared=False"'
- id: 'step-6'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/tvos-simulator-x64 -o "*:shared=False"'
- id: 'step-7'
run: 'conan install packages/openssl3 --output-folder build/openssl3/tvos-simulator-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/tvos-simulator-x64 -o "*:shared=False"'
- id: 'step-8'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/tvos-device-arm64 -o "*:shared=False"'
- id: 'step-9'
run: 'conan install packages/openssl3 --output-folder build/openssl3/tvos-device-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/tvos-device-arm64 -o "*:shared=False"'
- id: 'step-10'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-simulator-arm64 -o "*:shared=False"'
- id: 'step-11'
run: 'conan install packages/openssl3 --output-folder build/openssl3/watchos-simulator-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-simulator-arm64 -o "*:shared=False"'
- id: 'step-12'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-simulator-x64 -o "*:shared=False"'
- id: 'step-13'
run: 'conan install packages/openssl3 --output-folder build/openssl3/watchos-simulator-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-simulator-x64 -o "*:shared=False"'
- id: 'step-14'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-device-arm32 -o "*:shared=False"'
- id: 'step-15'
run: 'conan install packages/openssl3 --output-folder build/openssl3/watchos-device-arm32 --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-device-arm32 -o "*:shared=False"'
- id: 'step-16'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-device-arm64 -o "*:shared=False"'
- id: 'step-17'
run: 'conan install packages/openssl3 --output-folder build/openssl3/watchos-device-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-device-arm64 -o "*:shared=False"'
- id: 'step-18'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-device-arm64_32 -o "*:shared=False"'
- id: 'step-19'
run: 'conan install packages/openssl3 --output-folder build/openssl3/watchos-device-arm64_32 --version=${{ inputs.version }} -pr:b default -pr:h profiles/watchos-device-arm64_32 -o "*:shared=False"'
- id: 'step-20'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/ios-device-arm64 -o "*:shared=False"'
- id: 'step-21'
run: 'conan install packages/openssl3 --output-folder build/openssl3/ios-device-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/ios-device-arm64 -o "*:shared=False"'
- id: 'step-22'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/ios-simulator-arm64 -o "*:shared=False"'
- id: 'step-23'
run: 'conan install packages/openssl3 --output-folder build/openssl3/ios-simulator-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/ios-simulator-arm64 -o "*:shared=False"'
- id: 'step-24'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/ios-simulator-x64 -o "*:shared=False"'
- id: 'step-25'
run: 'conan install packages/openssl3 --output-folder build/openssl3/ios-simulator-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/ios-simulator-x64 -o "*:shared=False"'
- id: 'step-26'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-x64 -o "*:shared=False"'
- id: 'step-27'
run: 'conan install packages/openssl3 --output-folder build/openssl3/macos-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-x64 -o "*:shared=False"'
- id: 'step-28'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-x64 -o "*:shared=True"'
- id: 'step-29'
run: 'conan install packages/openssl3 --output-folder build/openssl3/macos-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-x64 -o "*:shared=True"'
- id: 'step-30'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-arm64 -o "*:shared=False"'
- id: 'step-31'
run: 'conan install packages/openssl3 --output-folder build/openssl3/macos-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-arm64 -o "*:shared=False"'
- id: 'step-32'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-arm64 -o "*:shared=True"'
- id: 'step-33'
run: 'conan install packages/openssl3 --output-folder build/openssl3/macos-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/macos-arm64 -o "*:shared=True"'
- id: 'step-34'
uses: 'actions/upload-artifact@v3'
with:
name: 'openssl-${{ inputs.version }}'
path: |-
build/openssl3/*/lib/*
build/openssl3/*/include/*
if-no-files-found: 'error'
linux:
runs-on: 'ubuntu-20.04'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
with:
submodules: 'true'
- id: 'step-1'
uses: 'actions/setup-python@v5'
with:
python-version: '3.x'
- id: 'step-2'
run: 'pip install conan'
- id: 'step-3'
run: 'conan profile detect'
- id: 'step-4'
run: 'sudo apt update'
- id: 'step-5'
run: 'sudo apt install g++-8-aarch64-linux-gnu g++-8'
- id: 'step-6'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm64 -o "*:shared=False"'
- id: 'step-7'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm64 -o "*:shared=False"'
- id: 'step-8'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm64 -o "*:shared=True"'
- id: 'step-9'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm64 -o "*:shared=True"'
- id: 'step-10'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm32 -o "*:shared=False"'
- id: 'step-11'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-arm32 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm32 -o "*:shared=False"'
- id: 'step-12'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm32 -o "*:shared=True"'
- id: 'step-13'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-arm32 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-arm32 -o "*:shared=True"'
- id: 'step-14'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x64 -o "*:shared=False"'
- id: 'step-15'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x64 -o "*:shared=False"'
- id: 'step-16'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x64 -o "*:shared=True"'
- id: 'step-17'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x64 -o "*:shared=True"'
- id: 'step-18'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x86 -o "*:shared=False"'
- id: 'step-19'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-x86 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x86 -o "*:shared=False"'
- id: 'step-20'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x86 -o "*:shared=True"'
- id: 'step-21'
run: 'conan install packages/openssl3 --output-folder build/openssl3/android-x86 --version=${{ inputs.version }} -pr:b default -pr:h profiles/android-x86 -o "*:shared=True"'
- id: 'step-22'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-x64 -o "*:shared=False"'
- id: 'step-23'
run: 'conan install packages/openssl3 --output-folder build/openssl3/linux-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-x64 -o "*:shared=False"'
- id: 'step-24'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-x64 -o "*:shared=True"'
- id: 'step-25'
run: 'conan install packages/openssl3 --output-folder build/openssl3/linux-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-x64 -o "*:shared=True"'
- id: 'step-26'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-arm64 -o "*:shared=False"'
- id: 'step-27'
run: 'conan install packages/openssl3 --output-folder build/openssl3/linux-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-arm64 -o "*:shared=False"'
- id: 'step-28'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-arm64 -o "*:shared=True"'
- id: 'step-29'
run: 'conan install packages/openssl3 --output-folder build/openssl3/linux-arm64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/linux-arm64 -o "*:shared=True"'
- id: 'step-30'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/wasm -o "*:shared=False"'
- id: 'step-31'
run: 'conan install packages/openssl3 --output-folder build/openssl3/wasm --version=${{ inputs.version }} -pr:b default -pr:h profiles/wasm -o "*:shared=False"'
- id: 'step-32'
uses: 'actions/upload-artifact@v3'
with:
name: 'openssl-${{ inputs.version }}'
path: |-
build/openssl3/*/lib/*
build/openssl3/*/include/*
if-no-files-found: 'error'
windows:
runs-on: 'windows-latest'
steps:
- id: 'step-0'
uses: 'actions/checkout@v4'
with:
submodules: 'true'
- id: 'step-1'
uses: 'actions/setup-python@v5'
with:
python-version: '3.x'
- id: 'step-2'
run: 'pip install conan'
- id: 'step-3'
run: 'conan profile detect'
- id: 'step-4'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/mingw-x64 -o "*:shared=False"'
- id: 'step-5'
run: 'conan install packages/openssl3 --output-folder build/openssl3/mingw-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/mingw-x64 -o "*:shared=False"'
- id: 'step-6'
run: 'conan create conan-center-index/recipes/openssl/3.x.x --build=missing --version=${{ inputs.version }} -pr:b default -pr:h profiles/mingw-x64 -o "*:shared=True"'
- id: 'step-7'
run: 'conan install packages/openssl3 --output-folder build/openssl3/mingw-x64 --version=${{ inputs.version }} -pr:b default -pr:h profiles/mingw-x64 -o "*:shared=True"'
- id: 'step-8'
uses: 'actions/upload-artifact@v3'
with:
name: 'openssl-${{ inputs.version }}'
path: |-
build/openssl3/*/lib/*
build/openssl3/*/include/*
if-no-files-found: 'error'
6 changes: 0 additions & 6 deletions .github/workflows/build.yml

This file was deleted.

Loading

0 comments on commit fbd39da

Please sign in to comment.