Skip to content

Commit

Permalink
feat: update actions, lint, cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Janos Miko <[email protected]>
  • Loading branch information
janosmiko committed Jan 23, 2025
1 parent 254ef5b commit de95988
Show file tree
Hide file tree
Showing 27 changed files with 523 additions and 219 deletions.
28 changes: 20 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "weekly"
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: deps(go)
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: deps(docker)
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: deps(actions)
1 change: 1 addition & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: janosmiko
22 changes: 22 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Lint GitHub Actions workflows"
on:
push:
branches:
- main
paths:
- .github/workflows/**.yml
pull_request:
paths:
- .github/workflows/**.yml
jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
30 changes: 0 additions & 30 deletions .github/workflows/docker-publish.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/go.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
---
name: "golangci-lint"
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '**.go'
- go.mod
- go.sum
pull_request:
permissions:
contents: read
jobs:
golangci:
name: "Run golangci-lint"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Download deps
run: go mod download -x

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.63.1
25 changes: 25 additions & 0 deletions .github/workflows/lint-dockerfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
---
name: "Lint Dockerfiles"
on:
push:
paths:
- images/**
branches:
- main
pull_request:
permissions:
contents: read
jobs:
lint:
name: "Lint Dockerfiles"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Hadolint
uses: hadolint/[email protected]
with:
dockerfile: |
./Dockerfile
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release

on:
push:
branches:
- main
tags:
- "v*"

jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
GO_ENV: test
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
id: go

- name: Get dependencies
run: go get -v -t -d ./...

- name: Test
run: go test ./...

goreleaser:
if: github.repository == 'janosmiko/gitea-ldap-sync'
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
23 changes: 23 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
---
name: "Spelling"
on:
push:
branches:
- "main"
pull_request:
permissions:
contents: "read"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
typos_check:
name: "Check for typos in the repository"
runs-on: "ubuntu-22.04"
timeout-minutes: 1
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Search for misspellings"
uses: crate-ci/typos@master
17 changes: 17 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
---
name: "Close stale issues and PRs"
on:
schedule:
- cron: "30 1 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
stale-issue-message: "This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days."
days-before-stale: 14
days-before-close: 5
exempt-all-assignees: true
exempt-issue-labels: bug,question
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test
on:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
GO_ENV: test
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
id: go

- name: Get dependencies
run: go get -v -t -d ./...

- name: Test
run: go test ./...
Loading

0 comments on commit de95988

Please sign in to comment.