refactor: use drone instead of github actions, rename module #1
114
.drone.yml
Normal file
114
.drone.yml
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: test
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: golang:1.19
|
||||||
|
commands:
|
||||||
|
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: check-go-mod
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: check go.mod
|
||||||
|
image: golang:1.19
|
||||||
|
commands:
|
||||||
|
- go mod tidy
|
||||||
|
- git diff --exit-code go.mod
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: golangci-lint
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: run golangci-lint
|
||||||
|
image: golangci/golangci-lint:v1.49
|
||||||
|
commands:
|
||||||
|
- golangci-lint run
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: linux-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
registry: gitea.dwysokinski.me
|
||||||
|
repo: gitea.dwysokinski.me/kichiyaki/lubimyczytacrss
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-amd64
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: manifest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: manifest
|
||||||
|
image: plugins/manifest
|
||||||
|
settings:
|
||||||
|
auto_tag: "true"
|
||||||
|
ignore_missing: "true"
|
||||||
|
spec: manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
- name: manifest-latest
|
||||||
|
image: plugins/manifest
|
||||||
|
settings:
|
||||||
|
tags: latest
|
||||||
|
ignore_missing: "true"
|
||||||
|
spec: manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linux-amd64
|
55
.github/workflows/pr.yml
vendored
55
.github/workflows/pr.yml
vendored
|
@ -1,55 +0,0 @@
|
||||||
name: PR checks
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
env:
|
|
||||||
GO_VERSION: 1.19.x
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
go-mod:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ env.GO_VERSION }}
|
|
||||||
- name: Check go mod
|
|
||||||
run: |
|
|
||||||
go mod tidy
|
|
||||||
git diff --exit-code go.mod
|
|
||||||
|
|
||||||
golangci-lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ env.GO_VERSION }}
|
|
||||||
- name: Run golangci-lint
|
|
||||||
uses: golangci/golangci-lint-action@v3
|
|
||||||
with:
|
|
||||||
version: v1.48
|
|
||||||
|
|
||||||
tests:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go: [ 1.19.x ]
|
|
||||||
platform: [ ubuntu-latest ]
|
|
||||||
runs-on: ${{ matrix.platform }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
- name: Run go vet
|
|
||||||
run: go vet ./...
|
|
||||||
- name: Run go build
|
|
||||||
run: go build
|
|
||||||
- name: Run tests
|
|
||||||
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
|
49
.github/workflows/publish.yml
vendored
49
.github/workflows/publish.yml
vendored
|
@ -1,49 +0,0 @@
|
||||||
name: Build and push to registry
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
push_to_registry:
|
|
||||||
name: Push Docker image to Docker Hub
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out the repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Get the version
|
|
||||||
id: get_version
|
|
||||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
- name: Cache Docker layers
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: /tmp/.buildx-cache
|
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-buildx-
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.REGISTRY_LOGIN }}
|
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
tags: |
|
|
||||||
${{ secrets.REGISTRY_NAME }}/lubimyczytacrss:latest
|
|
||||||
${{ secrets.REGISTRY_NAME }}/lubimyczytacrss:${{ steps.get_version.outputs.VERSION }}
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
|
||||||
- # Temp fix
|
|
||||||
# https://github.com/docker/build-push-action/issues/252
|
|
||||||
# https://github.com/moby/buildkit/issues/1896
|
|
||||||
name: Move cache
|
|
||||||
run: |
|
|
||||||
rm -rf /tmp/.buildx-cache
|
|
||||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/Kichiyaki/lubimyczytacrss
|
module gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package api
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
||||||
)
|
)
|
||||||
|
|
||||||
type rssItem struct {
|
type rssItem struct {
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/lubimyczytac/testdata"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/lubimyczytac/testdata"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestClient_GetAuthor(t *testing.T) {
|
func TestClient_GetAuthor(t *testing.T) {
|
||||||
|
|
2
internal/lubimyczytac/testdata/testdata.go
vendored
2
internal/lubimyczytac/testdata/testdata.go
vendored
|
@ -3,7 +3,7 @@ package testdata
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed remigiusz_mroz.html
|
//go:embed remigiusz_mroz.html
|
||||||
|
|
4
main.go
4
main.go
|
@ -8,13 +8,13 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/api"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/api"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
|
||||||
"github.com/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
"gitea.dwysokinski.me/Kichiyaki/lubimyczytacrss/internal/lubimyczytac"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
13
manifest.tmpl
Normal file
13
manifest.tmpl
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
image: gitea.dwysokinski.me/kichiyaki/lubimyczytacrss:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: gitea.dwysokinski.me/kichiyaki/lubimyczytacrss:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
|
@ -1,7 +1,14 @@
|
||||||
{
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"labels": [
|
||||||
|
"dependencies"
|
||||||
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"config:base",
|
"config:base",
|
||||||
":semanticCommits",
|
":semanticCommits",
|
||||||
":semanticCommitTypeAll(chore)"
|
":semanticCommitTypeAll(chore)"
|
||||||
|
],
|
||||||
|
"postUpdateOptions": [
|
||||||
|
"gomodTidy"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user