chore(CI): migrate to GitHub Actions
This commit is contained in:
parent
55cde9a13c
commit
5053fc6aee
|
@ -0,0 +1,13 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: ['https://www.paypal.me/appleboy46']
|
|
@ -0,0 +1,10 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
- package-ecosystem: gomod
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
|
@ -0,0 +1,24 @@
|
|||
name: Release Binary
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: techknowlogick/xgo:go-1.19.x
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# - name: Release binary
|
||||
# run: |
|
||||
# ls -al
|
||||
# make release
|
|
@ -0,0 +1,54 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '41 23 * * 6'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
|
@ -0,0 +1,138 @@
|
|||
name: Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build binary
|
||||
run : |
|
||||
make build_linux_amd64
|
||||
make build_linux_arm64
|
||||
make build_linux_arm
|
||||
|
||||
- name: Check binary
|
||||
run : |
|
||||
./release/linux/amd64/drone-scp --help
|
||||
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux amd64
|
||||
id: meta-linux-amd64
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-amd64
|
||||
images: |
|
||||
appleboy/drone-scp
|
||||
ghcr.io/appleboy/drone-scp
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=raw,value=latest,suffix=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-amd64
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-amd64
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-amd64
|
||||
|
||||
-
|
||||
name: Build and push linux amd64
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.amd64
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-amd64.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-amd64.outputs.labels }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux arm64
|
||||
id: meta-linux-arm64
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-arm64
|
||||
images: |
|
||||
appleboy/drone-scp
|
||||
ghcr.io/appleboy/drone-scp
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm64
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm64
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm64
|
||||
|
||||
-
|
||||
name: Build and push linux arm64
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.arm64
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-arm64.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-arm64.outputs.labels }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux arm
|
||||
id: meta-linux-arm
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-arm
|
||||
images: |
|
||||
appleboy/drone-scp
|
||||
ghcr.io/appleboy/drone-scp
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm
|
||||
|
||||
-
|
||||
name: Build and push linux arm
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.arm
|
||||
platforms: linux/arm
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-arm.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-arm.outputs.labels }}
|
|
@ -0,0 +1,35 @@
|
|||
name: Goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -0,0 +1,53 @@
|
|||
name: Lint and Testing
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1'
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: --verbose
|
||||
|
||||
- uses: hadolint/hadolint-action@v3.0.0
|
||||
name: hadolint for Dockerfile.linux.amd64
|
||||
with:
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
- uses: hadolint/hadolint-action@v3.0.0
|
||||
name: hadolint for Dockerfile.linux.arm64
|
||||
with:
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
- uses: hadolint/hadolint-action@v3.0.0
|
||||
name: hadolint for Dockerfile.linux.arm
|
||||
with:
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
|
||||
testing:
|
||||
runs-on: ubuntu-latest
|
||||
container: golang:1.19-alpine
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup sshd server
|
||||
run: |
|
||||
apk add git make curl perl bash build-base zlib-dev ucl-dev
|
||||
make ssh-server
|
||||
|
||||
- name: testing
|
||||
run: |
|
||||
make test
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
Loading…
Reference in New Issue