ci: Add Gitea Actions (#228)
All checks were successful
Test / test (oldstable) (push) Successful in 1m0s
Test / test (stable) (push) Successful in 39s

Use Gitea Actions instead of Drone.

Reviewed-on: #228
This commit is contained in:
Sam Therapy 2023-11-07 20:27:18 +00:00
parent 9ef46d33e8
commit b8a2407169
4 changed files with 61 additions and 177 deletions

View file

@ -1,176 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
local testing(version, arch) = {
kind: 'pipeline',
type: 'docker',
name: '%s-%s' % [version, arch],
platform: {
arch: arch,
},
steps: [
{
name: 'lint',
image: 'golangci/golangci-lint',
commands: [
'golangci-lint run ./...',
],
},
{
name: 'cache',
image: 'golang:%s' % [version],
commands: [
'go mod tidy',
],
depends_on: [
'lint',
],
volumes: [
{
name: 'cache',
path: '/go',
},
],
},
{
name: 'test',
image: 'golang:%s' % [version],
commands: [
'make test-ci',
],
depends_on: [
'cache',
],
volumes: [
{
name: 'cache',
path: '/go',
},
],
},
{
name: 'fuzz',
image: 'golang:%s' % [version],
commands: [
'make fuzz-ci',
],
depends_on: [
'cache',
],
volumes: [
{
name: 'cache',
path: '/go',
},
],
},
],
trigger: {
event: {
exclude: [
'tag',
],
},
},
volumes: [
{
name: 'cache',
temp: {},
},
],
};
// "Inspired by" https://goreleaser.com/ci/drone/
local release() = {
kind: 'pipeline',
type: 'docker',
name: 'release',
clone: {
disable: true,
},
trigger: {
event: [
'tag',
],
},
steps: [
{
name: 'clone',
image: 'woodpeckerci/plugin-git',
settings: {
tags: true,
},
},
{
name: 'test',
image: 'golang',
commands: [
'make test-ci',
],
volumes: [
{
name: 'cache',
path: '/go',
},
],
},
{
name: 'release',
image: 'goreleaser/goreleaser',
environment: {
GITEA_TOKEN: {
from_secret: 'GITEA_TOKEN',
},
},
commands: [
'apk add --no-cache scdoc',
'goreleaser release',
],
volumes: [
{
name: 'cache',
path: '/go',
},
],
},
{
name: 'package',
image: 'git.freecumextremist.com/notsam/drone-gitea-push-packages',
settings: {
base_url: 'https://git.froth.zone',
owner: 'sam',
project_name: 'awl',
package_name: 'awl-dns',
username: 'sam',
password: {
from_secret: 'GITEA_TOKEN',
},
architectures: [
'amd64',
'arm64',
'386',
'armv6',
],
package_types: [
'deb',
'apk',
'rpm',
],
},
},
],
volumes: [
{
name: 'cache',
temp: {},
},
],
};
[
testing('1.20', 'amd64'),
testing('1.20', 'arm64'),
testing('1.21', 'amd64'),
testing('1.21', 'arm64'),
release(),
]

View file

@ -0,0 +1,35 @@
name: Gitea Release
on:
push:
tags:
- "*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.21'
- name: Install scdoc
run: sudo apt-get install -y scdoc
- name: Release with GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }}

View file

@ -0,0 +1,25 @@
name: Test
on: push
jobs:
test:
strategy:
fail-fast: true
matrix:
goVer: ["oldstable", "stable"]
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goVer }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Test
run: make test-ci

View file

@ -7,7 +7,7 @@ jobs:
fail-fast: true
matrix:
platform: [macos, windows]
goVer: ["1.20.x", "1.21.x"]
goVer: ["oldstable", "stable"]
runs-on: ${{ matrix.platform }}-latest
steps:
- name: Set up Go