Skip to content

Commit

Permalink
ci: Refactoring and harmonizing GitHub Action workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Apr 11, 2021
1 parent c31fc38 commit 9595c86
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 23 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/branch_clean.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
name: Git
on: [pull_request]

on:
- pull_request

jobs:
build:
name: Branch is clean
runs-on: ubuntu-latest
steps:
- name: Check out code
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
Expand All @@ -15,7 +19,7 @@ jobs:
git fetch --no-tags --prune origin "+refs/heads/${BASE}:refs/remotes/origin/${BASE}"
env:
BASE: ${{ github.base_ref }}
- name: Check commits description
- name: Check commits
env:
BASE: origin/${{ github.base_ref }}
HEAD: HEAD
Expand Down
27 changes: 17 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,37 @@ jobs:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- name: Checkout
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: "^1.16"
- run: |
- name: Build
run: |
make
git --no-pager diff -- ':(exclude)go.sum' && git diff --quiet -- ':(exclude)go.sum'
- uses: codecov/codecov-action@v1
- name: Codecov
uses: codecov/codecov-action@v1

package:
name: Docker
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- name: Checkout
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: "^1.16"
- name: Build
run: |
curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/scripts/main/bootstrap" | bash -s "release"
./scripts/release build
- name: Login to DockerHub
- name: Setup Docker
uses: docker/setup-buildx-action@v1
- name: Setup DockerHub
if: env.DOCKER_USER && env.DOCKER_PASS
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
Expand All @@ -72,7 +78,8 @@ jobs:
runs-on: ubuntu-latest
needs: package
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
- name: Publish
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: "CodeQL"
---
name: CodeQL

on:
push:
branches:
Expand All @@ -8,6 +10,7 @@ on:
- main
schedule:
- cron: "0 0 * * 6"

jobs:
analyze:
name: Analyze
Expand All @@ -16,19 +19,20 @@ jobs:
strategy:
fail-fast: false
matrix:
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ["go"]
language:
- go
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v2
- name: Initialize CodeQL
- name: Setup CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- uses: actions/setup-go@v2
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: "^1.16"
- name: Autobuild
- name: Build
run: make build
- name: Perform CodeQL Analysis
- name: CodeQL
uses: github/codeql-action/analyze@v1
7 changes: 5 additions & 2 deletions .github/workflows/herodote.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
name: Herodote

on:
push:
branches:
- main

jobs:
build:
name: Feed
runs-on: ubuntu-latest
steps:
- name: Fetch history
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Push history
- name: Push
run: |
curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/herodote/main/herodote.sh" | bash
env:
Expand Down

0 comments on commit 9595c86

Please sign in to comment.