Skip to content

Commit ec799ed

Browse files
authored
Switch from Cirrus CI to Github Actions and add RPM publish (#28)
1 parent 477664a commit ec799ed

File tree

4 files changed

+120
-38
lines changed

4 files changed

+120
-38
lines changed

.cirrus.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
name: tests
3+
4+
on: [push]
5+
6+
jobs:
7+
check:
8+
name: Go ${{ matrix.go }} checks
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
go: [ 'stable', 'oldstable' ]
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ matrix.go }}
22+
23+
- name: Install build tools
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y asciidoc docbook-utils docbook-xml libxml2-utils xsltproc
27+
28+
- name: Build sshproxy
29+
run: make
30+
31+
- name: Run checks
32+
run: make get-deps check
33+
34+
test:
35+
name: Docker tests
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Run tests
42+
run: make test
43+
44+
binary-archive:
45+
name: Publish binary archive
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Setup go
52+
uses: actions/setup-go@v5
53+
with:
54+
go-version: 'stable'
55+
56+
- name: Build sshproxy
57+
run: make binary-archive
58+
59+
- name: Attach binary archive to release
60+
uses: xresloader/upload-to-github-release@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
file: "sshproxy_*.tar.gz"
65+
tags: true
66+
draft: true
67+
68+
rpm:
69+
name: Publish RPMs
70+
runs-on: ubuntu-latest
71+
container:
72+
image: rockylinux/rockylinux:9
73+
options: --privileged
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
include:
78+
- target: rocky+epel-8-x86_64
79+
arch: x86_64
80+
dist: el8
81+
- target: rocky+epel-9-x86_64
82+
arch: x86_64
83+
dist: el9
84+
steps:
85+
- name: Prepare mock and rpm-build
86+
run: |
87+
dnf -y install epel-release
88+
dnf -y install git make mock rpm-build
89+
echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg
90+
91+
- name: Checkout code
92+
uses: actions/checkout@v4
93+
with:
94+
fetch-depth: 0
95+
96+
- name: Create source archive
97+
run: |
98+
git config --global --add safe.directory /__w/sshproxy/sshproxy
99+
make source-archive
100+
101+
- name: Build RPMs
102+
run: mock -r ${{ matrix.target }} --rebuild --spec=misc/sshproxy.spec --sources=.
103+
104+
- name: Attach RPM and SRPM to release
105+
uses: xresloader/upload-to-github-release@v1
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
with:
109+
file: "/var/lib/mock/${{ matrix.target }}/result/sshproxy-*.rpm"
110+
tags: true
111+
draft: true

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ install-binaries: $(EXE)
7171
install -d $(DESTDIR)$(bashcompdir)
7272
install -p -m 0644 misc/sshproxyctl-completion.bash $(DESTDIR)$(bashcompdir)
7373

74-
package: $(EXE)
74+
source-archive:
75+
git archive --prefix=sshproxy-$(SSHPROXY_VERSION)/ -o sshproxy-$(SSHPROXY_VERSION).tar.gz v$(SSHPROXY_VERSION)
76+
77+
binary-archive: $(EXE)
7578
mkdir $(PACKAGE)
7679
cp $(EXE) $(PACKAGE)
7780
tar cfz $(PACKAGE).tar.gz $(PACKAGE)
@@ -101,6 +104,6 @@ benchmark:
101104
$(GO) test -failfast -race -count=6 -bench=. -run=^# -benchmem ./... | tee benchmarks/results/$(DATE)-$(COMMIT)
102105

103106
clean:
104-
rm -f $(EXE) $(MANDOC) doc/*.xml sshproxy_*.tar.gz test/coverage.*
107+
rm -f $(EXE) $(MANDOC) doc/*.xml sshproxy*.tar.gz test/coverage.*
105108

106-
.PHONY: all exe doc install install-doc-man install-binaries package fmt get-deps check test benchmark clean
109+
.PHONY: all exe doc install install-doc-man install-binaries source-archive binary-archive fmt get-deps check test benchmark clean

README.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
sshproxy
22
========
33

4-
image:https://api.cirrus-ci.com/github/cea-hpc/sshproxy.svg["Build Status",
5-
link="https://cirrus-ci.com/github/cea-hpc/sshproxy"]
4+
image:https://github.com/cea-hpc/sshproxy/actions/workflows/tests.yml/badge.svg[
5+
"Build Status",
6+
link="https://github.com/cea-hpc/sshproxy/actions/workflows/tests.yml"]
67

78
What is sshproxy?
89
-----------------

0 commit comments

Comments
 (0)