Skip to content

publish coverage in github pull requests #44

publish coverage in github pull requests

publish coverage in github pull requests #44

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: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.go }}
path: test/coverage.out
coverage:
name: Publish Coverage
needs: check
runs-on: ubuntu-latest
steps:
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage-stable
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Convert go coverage to corbetura format
run: |
go install github.com/boumenot/gocover-cobertura@latest
gocover-cobertura -by-files < coverage.out > coverage.xml
- name: Get PR number
uses: jwalton/gh-find-current-pr@v1
id: finder
- name: Add Coverage PR Comment
uses: 5monkeys/cobertura-action@master
with:
path: coverage.xml
skip_covered: false
minimum_coverage: 75
fail_below_threshold: false
pull_request_number: ${{ steps.finder.outputs.pr }}
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