Skip to content

Commit

Permalink
update gha workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanotorresi committed Dec 16, 2024
1 parent eec6b6d commit 678d177
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 86 deletions.
43 changes: 20 additions & 23 deletions .github/workflows/dashboards-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ on:
push:
branches: [main]
paths:
- 'Makefile'
- 'dashboards/**'
- 'packaging/obs/grafana-ha-cluster-dashboards/**'
- '.github/workflows/dashboards*'
- "Makefile"
- "dashboards/**"
- "packaging/obs/grafana-ha-cluster-dashboards/**"
- ".github/workflows/dashboards*"
pull_request:
paths:
- 'Makefile'
- 'dashboards/**'
- 'packaging/obs/grafana-ha-cluster-dashboards/**'
- '.github/workflows/dashboards*'
- "Makefile"
- "dashboards/**"
- "packaging/obs/grafana-ha-cluster-dashboards/**"
- ".github/workflows/dashboards*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
- run: npm -g install jsonlint
- name: validate JSON
run: find dashboards -name "*.json" -type f -exec jsonlint -c {} \;
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
- run: npm -g install jsonlint
- name: validate JSON
run: find dashboards -name "*.json" -type f -exec jsonlint -c {} \;

obs-commit:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
container:
image: ghcr.io/trento-project/continuous-delivery:main
image: ghcr.io/trento-project/continuous-delivery:0.1.0
options: -u 0:0
env:
OBS_USER: ${{ secrets.OBS_USER }}
Expand All @@ -44,12 +44,9 @@ jobs:
REPOSITORY: ${{ github.repository }}
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- run: make dashboards-obs-commit
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: /scripts/init_osc_creds.sh
- run: make dashboards-obs-commit
118 changes: 55 additions & 63 deletions .github/workflows/exporter-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,52 @@ on:
push:
branches: [main]
paths-ignore:
- 'dashboards/**'
- 'packaging/obs/grafana-ha-cluster-dashboards/**'
- '.github/workflows/dashboards*'
- "dashboards/**"
- "packaging/obs/grafana-ha-cluster-dashboards/**"
- ".github/workflows/dashboards*"
pull_request:
paths-ignore:
- 'dashboards/**'
- 'packaging/obs/grafana-ha-cluster-dashboards/**'
- '.github/workflows/dashboards*'
- "dashboards/**"
- "packaging/obs/grafana-ha-cluster-dashboards/**"
- ".github/workflows/dashboards*"
workflow_dispatch:
release:
types: [ published ]
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
id: go
- name: static analysis
run: make static-checks
- name: test
run: make test
- name: build
run: make -j4 build-all
- name: compress
run: |
set -x
for FILE in build/bin/*; do
gzip $FILE
done
- uses: actions/upload-artifact@v3
with:
name: ha_cluster_exporter
path: build/bin
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
id: go
- name: static analysis
run: make static-checks
- name: test
run: make test
- name: build
run: make -j4 build-all
- name: compress
run: |
set -x
for FILE in build/bin/*; do
gzip $FILE
done
- uses: actions/upload-artifact@v3
with:
name: ha_cluster_exporter
path: build/bin

obs-commit:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
container:
image: ghcr.io/trento-project/continuous-delivery:main
image: ghcr.io/trento-project/continuous-delivery:0.1.0
options: -u 0:0
env:
OBS_USER: ${{ secrets.OBS_USER }}
Expand All @@ -65,23 +65,19 @@ jobs:
REPOSITORY: ${{ github.repository }}
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- run: git config --global --add safe.directory $(pwd)
- run: make exporter-obs-commit
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: /scripts/init_osc_creds.sh
- run: make exporter-obs-commit

obs-submit-request:
needs: build
if: github.event.release
runs-on: ubuntu-latest
container:
image: ghcr.io/trento-project/continuous-delivery:main
container:
image: ghcr.io/trento-project/continuous-delivery:0.1.0
options: -u 0:0
env:
OBS_USER: ${{ secrets.OBS_USER }}
Expand All @@ -93,29 +89,25 @@ jobs:
REPOSITORY: ${{ github.repository }}
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- run: git config --global --add safe.directory $(pwd)
- run: make exporter-obs-workdir
- run: make exporter-obs-changelog
- run: make exporter-obs-commit
- run: /scripts/submit.sh
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: /scripts/init_osc_creds.sh
- run: make exporter-obs-workdir
- run: make exporter-obs-changelog
- run: make exporter-obs-commit
- run: /scripts/submit.sh

github-release-assets:
needs: build
if: github.event.release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.1.7
with:
name: ha_cluster_exporter
- uses: softprops/action-gh-release@v1
with:
files: 'ha_cluster_exporter-*'
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4.1.7
with:
name: ha_cluster_exporter
- uses: softprops/action-gh-release@v1
with:
files: "ha_cluster_exporter-*"
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 678d177

Please sign in to comment.