Skip to content

Commit

Permalink
Reorganize workflows and Add tests (#4)
Browse files Browse the repository at this point in the history
Reorganize workflows and Add tests
  • Loading branch information
OrioQuezac authored Dec 1, 2023
1 parent 937fa99 commit 0ff0018
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 21 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: build
run-name: Build Artifacts
on:
push:
tags:
- v*
on: workflow_call
jobs:
build-artifacts:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -71,20 +68,3 @@ jobs:
path: |
*_amd64.deb
*.x86_64.rpm
release:
runs-on: ubuntu-latest
needs: nfpm
steps:
- name: Download Prometheus Artifacts
uses: actions/download-artifact@v3
with:
name: packages

- name: Upload to release
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.deb
*.rpm
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: release
run-name: Release Packages
on:
push:
tags:
- v*
jobs:
build-packages-workflow:
uses: ./.github/workflows/build.yml

release:
runs-on: ubuntu-latest
needs: build-packages-workflow
steps:
- name: Download Prometheus Artifacts
uses: actions/download-artifact@v3
with:
name: packages

- name: Upload to release
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.deb
*.rpm
85 changes: 85 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: test
run-name: Test Packages
on: push
jobs:
build-packages-workflow:
uses: ./.github/workflows/build.yml

deb-packages:
runs-on: ubuntu-latest
needs: build-packages-workflow
container:
image: debian:latest
options: --cpus 1
steps:
- name: Download Prometheus Artifacts
uses: actions/download-artifact@v3
with:
name: packages

- name: Install curl
run: apt-get update; apt install -y curl

- name: Install DEB packages
run: dpkg -i *.deb

- name: Start Prometheus
run: |
/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/data \
--web.console.templates=/var/lib/prometheus/consoles \
--web.console.libraries=/var/lib/prometheus/console_libraries \
--web.enable-lifecycle &>/dev/null &
- name: Check Prometheus
run: curl http://localhost:9090/-/healthy

- name: Start node_exporter
run: /usr/bin/node_exporter &>/dev/null &

- name: Check node_exporter
run: curl -I http://localhost:9100/metrics

- name: Start postgres_exporter
run: /usr/bin/postgres_exporter &>/dev/null &

- name: Check postgres_exporter
run: curl -I http://localhost:9187/metrics

rpm-packages:
runs-on: ubuntu-latest
needs: build-packages-workflow
container:
image: rockylinux:8
options: --cpus 1
steps:
- name: Download Prometheus Artifacts
uses: actions/download-artifact@v3
with:
name: packages

- name: Install RPM packages
run: dnf localinstall -y *.x86_64.rpm

- name: Start Prometheus
run: |
/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/data \
--web.console.templates=/var/lib/prometheus/consoles \
--web.console.libraries=/var/lib/prometheus/console_libraries \
--web.enable-lifecycle &>/dev/null &
- name: Check Prometheus
run: curl http://localhost:9090/-/healthy

- name: Start node_exporter
run: /usr/bin/node_exporter &>/dev/null &

- name: Check node_exporter
run: curl -I http://localhost:9100/metrics

- name: Start postgres_exporter
run: /usr/bin/postgres_exporter &>/dev/null &

- name: Check postgres_exporter
run: curl -I http://localhost:9187/metrics

0 comments on commit 0ff0018

Please sign in to comment.