Skip to content
Closed
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
88 changes: 46 additions & 42 deletions .github/workflows/step_tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,63 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Install Go
uses: actions/setup-go@v6
with:
go-version: 1.26.x
persist-credentials: false
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup clang
run: ./scripts/install_clang.sh
# - name: Install Go
# uses: actions/setup-go@v6
# with:
# go-version: 1.26.x

- name: Run checkmetrics, checkrules and checkbpf
run: make checkmetrics checkrules checkbpf
# - name: Setup clang
# run: ./scripts/install_clang.sh

- name: Run unit tests for Go packages
run: make test
# - name: Run checkmetrics, checkrules and checkbpf
# run: make checkmetrics checkrules checkbpf

- name: Run unit tests for CGo packages
run: CGO_APPS=1 make test
# - name: Run unit tests for Go packages
# run: make test

- name: Merge coverage files
run: |
# Make global coverage report
make coverage
# - name: Run unit tests for CGo packages
# run: CGO_APPS=1 make test

# Remove testdata that contains too many files
rm -rf pkg/collector/testdata
# - name: Merge coverage files
# run: |
# # Make global coverage report
# make coverage

# Upstream package will not keep the format of README
# PR -> https://github.com/AlexBeauchemin/gobadge/pull/7
# - name: Go Coverage Badge # Pass the `coverage.out` output to this action
# uses: tj-actions/coverage-badge-go@v2
# with:
# filename: coverage.out
# link: https://github.com/mahendrapaipuri/ceems/actions/workflows/ci.yml?query=branch%3Amain
# # Remove testdata that contains too many files
# rm -rf pkg/collector/testdata

- name: Go coverage badge
run: |
# Install our custom badge updater
git clone https://github.com/mahendrapaipuri/gobadge
cd gobadge
go install .
cd ..
# # Upstream package will not keep the format of README
# # PR -> https://github.com/AlexBeauchemin/gobadge/pull/7
# # - name: Go Coverage Badge # Pass the `coverage.out` output to this action
# # uses: tj-actions/coverage-badge-go@v2
# # with:
# # filename: coverage.out
# # link: https://github.com/mahendrapaipuri/ceems/actions/workflows/ci.yml?query=branch%3Amain

# - name: Go coverage badge
# run: |
# # Install our custom badge updater
# git clone https://github.com/mahendrapaipuri/gobadge
# cd gobadge
# go install .
# cd ..

# Create/Update badge
gobadge -target README.md -filename coverage.out -link https://github.com/ceems-dev/ceems/actions/workflows/ci.yml?query=branch%3Amain
gobadge -target website/docs/00-introduction.md -filename coverage.out -link https://github.com/ceems-dev/ceems/actions/workflows/ci.yml?query=branch%3Amain
# # Create/Update badge
# gobadge -target README.md -filename coverage.out -link https://github.com/ceems-dev/ceems/actions/workflows/ci.yml?query=branch%3Amain
# gobadge -target website/docs/00-introduction.md -filename coverage.out -link https://github.com/ceems-dev/ceems/actions/workflows/ci.yml?query=branch%3Amain

# Check diff on README
git diff README.md
git diff website/docs/00-introduction.md
# # Check diff on README
# git diff README.md
# git diff website/docs/00-introduction.md

- name: Verify Changed files
id: verify-changed-files
run: |
echo "test" >> README.md
# If there are no changes exit code will be 0 and 1 if there are changes
if git diff --exit-code README.md website/docs/00-introduction.md > /dev/null; then
echo "files_changed=false" >> $GITHUB_OUTPUT
Expand All @@ -80,22 +84,22 @@ jobs:
# to push the changes to remote
- uses: actions/create-github-app-token@v3
id: app-token
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref == 'refs/heads/main'
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
client-id: 4221824
private-key: ${{ secrets.app_private_key }}

- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref == 'refs/heads/main'
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "bot@ceems.com"
git config --local user.name "CEEMS Bot"
git add README.md website/docs/00-introduction.md
git commit -m "chore: Updated coverage badge" -s

- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true' && github.ref == 'refs/heads/main'
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ steps.app-token.outputs.token }}
branch: ${{ github.head_ref }}
branch: "fix/ci/app-token-usage"
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,6 @@ If you want to say **thank you** or/and support active development of CEEMS:

- Add a [GitHub Star](https://github.com/ceems-dev/ceems) to the project.
- Write articles about project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or personal blog.
test
test
test
Loading