Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm committed Oct 4, 2024
1 parent 6b71e87 commit 85fe998
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ on:
description: 'The token to use to deploy the coverage report'
required: true

env:
EVEREST_CI_VERSION: v1.3.1

jobs:
lint:
name: Lint Repository
Expand All @@ -193,7 +190,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: everest/everest-ci
ref: ${{ needs.setup-env.outputs.sha_reusable_workflow }}
ref: ${{ needs.setup-env.outputs.sha_everest_ci }}
path: everest-ci
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -211,9 +208,9 @@ jobs:
name: Setup Environment
runs-on: ${{ inputs.runner }}
outputs:
everest_ci_version: ${{ env.EVEREST_CI_VERSION }}
workflow_path: ${{ steps.set_workflow_path.outputs.workflow_path }}
sha_reusable_workflow: ${{ steps.set_sha_reusable_workflow.outputs.sha }}
sha_everest_ci: ${{ steps.set_sha_everest_ci.outputs.sha }}
tag_everest_ci: ${{ steps.set_tag_everest_ci.outputs.latest_tag }}
steps:
- name: Determine workflow_path
id: set_workflow_path
Expand All @@ -225,11 +222,32 @@ jobs:
f.write(f"workflow_path={workflow_path}\n")
print(f"Set output workflow_path to {workflow_path}")
- name: Determine SHA of the reusable workflow
id: set_sha_reusable_workflow
id: set_sha_everest_ci
uses: canonical/[email protected]
with:
repository-name: everest/everest-ci
file-name: continuous_integration.yml
- name: Determine latest tag of everest-ci
id: set_tag_everest_ci
run: |
TARGET_SHA="${{ steps.set_sha_everest_ci.outputs.sha }}"
OWNER="everest"
REPO="everest-ci"
COMMITS=$(gh api repos/$OWNER/$REPO/commits?sha=$TARGET_SHA\&per_page=100 --jq '.[].sha')
for COMMIT in $COMMITS; do
TAG=$(gh api repos/$OWNER/$REPO/tags --jq '.[] | select(.commit.sha == "'$COMMIT'") | .name')
if [ -n "$TAG" ]; then
break
fi
done
if [ -z "$TAG" ]; then
echo "No tag found for commit $TARGET_SHA (only last 100 commits were checked)"
exit 1
fi
echo "latest_tag=$TAG" >> $GITHUB_OUTPUT
build-and-push-build-kit:
name: Build and Push Build Kit
Expand All @@ -253,7 +271,7 @@ jobs:
${{ inputs.build_kit_scripts_directory }}
${{ needs.setup-env.outputs.workflow_path }}
build_args: |
BASE_IMAGE_TAG=${{ needs.setup-env.outputs.everest_ci_version }}
BASE_IMAGE_TAG=${{ needs.setup-env.outputs.tag_everest_ci }}
build:
name: Build, Unit Tests and Install
Expand All @@ -268,7 +286,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: everest/everest-ci
ref: ${{ needs.setup-env.outputs.sha_reusable_workflow }}
ref: ${{ needs.setup-env.outputs.sha_everest_ci }}
path: everest-ci
- name: Format branch name for cache key
if: ${{ inputs.use_build_cache == 'true' }}
Expand Down Expand Up @@ -467,7 +485,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: everest/everest-ci
ref: ${{ needs.setup-env.outputs.sha_reusable_workflow }}
ref: ${{ needs.setup-env.outputs.sha_everest_ci }}
path: everest-ci
- name: Download xml coverage report
uses: actions/[email protected]
Expand Down

0 comments on commit 85fe998

Please sign in to comment.