Skip to content

Commit

Permalink
feature: #12 support MacOS
Browse files Browse the repository at this point in the history
feature: updated docs for macos installation
feature: integration CI job can specify which job to run when launched manually
  • Loading branch information
parvit committed Nov 4, 2024
1 parent d069b14 commit d8dfaab
Show file tree
Hide file tree
Showing 167 changed files with 37,880 additions and 4,450 deletions.
173 changes: 163 additions & 10 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
type: boolean
default: false
required: true
skip_macos:
description: 'skips the MacOS job'
type: boolean
default: false
required: true
push:
branches: [ "main", "dev-*" ]

Expand Down Expand Up @@ -67,6 +72,153 @@ jobs:
name: qpep_user_manual
path: "docs/*.pdf"

build-mac-os:
if: ${{ !inputs.skip_macos }}
runs-on: macos-latest
env:
GO_VERSION: 1.20.14
CMAKE_VERSION: '3.22.x'
GOARCH: arm64
GOOS: darwin
CGO_ENABLED: 1
GOPATH: ${{ github.workspace }}/.go
CMAKE_BUILD_PARALLEL_LEVEL: 4
IGNORE_PACKAGES: 'tray|docker|docs|version|webgui|workers$'
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: true

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Set up CMake
uses: jwlawson/[email protected]
with:
cmake-version: ${{ env.CMAKE_VERSION }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Prepare
run: |
go clean -cache -x
mkdir -p cover
mkdir -p report
mkdir -p unit
mkdir -p $GOPATH/bin
pip install dmgbuild
- name: Build Backends
run: |
export CPP=${CXX}
export PATH=$GOPATH/bin:$GOPATH/bin/${GOOS}_${GOARCH}:$PATH
cd backend/
go generate
- name: Build Executable
run: |
go build -v -o build/qpep
- name: Build QPep Tray 64bits
run: |
pushd qpep-tray
go build -v -o ../build/qpep-tray
popd
- name: Build MacOS installer
run: |
bash ./installer_osx.sh "0.0.0-dev${{github.run_id}}"
- uses: actions/upload-artifact@v4
with:
name: qpep_macos_b${{ github.run_id }}
path: installer-osx/QPep*.pkg

- name: Prepare Tests
run: |
mkdir -p unit/
mkdir -p cover/
mkdir -p report/
go install github.com/jstemmer/go-junit-report/[email protected]
go install github.com/axw/gocov/[email protected]
go install github.com/matm/gocov-html/cmd/[email protected]
go install github.com/AlekSi/[email protected]
- name: Test
run: |
set -x
go list ./... | grep -E -v "${IGNORE_PACKAGES}"
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
export WORKSPACE="${{ github.workspace }}"
go test -v -gcflags=-l -cover -c -o qpep.$(basename $PWD).test > unit_tests.out 2>&1 || true
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=$WORKSPACE/cover/$(basename $PWD).out >> unit_tests.out 2>&1 || true
grep -E "PASS|FAIL|SKIP" unit_tests.out || true
cat unit_tests.out | go-junit-report > $WORKSPACE/unit/$(basename $PWD).xml
popd
done
continue-on-error: true

- name: Publish Coverage Results
if: always()
run: |
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
echo "=== Package $i ===" >> $GITHUB_STEP_SUMMARY
gocov convert ${{ github.workspace }}/cover/$(basename $PWD).out | gocov report | grep "Coverage" >> $GITHUB_STEP_SUMMARY || true
echo >> $GITHUB_STEP_SUMMARY
gocov convert ${{ github.workspace }}/cover/$(basename $PWD).out | gocov-html > ${{ github.workspace }}/report/$(basename $PWD).html || true
popd
done
continue-on-error: true

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: always()
with:
check_name: "Unit Tests - MacOS Platform"
junit_files: "unit/*.xml"

- uses: actions/upload-artifact@v4
if: always()
with:
name: macos_cover_output
path: "cover/*.out"

- uses: actions/upload-artifact@v4
if: always()
with:
name: macos_coverage_report
path: "report/*.html"

- name: Fail build on test error
run: |
set +e
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
if [ ! -f unit_tests.out ]; then
exit 1
fi
grep -E "FAIL:" unit_tests.out
if [ $? -eq 0 ]; then
exit 1
fi
popd
done
build-linux:
if: ${{ !inputs.skip_linux }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -133,7 +285,7 @@ jobs:
- name: Test
run: |
set -x
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/parvit\/qpep\/||p')
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
export WORKSPACE="${{ github.workspace }}"
Expand All @@ -148,7 +300,7 @@ jobs:
- name: Publish Coverage Results
if: always()
run: |
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/parvit\/qpep\/||p')
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
echo "=== Package $i ===" >> $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -181,7 +333,7 @@ jobs:
- name: Fail build on test error
run: |
set +e
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/parvit\/qpep\/||p')
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
if [ ! -f unit_tests.out ]; then
Expand Down Expand Up @@ -271,14 +423,15 @@ jobs:
- name: Build QPep Tray
run: |
pushd qpep-tray
set CGO_ENABLED=0
go build -ldflags -H=windowsgui -o ..\build\64bits\qpep-tray.exe
popd
- name: Build QPep Installer
run: |
sed -E 's/Version="[^"]+"/Version="1.0.0.0-dev${{github.skip_id}}"/' installer/installer.wxs > installer/installer.wxs
sed -E 's/FileVersion:\s*"[^"]+"/FileVersion:\s*"0.0.0-dev${{github.skip_id}}"/' shared/version/versioninfo.json > shared/version/versioninfo.json
sed -E 's/ProductVersion:\s*"[^"]+"/ProductVersion:\s*"0.0.0-dev${{github.skip_id}}"/' shared/version/versioninfo.json > shared/version/versioninfo.json
sed -E 's/Version="[^"]+"/Version="1.0.0.0-dev${{github.run_id}}"/' installer/installer.wxs > installer/installer.wxs
sed -E 's/FileVersion:\s*"[^"]+"/FileVersion:\s*"0.0.0-dev${{github.run_id}}"/' shared/version/versioninfo.json > shared/version/versioninfo.json
sed -E 's/ProductVersion:\s*"[^"]+"/ProductVersion:\s*"0.0.0-dev${{github.run_id}}"/' shared/version/versioninfo.json > shared/version/versioninfo.json
set PATH=${{ github.workspace }}\wix\tools;%PATH%
msbuild installer\installer.sln
Expand All @@ -301,8 +454,8 @@ jobs:
shell: bash
run: |
export WORKSPACE=$( echo "${{ github.workspace }}" | sed -e 's|\\|/|g' )
go generate github.com/parvit/qpep/windivert
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/parvit\/qpep\/||p')
go generate github.com/Project-Faster/qpep/windivert
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
cp -r $WORKSPACE/windivert/x64/* .
Expand All @@ -319,7 +472,7 @@ jobs:
if: always()
run: |
export WORKSPACE=$( echo "${{ github.workspace }}" | sed -e 's|\\|/|g' )
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/parvit\/qpep\/||p')
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
echo "=== Package $i ===" >> $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -353,7 +506,7 @@ jobs:
shell: bash
run: |
set +e
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/parvit\/qpep\/||p')
for i in $(go list ./... | grep -E -v "${IGNORE_PACKAGES}" | sed -n -e 's|github.com\/Project-Faster\/qpep\/||p')
do
pushd $i
if [ ! -f unit_tests.out ]; then
Expand Down
Loading

0 comments on commit d8dfaab

Please sign in to comment.