Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
parvit committed Sep 17, 2024
1 parent d78d248 commit 2896b24
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 72 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
mkdir -p unit/
mkdir -p cover/
mkdir -p report/
go install github.com/jstemmer/[email protected]
go install github.com/jstemmer/go-junit-report/v2@v2.1.0
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]
Expand Down Expand Up @@ -233,7 +233,7 @@ jobs:
mkdir -p cover
mkdir -p report
mkdir -p unit
go install github.com/jstemmer/[email protected]
go install github.com/jstemmer/go-junit-report/v2@v2.1.0
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]
Expand Down Expand Up @@ -419,7 +419,7 @@ jobs:
MKDIR unit
MKDIR cover
MKDIR report
go install github.com/jstemmer/[email protected]
go install github.com/jstemmer/go-junit-report/v2@v2.1.0
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]
Expand Down
164 changes: 95 additions & 69 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:

run-name: Release (version ${{ inputs.version_tag }}, draft ${{ inputs.test_release }}) [${{ github.event_name }}][${{ github.head_ref || github.ref_name }}]


jobs:
check-release:
runs-on: ubuntu-latest
Expand All @@ -42,6 +43,49 @@ jobs:
name: Fail build
run: exit 1

docs:
if: true
runs-on: ubuntu-latest
defaults:
run:
shell: bash

env:
GO_VERSION: 1.20.14
PANDOC_VERSION: 3.3

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

- name: Install Pandoc
uses: pandoc/actions/[email protected]
with:
version: ${{ env.PANDOC_VERSION }}

- name: Install TeXlive
run: sudo apt-get update && sudo apt-get install texlive-full

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

- name: Generate PDF
run: |
cd docs/
CURDATE=$(date '+%x %T')
sed -i -E -e 's|subtitle:.+|subtitle: "User Manual - version ${{ github.event.inputs.version_tag }}"|' -e "s|date:.+|date: \"$CURDATE\"|" user-manual.md
sed -i -E -e 's|page-background:\s*resources/draft.png||' user-manual.md
go generate
- uses: actions/upload-artifact@v4
with:
name: qpep_user_manual
path: "docs/*.pdf"

build-mac-os:
needs: check-release
runs-on: macos-latest
Expand Down Expand Up @@ -112,14 +156,14 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: qpep_macos_b${{ github.run_id }}
path: installer-osx/qpep.dmg
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@v1.0.0
go install github.com/jstemmer/go-junit-report/[email protected].0
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]
Expand All @@ -131,8 +175,8 @@ jobs:
do
pushd $i
export WORKSPACE="${{ github.workspace }}"
go test -v -gcflags=-l -cover -c -o qpep.$(basename $PWD).test &> /dev/null || true
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=$WORKSPACE/cover/$(basename $PWD).out &> unit_tests.out || true
go test -v -gcflags=-l -cover -c -o qpep.$(basename $PWD).test &> unit_tests.out || true
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=$WORKSPACE/cover/$(basename $PWD).out &>> unit_tests.out || true
grep -E "PASS|FAIL|SKIP" unit_tests.out || true
cat unit_tests.out | go-junit-report > $WORKSPACE/unit/$(basename $PWD).xml
popd
Expand All @@ -154,7 +198,7 @@ jobs:
continue-on-error: true

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: always()
with:
check_name: "Unit Tests - MacOS Platform"
Expand Down Expand Up @@ -205,52 +249,68 @@ jobs:

- name: Prepare
run: |
sudo apt-get install -y pkg-config libgtk-3-dev libayatana-appindicator-dev
go clean -cache -x
mkdir -p cover
mkdir -p report
mkdir -p unit
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: Build Backends
run: |
cd backend/
go generate
- name: Build Executable
- name: Build QPep
run: |
go build -v -o build/qpep
- name: Build QPep Tray
run: |
pushd qpep-tray
go build -o ../build/qpep-tray
popd
- uses: actions/upload-artifact@v4
with:
name: qpep_linux_b${{ github.run_id }}
path: build/

- name: Prepare Tests
run: |
mkdir -p unit/
mkdir -p cover/
mkdir -p report/
go install github.com/jstemmer/[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
if: ${{ inputs.test_release }}
run: |
set -x
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 &> /dev/null || true
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=${{ github.workspace }}/cover/$(basename $PWD).out &> unit_tests.out || true
./qpep.$(basename $PWD).test -test.v -test.timeout 5m -test.coverprofile=$WORKSPACE/cover/$(basename $PWD).out &> unit_tests.out || true
grep -E "PASS|FAIL|SKIP" unit_tests.out || true
cat unit_tests.out | go-junit-report > ${{ github.workspace }}/unit/$(basename $PWD).xml
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@v2
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: ${{ inputs.test_release }}
with:
check_name: "Unit Tests - Linux Platform"
Expand Down Expand Up @@ -354,7 +414,7 @@ jobs:
MKDIR unit
MKDIR cover
MKDIR report
go install github.com/jstemmer/go-junit-report@v1.0.0
go install github.com/jstemmer/go-junit-report/[email protected].0
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]
Expand Down Expand Up @@ -385,49 +445,6 @@ jobs:
check_name: "Unit Tests - Windows Platform"
junit_files: "unit/*.xml"

docs:
if: true
runs-on: ubuntu-latest
defaults:
run:
shell: bash

env:
GO_VERSION: 1.20.14
PANDOC_VERSION: 3.3

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

- name: Install Pandoc
uses: pandoc/actions/[email protected]
with:
version: ${{ env.PANDOC_VERSION }}

- name: Install TeXlive
run: sudo apt-get update && sudo apt-get install texlive-full

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

- name: Generate PDF
run: |
cd docs/
CURDATE=$(date '+%x %T')
sed -i -E -e 's|subtitle:.+|subtitle: "User Manual - version ${{ github.event.inputs.version_tag }}"|' -e "s|date:.+|date: \"$CURDATE\"|" user-manual.md
sed -i -E -e 's|page-background:\s*resources/draft.png||' user-manual.md
go generate
- uses: actions/upload-artifact@v4
with:
name: qpep_user_manual
path: "docs/*.pdf"

create-release-tag:
needs: [ build-windows, build-linux, build-mac-os, docs ]
runs-on: ubuntu-latest
Expand All @@ -436,12 +453,6 @@ jobs:
shell: bash

steps:
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: Changelog
env:
REPO: ${{ github.repository }}

- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
Expand All @@ -457,6 +468,11 @@ jobs:
with:
name: qpep_macos_b${{ github.run_id }}

- name: Download UserManual Artifact
uses: actions/download-artifact@v4
with:
name: qpep_user_manual

- name: Prepare archives
run: |
cd ${{ github.workspace }}
Expand Down Expand Up @@ -509,3 +525,13 @@ jobs:
asset_name: qpep_macos_v${{ github.event.inputs.version_tag }}_b${{ github.run_id }}.zip
asset_content_type: application/zip

- name: Attach UserManual Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: qpep_user_manual.zip
asset_name: qpep_user_manual_v${{ github.event.inputs.version_tag }}_b${{ github.run_id }}.zip
asset_content_type: application/zip

0 comments on commit 2896b24

Please sign in to comment.