Skip to content

Commit

Permalink
Test deb packages in CI (#100)
Browse files Browse the repository at this point in the history
* Reorganize workflows to fail fast

* General maintenance on workflows

Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri authored Jun 25, 2024
1 parent 3501e0b commit bd6d37a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ jobs:
contents: write

test-e2e:
needs: [test-lint]
needs: [test-lint, test-unit]
uses: ./.github/workflows/step_tests-e2e.yml

build:
needs: [test-lint, test-unit, test-e2e]
needs: [test-lint, test-unit]
uses: ./.github/workflows/step_build.yml

packaging:
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/step_packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,26 @@ jobs:
with:
name: build-go-artifacts

- name: Get version
id: vars
run: |
if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF_TYPE}" == "tag" ]]; then
REF_NAME=$(echo "${GITHUB_REF_NAME//\//-}")
CEEMS_VERSION=$(echo "${REF_NAME//v}")
echo "version=${CEEMS_VERSION}" >> $GITHUB_OUTPUT
else
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
fi
echo "goos=linux" >> $GITHUB_OUTPUT
# Build RPM and DEB packages
- name: Build deb and rpm packages
run: |
# Replace any '/' with '-' for non tag workflows
export REF_NAME=$(echo "${GITHUB_REF_NAME//\//-}")
# Strip v from tag name, eg v0.1.0 -> 0.1.0
export CEEMS_VERSION=$(echo "${REF_NAME//v}")
export GOOS=linux
# # Replace any '/' with '-' for non tag workflows
# export REF_NAME=$(echo "${GITHUB_REF_NAME//\//-}")
# # Strip v from tag name, eg v0.1.0 -> 0.1.0
# export CEEMS_VERSION=$(echo "${REF_NAME//v}")
# export GOOS=linux
# Ensure target directory exists
mkdir -p .tarballs
Expand All @@ -44,13 +56,25 @@ jobs:
for arch in amd64 arm64; do
for packager in rpm deb; do
for app in ceems_exporter ceems_api_server ceems_lb; do
GOARCH=${arch} nfpm pkg --config build/package/${app}/nfpm.yml --packager ${packager} --target .tarballs/${app}-${CEEMS_VERSION}-${GOOS}-${arch}.${packager}
GOARCH=${arch} nfpm pkg --config build/package/${app}/nfpm.yml --packager ${packager} --target .tarballs/${app}-${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.goos }}-${arch}.${packager}
done
done
done
- name: Test deb packages
run: |
# Install all CEEMS components
for app in ceems_exporter ceems_api_server ceems_lb; do
GOARCH=amd64 sudo apt-get install ./.tarballs/${app}-${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.goos }}-amd64.deb
done
# Test systemd service of each CEEMS component
for app in ceems_exporter ceems_api_server ceems_lb; do
systemctl is-active --quiet "${app}.service" && echo "${app}" is running
done
- name: Upload release artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: .tarballs
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/step_tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
with:
go-version: 1.21.x

- name: Install promu
run: |
make promu
go mod download
- name: Run e2e tests for Go packages
run: make test-e2e

Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/step_tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
with:
go-version: 1.21.x

- name: Install promu
run: |
make promu
go mod download
- name: Run checkmetrics and checkrules
run: make checkmetrics checkrules

Expand Down

0 comments on commit bd6d37a

Please sign in to comment.