Skip to content

Commit

Permalink
ci: consolidate workflows into fewer pieces (akash-network#119)
Browse files Browse the repository at this point in the history
- combine all test and check build workflows into single
- trigger release if pushed by tag and all tests pass

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored Jun 8, 2023
1 parent 3ecd221 commit 846c36a
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 35 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/cron-integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Integration tests on schedule

on:
schedule:
- cron: '0 */12 * * *'

jobs:
call-integration-tests:
uses: ./.github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
name: tests
name: Integration tests

on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 */12 * * *'
workflow_call:

env:
KUBE_SSH_NODE_NAME: kind
Expand Down
29 changes: 1 addition & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,11 @@ defaults:
shell: bash

on:
push:
tags:
- v*
workflow_dispatch:

jobs:
ensure-dry-run:
runs-on: ubuntu-latest
steps:
- name: Ensure release/dry-run PASS
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'dry-run'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
allowed-conclusions: success
ensure-tests:
runs-on: ubuntu-latest
steps:
- name: Ensure tests PASS
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'tests'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
allowed-conclusions: success
publish:
runs-on: ubuntu-latest
needs:
- ensure-dry-run
- ensure-tests
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: tests

defaults:
run:
shell: bash

on:
pull_request:
push:
branches:
- main
tags:
- v*

jobs:
build-bins:
Expand Down Expand Up @@ -60,6 +66,32 @@ jobs:
- name: lint make-sublinters
run: make test-sublinters

release-dry-run:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: fregante/setup-git-user@v1
- name: configure git tag
run: echo "RELEASE_TAG=v$(./script/semver.sh bump patch $(git describe --tags --abbrev=0))" >> $GITHUB_ENV
- name: git tag
run: git tag -a ${{ env.RELEASE_TAG }} -m ${{ env.RELEASE_TAG }}
- name: release dry-run
run: make release

coverage:
runs-on: ubuntu-latest
steps:
Expand All @@ -77,3 +109,43 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: .cache/tests/coverage.txt

yamlcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: check-yml-count
run: |
if [[ $(git ls-files '*.yml' ':!:.codecov.yml' | wc -l) -ne 0 ]]; then git ls-files '*.yml' ':!:.codecov.yml' && exit 1;fi
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- run: make shellcheck

integration-tests:
uses: ./.github/workflows/integration-tests.yaml

dispatch-release:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/v')
needs:
- build-bins
- tests
- lint
- release-dry-run
- coverage
- yamlcheck
- shellcheck
- integration-tests
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: trigger release process
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release.yaml

0 comments on commit 846c36a

Please sign in to comment.