Skip to content

Commit

Permalink
10.40 version with msvc (#24)
Browse files Browse the repository at this point in the history
- add nanoserver unit tests
  • Loading branch information
hemnstill authored May 28, 2022
1 parent 6f09dee commit c0f3fbf
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 65 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/pcre2grep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,44 @@ jobs:
with:
workflow: ${{ github.workflow }}

alpine-mingw:
windows-msvc:
needs: prejob
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
uses: ./.github/workflows/build-alpine.yml
uses: ./.github/workflows/build-windows.yml
with:
workflow: ${{ github.workflow }}
toolset: mingw
toolset: msvc

ubuntu-glibc-test:
test-ubuntu:
needs: alpine-musl
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
uses: ./.github/workflows/test-ubuntu.yml
with:
workflow: ${{ github.workflow }}
artifact: build-musl
test-run: |
./${{ github.workflow }} --version

windows-mingw-test:
needs: alpine-mingw
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
test-windows-msvc:
needs: windows-msvc
uses: ./.github/workflows/test-windows.yml
with:
artifact: build-mingw
test-run: |
./${{ github.workflow }} --version
workflow: ${{ github.workflow }}
artifact: build-msvc

test-nanoserver-msvc:
needs: windows-msvc
uses: ./.github/workflows/test-nanoserver.yml
with:
workflow: ${{ github.workflow }}
artifact: build-msvc

release:
needs: [ubuntu-glibc-test, windows-mingw-test]
needs: [test-ubuntu, test-windows-msvc, test-nanoserver-msvc]
uses: ./.github/workflows/release.yml
with:
workflow: ${{ github.workflow }}
tool_version: '10.40'
prepare_body: |
bsdtar -Oxf ./build-musl/build-musl.tar.gz build-musl.md >> body.md
bsdtar -Oxf ./build-mingw/build-mingw.tar.gz build-mingw.md >> body.md
artifacts: ./build-musl/build-musl.tar.gz, ./build-mingw/build-mingw.tar.gz
bsdtar -Oxf ./build-msvc/build-msvc.tar.gz build-msvc.md >> body.md
artifacts: ./build-musl/build-musl.tar.gz, ./build-msvc/build-msvc.tar.gz
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/test-nanoserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
workflow_call:
inputs:
workflow:
required: true
type: string
artifact:
required: true
type: string

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

jobs:
test-nanoserver:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: pull windows container ${{ env.IMAGE_NAME }}
shell: cmd
run: |
docker pull ${{ env.IMAGE_NAME }}
docker images ${{ env.IMAGE_NAME }}
- uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact }}
path: .

- name: Test ${{ inputs.artifact }} build on nanoserver-ltsc2022
run: |
tar -xf ./${{ inputs.artifact }}.tar.gz -C ./bin
docker container run --rm -v ${{ github.workspace }}:C:\app -w C:\app\${{ inputs.workflow }} ${{ env.IMAGE_NAME }} C:\app\.tools\busybox64.exe bash test_windows.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/

release/
bin/

*.tar.gz
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
| releases | latest source |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/bsdtar-3.6.1/total?label=β­³%20bsdtar-3.6.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/bsdtar-3.6.1) | [![GitHub Repo stars](https://img.shields.io/github/stars/libarchive/libarchive?style=social&label=libarchive)](https://github.com/libarchive/libarchive) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/libarchive/libarchive)](https://github.com/libarchive/libarchive/releases/latest) |
| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/pcre2grep-10.40/total?label=β­³%20pcre2grep-10.40)](https://github.com/hemnstill/StandaloneTools/releases/tag/pcre2grep-10.40) | [![GitHub Repo stars](https://img.shields.io/github/stars/PhilipHazel/pcre2?style=social&label=PCRE2)](https://github.com/PhilipHazel/pcre2) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/PhilipHazel/pcre2)](https://github.com/PhilipHazel/pcre2/releases/latest) |
| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/pcre2grep-10.40/total?label=β­³%20pcre2grep-10.40)](https://github.com/hemnstill/StandaloneTools/releases/tag/pcre2grep-10.40) | [![GitHub Repo stars](https://img.shields.io/github/stars/PCRE2Project/pcre2?style=social&label=PCRE2)](https://github.com/PCRE2Project/pcre2) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/PCRE2Project/pcre2)](https://github.com/PCRE2Project/pcre2/releases/latest) |
| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/openssl-3.0.1/total?label=β­³%20openssl-3.0.1)](https://github.com/hemnstill/StandaloneTools/releases/tag/openssl-3.0.1) <br/>[![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/openssl-1_1_1m/total?label=β­³%20openssl-1_1_1m)](https://github.com/hemnstill/StandaloneTools/releases/tag/openssl-1_1_1m) | [![GitHub Repo stars](https://img.shields.io/github/stars/openssl/openssl?style=social&label=OpenSSL)](https://github.com/openssl/openssl) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/openssl/openssl)](https://www.openssl.org/news/changelog.html) |
| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/far2l-2.4.0-beta/total?label=β­³%20far2l-2.4.0-beta)](https://github.com/hemnstill/StandaloneTools/releases/tag/far2l-2.4.0-beta) | [![GitHub Repo stars](https://img.shields.io/github/stars/elfmz/far2l?style=social&label=far2l)](https://github.com/elfmz/far2l) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/elfmz/far2l)](https://github.com/elfmz/far2l/releases/latest) |
| [![GitHub release (by tag)](https://img.shields.io/github/downloads/hemnstill/StandaloneTools/pg_dump-14.2/total?label=β­³%20pg_dump-14.2)](https://github.com/hemnstill/StandaloneTools/releases/tag/pg_dump-14.2) | [![GitHub Repo stars](https://img.shields.io/github/stars/postgres/postgres?style=social&label=postgres)](https://github.com/postgres/postgres) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/postgres/postgres)](https://www.postgresql.org/docs/current/index.html) |
Expand Down
44 changes: 0 additions & 44 deletions pcre2grep/build_mingw.sh

This file was deleted.

37 changes: 37 additions & 0 deletions pcre2grep/build_msvc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
dp0="$(realpath "$(dirname "$0")")"
set -e

tool_name="pcre2grep.exe"
tool_version="10.40"
echo "::set-output name=tool_name::$tool_name"
echo "::set-output name=tool_version::$tool_version"

download_url="https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$tool_version/pcre2-$tool_version.tar.gz"
echo "::group::prepare sources $download_url"

mkdir -p "$dp0/release/build" && cd "$dp0/release"
wget "$download_url" -O "pcre2-$tool_version.tar.gz"
tar -xf "pcre2-$tool_version.tar.gz" && cd "pcre2-$tool_version"

echo "::endgroup::"

echo "::group::build"

cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -B build -DPCRE2_STATIC_RUNTIME=ON

cmake --build build --config Release

echo "::endgroup::"

cp -f "$dp0/release/pcre2-$tool_version/build/Release/$tool_name" "$dp0/release/build"

cd "$dp0/release/build"

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

cat build-msvc.md

tar -czvf ../build-msvc.tar.gz .
8 changes: 4 additions & 4 deletions pcre2grep/build_musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tool_version="10.40"
echo "::set-output name=tool_name::$tool_name"
echo "::set-output name=tool_version::$tool_version"

download_url="https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$tool_version/pcre2-$tool_version.tar.gz"
download_url="https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$tool_version/pcre2-$tool_version.tar.gz"
echo "::group::prepare sources $download_url"

mkdir -p "$dp0/release/build" && cd "$dp0/release"
Expand All @@ -37,9 +37,9 @@ cd "$dp0/release/build"
strip "$tool_name"
chmod +x "$tool_name"

{ printf 'SHA-256: %s
%s
' "$(sha256sum $tool_name)" "$("./$tool_name" --version)"
{ printf '%s
SHA-256: %s
' "$("./$tool_name" --version)" "$(sha256sum $tool_name)"
} > build-musl.md

cat build-musl.md
Expand Down
3 changes: 3 additions & 0 deletions pcre2grep/test_cmd.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
set grep="..\bin\pcre2grep.exe"
echo "sha": "b1", | %grep% --only-matching "(?<=""sha"":\s"")[^,]+(?="")"
26 changes: 26 additions & 0 deletions pcre2grep/test_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

grep="../bin/pcre2grep"

testVersion() {
assertEquals "pcre2grep version 10.40 2022-04-14" "$("$grep" --version)"
}

testDoubleQuotesWithSpaces() {
assertEquals "test-quotes.zip" "$(echo "test-quotes.zip" | "$grep" --only-matching "[^"" ]*quotes\.zip")"
}

testParenthesesBracesEscapeDoubleQuotes() {
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching "(?<=\"sha\":\s\")[^,]+(?=\")")"
}

testParenthesesBracesSingleQuotes() {
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching '(?<="sha":\s")[^,]+(?=")')"
}

testUtf8Smile() {
assertEquals "test-utf8-πŸ˜ƒ.zip" "$(echo "test-utf8-πŸ˜ƒ.zip" | "$grep" "utf8-πŸ˜ƒ\.zip")"
}

# Load and run shUnit2.
source "../.tests/shunit2/shunit2"
30 changes: 30 additions & 0 deletions pcre2grep/test_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

grep="../bin/pcre2grep.exe"

testVersion() {
assertEquals "pcre2grep version 10.40 2022-04-14" "$("$grep" --version)"
}

testDoubleQuotesWithSpaces() {
assertEquals "test-quotes.zip" "$(echo "test-quotes.zip" | "$grep" --only-matching "[^"" ]*quotes\.zip")"
}

testParenthesesBracesEscapeDoubleQuotes() {
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching "(?<=\"sha\":\s\")[^,]+(?=\")")"
}

testParenthesesBracesSingleQuotes() {
assertEquals "a1" "$(printf ' "sha": "a1",' | "$grep" --only-matching '(?<="sha":\s")[^,]+(?=")')"
}

testParenthesesBracesCmd() {
assertEquals "b1" "$(cmd.exe /c test_cmd.bat)"
}

testUtf8Smile() {
assertEquals "test-utf8-πŸ˜ƒ.zip" "$(echo "test-utf8-πŸ˜ƒ.zip" | "$grep" "utf8-πŸ˜ƒ\.zip")"
}

# Load and run shUnit2.
source "../.tests/shunit2/shunit2"

0 comments on commit c0f3fbf

Please sign in to comment.