Skip to content

Commit

Permalink
[Update] github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGalek committed Dec 28, 2024
1 parent b4209de commit 3b36811
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 59 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Commit Lint

on:
workflow_call: # Trigger pro reusable workflow
workflow_call:
inputs:
branch:
required: false
Expand All @@ -21,4 +21,7 @@ on:

jobs:
lint-commits:
uses: gouef/github-lib-template/.github/workflows/shared_commit-lint.yml@main
runs-on: ubuntu-latest
steps:
- name: Commit lint
uses: gouef/commit-lint-action@main
25 changes: 25 additions & 0 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Generate contributors

on:
schedule:
- cron: '0 0 * * 1'
pull_request:
types: [ opened, synchronize, edited ]
push:
branches:
- master
- main
- develop
- feature/**
- release/**
- test/**
- bugfix/**

jobs:
generate-contributors:
runs-on: ubuntu-latest
steps:
- name: Generate contributors
uses: gouef/create-contributors-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 10 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ on:

jobs:
call-release:
uses: gouef/github-lib-template/.github/workflows/shared_release.yml@main
with:
branch: ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create release
uses: gouef/release-action@main
with:
branch: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58 changes: 5 additions & 53 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Run tests and upload coverage

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, edited]
push:
Expand All @@ -9,64 +10,15 @@ permissions:
id-token: write
contents: read

#jobs:
# test:
# uses: gouef/github-lib-template/.github/workflows/shared_tests.yml@main
# with:
# slug: ${{ github.repository }}
jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
- name: Run tests and upload to coverage
uses: gouef/go-test-with-coverage-action@main
with:
go-version: 1.23.4

- name: Install dependencies
run: go mod tidy

- name: Run tests
run: go test -covermode=set ./... -coverprofile=coverage.txt

- name: Check coverage file
run: cat coverage.txt
- name: Debug info
run: |
echo "Repo: ${{ github.repository }}"
- name: Test if CODECOV_TOKEN is available
run: |
if [ -z "${{ secrets.CODECOV_TOKEN }}" ]; then
echo "CODECOV_TOKEN is NOT set"
else
echo "CODECOV_TOKEN is available"
fi
- name: Debug Codecov Token
run: |
echo "Codecov Token: ${{ secrets.CODECOV_TOKEN }}"
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Debug Codecov Upload
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} -f coverage.txt -r github.com/${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Upload results to Codecov
uses: codecov/codecov-action@v5
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt
name: ${{ github.workflow }}
fail_ci_if_error: true
verbose: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ install:
go mod tidy && go mod vendor

tests:
go test -v ./tests
go test -covermode=set ./... -coverprofile=coverage.txt

0 comments on commit 3b36811

Please sign in to comment.