Skip to content

Commit

Permalink
openssl 1_1_1k mingw release (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
hemnstill authored Mar 6, 2022
1 parent 04d8669 commit 024d6cc
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 26 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/ci-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,6 @@ jobs:
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}

alpine-openssl-linux:
needs: prejob
if: ${{ needs.prejob.outputs.tool=='openssl' }}
runs-on: ubuntu-latest
container: alpine:3.15.0
steps:
- uses: actions/checkout@v2
- name: build
id: build
run: |
apk add --no-cache bash
./openssl/build.sh
- uses: ncipollo/release-action@v1
with:
tag: '${{ steps.build.outputs.tool_name }}-${{ steps.build.outputs.tool_version }}'
bodyFile: './openssl/release/body.md'
artifacts: './openssl/release/${{ steps.build.outputs.tool_name }}'
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}

alpine-far2l-linux:
needs: prejob
if: ${{ needs.prejob.outputs.tool=='far2l' }}
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/openssl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: openssl build

on: [pull_request, workflow_dispatch]

env:
IMAGE_NAME: mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64

jobs:
prejob:
runs-on: ubuntu-latest
environment: release
outputs:
tool: ${{ steps.setvar.outputs.envvar }}
steps:
- id: setvar
run: |
echo ${{ secrets._CURRENT_TOOL }} > CI_ENV
echo "::set-output name=envvar::$(sed -e 's/^_//' CI_ENV)"
- run: echo CURRENT_TOOL '${{ steps.setvar.outputs.envvar }}'

openssl-alpine-musl:
needs: prejob
if: ${{ needs.prejob.outputs.tool=='openssl' }}
runs-on: ubuntu-latest
container: alpine:3.15.0
steps:
- uses: actions/checkout@v2
- name: build
id: build
run: |
apk add --no-cache bash
./openssl/build.sh
- uses: actions/upload-artifact@v3
with:
name: openssl-alpine-musl
path: |
./openssl/release/_musl.tar.gz
openssl-alpine-mingw:
needs: prejob
if: ${{ needs.prejob.outputs.tool=='openssl' }}
runs-on: ubuntu-latest
container: alpine:3.15.0
steps:
- uses: actions/checkout@v2
- name: build
id: build
run: |
apk add --no-cache bash
./openssl/build_mingw.sh
- uses: actions/upload-artifact@v3
with:
name: openssl-alpine-mingw
path: |
./openssl/release/_mingw.tar.gz
openssl-alpine-test:
needs: openssl-alpine-musl
runs-on: ubuntu-latest
container: alpine:3.15.0
steps:
- uses: actions/download-artifact@v2
with:
name: openssl-alpine-musl
path: .

- name: Test musl build on Alpine
run: |
tar -xf ./_musl.tar.gz
./openssl version
openssl-nanoserver-test:
needs: openssl-alpine-mingw
runs-on: windows-2022
steps:
- uses: actions/download-artifact@v2
with:
name: openssl-alpine-mingw
path: .
- run: tar -xf .\_mingw.tar.gz

- name: pull windows container ${{ env.IMAGE_NAME }}
shell: cmd
run: |
docker pull ${{ env.IMAGE_NAME }}
docker images ${{ env.IMAGE_NAME }}
- name: Test mingw build on Nanoserver
shell: cmd
run: >
docker container run --rm -v ${{ github.workspace }}:C:\app ${{ env.IMAGE_NAME }}
C:\app\openssl.exe version
openssl-release:
runs-on: ubuntu-latest
needs: [openssl-alpine-test, openssl-nanoserver-test]
steps:
- uses: actions/download-artifact@v2
with:
name: openssl-alpine-musl
path: .
- uses: actions/download-artifact@v2
with:
name: openssl-alpine-mingw
path: .
- run: |
tar -xf ./_musl.tar.gz
tar -xf ./_mingw.tar.gz
cat _musl.md >> body.md
cat _mingw.md >> body.md
- uses: ncipollo/release-action@v1
with:
tag: 'openssl-1_1_1k'
artifacts: './openssl*'
bodyFile: './body.md'
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 7 additions & 5 deletions openssl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ make

echo "::endgroup::"

cp -f "$dp0/release/openssl-OpenSSL_$tool_version/apps/$tool_name" "$dp0/release/"
mkdir "$dp0/release/build" && cd "$dp0/release/build"
cp -f "$dp0/release/openssl-OpenSSL_$tool_version/apps/$tool_name" "$dp0/release/build/"

cd "$dp0/release"
strip "$tool_name"
chmod +x "$tool_name"

{ printf 'SHA-256: %s
%s
%s' "$(sha256sum < $tool_name)" "$("./$tool_name" version)" "$download_url"
} > body.md
' "$(sha256sum $tool_name)" "$("./$tool_name" version)"
} > _musl.md

cat body.md
cat _musl.md

tar -czvf ../_musl.tar.gz .
43 changes: 43 additions & 0 deletions openssl/build_mingw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
dp0="$(realpath "$(dirname "$0")")"
set -e

echo "::group::install deps"

apk update
apk add --no-cache alpine-sdk perl make linux-headers mingw-w64-gcc

echo "::endgroup::"

tool_name="openssl.exe"
tool_version="1_1_1k"
echo "::set-output name=tool_name::$tool_name"
echo "::set-output name=tool_version::$tool_version"

download_url="https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_$tool_version.tar.gz"
echo "::group::prepare sources $download_url"

mkdir -p "$dp0/release" && cd "$dp0/release"
wget "$download_url" -O "tool-$tool_version.tar.gz"
tar -xf "tool-$tool_version.tar.gz" && cd "openssl-OpenSSL_$tool_version"

echo "::endgroup::"

echo "::group::build"

./Configure mingw64 --cross-compile-prefix=x86_64-w64-mingw32- no-shared LDFLAGS='--static' no-makedepend
make

echo "::endgroup::"

mkdir "$dp0/release/build" && cd "$dp0/release/build"
cp -f "$dp0/release/openssl-OpenSSL_$tool_version/apps/$tool_name" "$dp0/release/build/"

{ printf 'SHA-256: %s
%s
' "$(sha256sum $tool_name)" "$download_url"
} > _mingw.md

cat _mingw.md

tar -czvf ../_mingw.tar.gz .

0 comments on commit 024d6cc

Please sign in to comment.