Skip to content

Commit 0ba37c9

Browse files
authored
Using GitHub actions (#3)
1 parent e9a3699 commit 0ba37c9

6 files changed

Lines changed: 265 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
concurrency:
4+
group: codeql-${{ github.event_name }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
language: [ 'go' ]
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v5
25+
26+
- name: Setup Go
27+
uses: actions/setup-go@v5
28+
with:
29+
check-latest: true
30+
go-version-file: 'go.mod'
31+
32+
- name: Initialize CodeQL
33+
uses: github/codeql-action/init@v3
34+
with:
35+
languages: ${{ matrix.language }}
36+
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@v3
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@v3

.github/workflows/docker.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish Docker Image
2+
3+
concurrency:
4+
group: docker-${{ github.event_name }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- 'main'
11+
tags:
12+
- '*'
13+
14+
jobs:
15+
docker:
16+
name: Docker
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v5
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v3
26+
with:
27+
platforms: all
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
with:
32+
version: latest
33+
34+
- name: Login to DockerHub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKER_USERNAME }}
38+
password: ${{ secrets.DOCKER_PASSWORD }}
39+
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.repository_owner }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Get Version
48+
id: shell
49+
run: |
50+
echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
51+
52+
- name: Build and Push (dev)
53+
if: github.ref == 'refs/heads/main'
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
push: true
58+
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
59+
tags: |
60+
shahradel/wiresocks:dev
61+
ghcr.io/shahradelahi/wiresocks:dev
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
65+
- name: Build and Push (latest)
66+
if: startsWith(github.ref, 'refs/tags/')
67+
uses: docker/build-push-action@v6
68+
with:
69+
context: .
70+
push: true
71+
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
72+
tags: |
73+
shahradel/wiresocks:latest
74+
shahradel/wiresocks:${{ steps.shell.outputs.version }}
75+
ghcr.io/shahradelahi/wiresocks:latest
76+
ghcr.io/shahradelahi/wiresocks:${{ steps.shell.outputs.version }}
77+
cache-from: type=gha
78+
cache-to: type=gha,mode=max
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Qlty Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
upload-coverage:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- name: Set up Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
bundler-cache: true
21+
22+
- name: Install dependencies
23+
run: bundle install
24+
25+
- name: Generate coverage report
26+
run: bundle exec rake
27+
env:
28+
COVERAGE: true
29+
ISOLATED: true
30+
31+
- uses: qltysh/qlty-action/coverage@v2
32+
with:
33+
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
34+
files: coverage/.resultset.json

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish Go Releases
2+
3+
concurrency:
4+
group: release-${{ github.event_name }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
tags:
10+
- '*'
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
check-latest: true
26+
go-version-file: 'go.mod'
27+
28+
- name: Cache go module
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/go/pkg/mod
33+
~/.cache/go-build
34+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
35+
restore-keys: |
36+
${{ runner.os }}-go-
37+
38+
- name: Set prerelease flag
39+
if: startsWith(github.ref, 'refs/tags/')
40+
id: pre
41+
run: |
42+
TAG="$GITHUB_REF_NAME"
43+
if [[ "$TAG" =~ -(beta|alpha|rc) ]]; then
44+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
45+
else
46+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Build
50+
if: startsWith(github.ref, 'refs/tags/')
51+
run: make -j releases
52+
53+
- name: Upload Releases
54+
uses: softprops/action-gh-release@v2
55+
if: startsWith(github.ref, 'refs/tags/')
56+
with:
57+
files: build/*
58+
draft: true
59+
prerelease: ${{ steps.pre.outputs.is_prerelease }}

.github/workflows/stale.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Mark stale issues and pull requests
2+
3+
permissions:
4+
contents: write
5+
issues: write
6+
pull-requests: write
7+
8+
on:
9+
schedule:
10+
- cron: "0 10 * * *"
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/stale@v9
17+
with:
18+
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days'
19+
exempt-issue-labels: 'question,bug,enhancement,help wanted'
20+
exempt-pr-labels: 'pending,WIP,help wanted'
21+
days-before-stale: 60
22+
days-before-close: 7

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test
2+
3+
concurrency:
4+
group: test-${{ github.event_name }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- 'main'
11+
pull_request:
12+
13+
jobs:
14+
build-test:
15+
name: Build Test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v5
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
check-latest: true
27+
go-version-file: 'go.mod'
28+
29+
- name: Run test
30+
run: |
31+
go test -v ./...

0 commit comments

Comments
 (0)