Skip to content

Commit

Permalink
Merge pull request #4 from lumigo-io/adjust-workflows
Browse files Browse the repository at this point in the history
fix: Add tag workflow and minor fixes
  • Loading branch information
kenfinnigan authored Apr 22, 2024
2 parents 2c3ce45 + e1cfd8c commit d2d0367
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 18 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ concurrency:
cancel-in-progress: true

jobs:
pr-labeling:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: amannn/action-semantic-pull-request@v5
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
disallowScopes: |
release
setup-environment:
timeout-minutes: 30
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,6 +61,7 @@ jobs:
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools

lint-matrix:
strategy:
fail-fast: false
Expand Down Expand Up @@ -94,6 +110,7 @@ jobs:
key: go-lint-build-${{ matrix.group }}-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Lint
run: GOOS=${{ matrix.os }} GOARCH=amd64 make -j2 golint GROUP=${{ matrix.group }}

lint:
if: ${{ github.actor != 'dependabot[bot]' && always() }}
runs-on: ubuntu-latest
Expand All @@ -110,6 +127,7 @@ jobs:
echo "One or more matrix jobs failed."
false
fi
govulncheck:
strategy:
fail-fast: false
Expand Down Expand Up @@ -147,6 +165,7 @@ jobs:
run: make install-tools
- name: Run `govulncheck`
run: make -j2 gogovulncheck GROUP=${{ matrix.group }}

checks:
runs-on: ubuntu-latest
needs: [setup-environment]
Expand Down Expand Up @@ -191,6 +210,7 @@ jobs:
git diff -s --exit-code || (echo 'Generated code is out of date, please run "make genotelcontribcol" and commit the changes in this PR.' && exit 1)
- name: MultimodVerify
run: make multimod-verify

unittest-matrix:
strategy:
fail-fast: false
Expand Down Expand Up @@ -248,6 +268,8 @@ jobs:
with:
name: coverage-artifacts-${{ matrix.go-version }}-${{ matrix.runner }}-${{ matrix.group }}
path: ${{ matrix.group }}-coverage.txt
retention-days: 15

unittest:
if: ${{ github.actor != 'dependabot[bot]' && always() }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -383,18 +405,20 @@ jobs:
with:
name: collector-binaries-${{ matrix.os }}-${{ matrix.arch }}
path: ./bin/*
retention-days: 15

publish-stable:
runs-on: ubuntu-latest
needs: [lint, unittest, integration-tests, cross-compile]
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'lumigo-io/lumigo-otel-collector-contrib'
steps:
- uses: actions/checkout@v4
- name: Download Binaries
- name: Download Collector Binaries
uses: actions/download-artifact@v4
with:
name: collector-binaries
path: ./artifacts/
merge-multiple: true
path: ./bin/
pattern: collector-binaries-*
- name: Verify Distribution Files Exist
id: check
run: ./.github/workflows/scripts/verify_dist_files_exist.sh
Expand All @@ -403,7 +427,7 @@ jobs:
run: ./.github/workflows/scripts/set_release_tag.sh
- name: Create Github Release
run: |
gh release create $RELEASE_TAG -t $RELEASE_TAG -n "The OpenTelemetry Collector Contrib contains everything in the [opentelemetry-collector release](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/$RELEASE_TAG), be sure to check the release notes there as well." ./artifacts/
gh release create $RELEASE_TAG -t $RELEASE_TAG --verify-tag -n "The Lumigo OpenTelemetry Collector Contrib contains everything in the [opentelemetry-collector-contrib release](https://github.com/lumigo-io/lumigo-otel-collector-contrib/releases/tag/$RELEASE_TAG), be sure to check the release notes there as well." ./bin/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.github_tag.outputs.tag }}
41 changes: 41 additions & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tag Release

on:
workflow_dispatch:

jobs:
tag_release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Read versions.yaml
id: read-version
run: |
VERSION=$(awk '/version:/ {print $2}' versions.yaml)
echo "Version to tag: $VERSION"
echo "tag-name=$(echo "${VERSION}")" >> "$GITHUB_OUTPUT"
- name: Find next tag version
id: find-tag
run: |
VERSION=${{ steps.read-version.outputs.tag-name }}
while git rev-parse "refs/tags/$VERSION" >/dev/null 2>&1; do
echo "Tag $VERSION already exists, incrementing..."
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION"
LAST_PART=${VERSION_PARTS[-1]}
NEXT_PART=$((LAST_PART + 1))
VERSION_PARTS[-1]=$NEXT_PART
VERSION=$(IFS='.'; echo "${VERSION_PARTS[*]}")
done
echo "next-version=$(echo "${VERSION}")" >> "$GITHUB_OUTPUT"
- name: Tag the release
if: steps.find-tag.outputs.next-version
run: |
NEXT_VERSION=${{ steps.find-tag.outputs.next-version }}
echo "Creating tag $NEXT_VERSION"
git tag "$NEXT_VERSION"
git push origin "$NEXT_VERSION"
15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,6 @@ for-all:
$${CMD} ); \
done

COMMIT?=HEAD
MODSET?=contrib-core
REMOTE?[email protected]:lumigo-io/lumigo-otel-collector-contrib.git
.PHONY: push-tags
push-tags: $(MULTIMOD)
$(MULTIMOD) verify
set -e; for tag in `$(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} --print-tags | grep -v "Using" `; do \
echo "pushing tag $${tag}"; \
git push ${REMOTE} $${tag}; \
done;

# Define a delegation target for each module
.PHONY: $(ALL_MODS)
$(ALL_MODS):
Expand Down Expand Up @@ -254,12 +243,12 @@ multimod-verify: $(MULTIMOD)

.PHONY: multimod-prerelease
multimod-prerelease: $(MULTIMOD)
$(MULTIMOD) prerelease -s=true -b=false -v ./versions.yaml -m contrib-base
$(MULTIMOD) prerelease -s=true -b=false -v ./versions.yaml -m lumigo-custom
$(MAKE) gotidy

.PHONY: multimod-sync
multimod-sync: $(MULTIMOD)
$(MULTIMOD) sync -a=true -s=true -o ../opentelemetry-collector-contrib
$(MULTIMOD) sync -a=true -s=true -o ../lumigo-otel-collector-contrib
$(MAKE) gotidy

.PHONY: crosslink
Expand Down
2 changes: 1 addition & 1 deletion versions.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module-sets:
contrib-base:
lumigo-custom:
version: v0.97.0
modules:
- github.com/lumigo-io/lumigo-otel-collector-contrib
Expand Down

0 comments on commit d2d0367

Please sign in to comment.