Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fixed pipeline #354

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Generate files

on:
push:
branches: ["main"]
paths-ignore:
- "config/version.txt"
- "README.md"

jobs:
test:
permissions:
contents: write

strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Run generate
if: matrix.os == 'ubuntu-latest'
run: make generate

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
if: matrix.os == 'ubuntu-latest'
id: verify-changed-files-generate
with:
files: |
nix/gomod2nix.toml
docs/options.md

- name: Commit changes
if: steps.verify-changed-files-generate.outputs.files_changed == 'true'
run: |
git config --local user.email "opensource@mail.schwarz"
git config --local user.name "SchwarzIT Bot"
git add nix/gomod2nix.toml docs/options.md
git commit -m "chore: regenerate files"

- name: Push changes
if: steps.verify-changed-files-coverage.outputs.files_changed == 'true' || steps.verify-changed-files-generate.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SIT_BOT_PAT }}
branch: ${{ github.head_ref }}
56 changes: 3 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ jobs:

steps:
- name: Install Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
uses: actions/setup-go@v5
with:
go-version: "^1.20.6"

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

# cache go modules
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
Expand All @@ -57,28 +57,6 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: make test-coverage

- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v2
if: matrix.os == 'ubuntu-latest'
with:
green: 80
filename: out/coverage.out

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
if: matrix.os == 'ubuntu-latest'
id: verify-changed-files-coverage
with:
files: README.md

- name: Commit changes
if: steps.verify-changed-files-coverage.outputs.files_changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore(docs): update coverage badge"

- name: Build package
run: make build

Expand All @@ -98,31 +76,3 @@ jobs:

- name: Test generate projects
run: make testing-project-ci

- name: Run generate
if: matrix.os == 'ubuntu-latest'
run: make generate

- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
if: matrix.os == 'ubuntu-latest'
id: verify-changed-files-generate
with:
files: |
nix/gomod2nix.toml
docs/options.md

- name: Commit changes
if: steps.verify-changed-files-generate.outputs.files_changed == 'true'
run: |
git config --local user.email "opensource@mail.schwarz"
git config --local user.name "SchwarzIT Bot"
git add nix/gomod2nix.toml docs/options.md
git commit -m "chore: regenerate files"

- name: Push changes
if: steps.verify-changed-files-coverage.outputs.files_changed == 'true' || steps.verify-changed-files-generate.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SIT_BOT_PAT }}
branch: ${{ github.head_ref }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
uses: actions/setup-go@v5
with:
go-version: 1.20
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@v4
# using a PAT is necessary to trigger the release workflow
# see https://github.com/orgs/community/discussions/25702
with:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# `go/template`

![Coverage](https://img.shields.io/badge/Coverage-78.9%25-yellow)
[![SIT](https://img.shields.io/badge/SIT-awesome-blueviolet.svg)](https://jobs.schwarz)
[![CI](https://github.com/SchwarzIT/go-template/actions/workflows/main.yml/badge.svg)](https://github.com/SchwarzIT/go-template/actions/workflows/main.yml)
[![Semgrep](https://github.com/SchwarzIT/go-template/actions/workflows/semgrep.yml/badge.svg)](https://github.com/SchwarzIT/go-template/actions/workflows/semgrep.yml)
Expand Down
Loading