Skip to content

publish coverage in github pull requests #40

publish coverage in github pull requests

publish coverage in github pull requests #40

Workflow file for this run

---
name: tests
on: [push]
jobs:
check:
name: Go ${{ matrix.go }} checks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: [ 'stable', 'oldstable' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y asciidoc docbook-utils docbook-xml libxml2-utils xsltproc
- name: Build sshproxy
run: make
- name: Run checks
run: make get-deps check
- name: Convert go coverage to corbetura format
run: |
go install github.com/boumenot/gocover-cobertura@latest
gocover-cobertura -by-files < test/coverage.out > test/coverage.xml
- name: Generate code coverage report
uses: irongut/[email protected]
with:
filename: test/coverage.xml
badge: false
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md
test:
name: Docker tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: make test
binary-archive:
name: Publish binary archive
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Build sshproxy
run: make binary-archive
- name: Attach binary archive to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "sshproxy_*.tar.gz"
tags: true
draft: true
rpm:
name: Publish RPMs
runs-on: ubuntu-latest
container:
image: rockylinux/rockylinux:9
options: --privileged
strategy:
fail-fast: false
matrix:
include:
- target: rocky+epel-8-x86_64
arch: x86_64
dist: el8
- target: rocky+epel-9-x86_64
arch: x86_64
dist: el9
steps:
- name: Prepare mock and rpm-build
run: |
dnf -y install epel-release
dnf -y install git make mock rpm-build
echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create source archive
run: |
git config --global --add safe.directory /__w/sshproxy/sshproxy
make source-archive
- name: Build RPMs
run: mock -r ${{ matrix.target }} --rebuild --spec=misc/sshproxy.spec --sources=.
- name: Attach RPM and SRPM to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "/var/lib/mock/${{ matrix.target }}/result/sshproxy-*.rpm"
tags: true
draft: true