Skip to content

Commit

Permalink
Merge pull request #125 from codecov/feature/ci-consolidate
Browse files Browse the repository at this point in the history
Feature/ci consolidate
  • Loading branch information
trent-codecov committed Sep 29, 2023
2 parents 25855a7 + a21af00 commit 6bd9b58
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ concurrency:
jobs:
lint:
name: Run Lint
uses: codecov/gha-workflows/.github/workflows/lint.yml@main
uses: codecov/gha-workflows/.github/workflows/lint.yml@v1.0.0

build:
name: Build Worker
uses: codecov/gha-workflows/.github/workflows/build-app.yml@main
uses: codecov/gha-workflows/.github/workflows/build-app.yml@v1.0.0
secrets: inherit
with:
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-worker' }}
Expand All @@ -34,30 +34,30 @@ jobs:
codecovstartup:
name: Codecov Startup
needs: build
uses: codecov/gha-workflows/.github/workflows/codecov-startup.yml@main
uses: codecov/gha-workflows/.github/workflows/codecov-startup.yml@v1.0.0
secrets: inherit

ats:
name: ATS
needs: [build, codecovstartup]
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/run-ats.yml@main
uses: codecov/gha-workflows/.github/workflows/run-ats.yml@v1.0.0
secrets: inherit
with:
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-worker' }}

test:
name: Test
needs: [build, codecovstartup]
uses: codecov/gha-workflows/.github/workflows/run-tests.yml@main
uses: codecov/gha-workflows/.github/workflows/run-tests.yml@v1.0.0
secrets: inherit
with:
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-worker' }}

build-self-hosted:
name: Build Self Hosted Worker
needs: [build, test]
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@main
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.0.0
secrets: inherit
with:
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-worker' }}
Expand All @@ -66,7 +66,7 @@ jobs:
name: Push Staging Image
needs: [build, test]
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/push-env.yml@main
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.0.0
secrets: inherit
with:
environment: staging
Expand All @@ -76,7 +76,7 @@ jobs:
name: Push Production Image
needs: [ build, test ]
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/production') && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/push-env.yml@main
uses: codecov/gha-workflows/.github/workflows/push-env.yml@v1.0.0
secrets: inherit
with:
environment: production
Expand All @@ -87,7 +87,7 @@ jobs:
needs: [ build-self-hosted, test ]
secrets: inherit
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/production') && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@main
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.0.0
with:
push_rolling: true
repo: ${{ vars.CODECOV_IMAGE_V2 || 'codecov/self-hosted-worker' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/self-hosted-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ on:
jobs:
create-release-pr:
name: Create PR for Release ${{ github.event.inputs.versionName }}
uses: codecov/gha-workflows/.github/workflows/create-self-hosted-pr.yml@main
uses: codecov/gha-workflows/.github/workflows/create-self-hosted-pr.yml@v1.0.0
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/self-hosted-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
create-release:
name: Tag Release ${{ github.head_ref }} and Push Docker image to Docker Hub
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/create-self-hosted-release.yml@main
uses: codecov/gha-workflows/.github/workflows/create-self-hosted-release.yml@v1.0.0
secrets: inherit

push-image:
needs: [create-release]
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'codecov' }}
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@main
uses: codecov/gha-workflows/.github/workflows/self-hosted.yml@v1.0.0
secrets: inherit
with:
push_release: true
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ build.app:
--build-arg BUILD_ENV=cloud

build.self-hosted:
make build.self-hosted-base
make build.self-hosted-runtime

build.self-hosted-base:
docker build -f docker/Dockerfile . \
-t ${DOCKERHUB_REPO}:latest-no-dependencies \
-t ${DOCKERHUB_REPO}:${VERSION}-no-dependencies \
Expand Down Expand Up @@ -126,7 +130,7 @@ tag.self-hosted-rolling:
docker tag ${DOCKERHUB_REPO}:${VERSION}-no-dependencies ${DOCKERHUB_REPO}:rolling_no_dependencies
docker tag ${DOCKERHUB_REPO}:${VERSION} ${DOCKERHUB_REPO}:rolling

tag.self-hosted:
tag.self-hosted-release:
docker tag ${DOCKERHUB_REPO}:${VERSION}-no-dependencies ${DOCKERHUB_REPO}:${release_version}_no_dependencies
docker tag ${DOCKERHUB_REPO}:${VERSION}-no-dependencies ${DOCKERHUB_REPO}:latest_calver_no_dependencies
docker tag ${DOCKERHUB_REPO}:${VERSION}-no-dependencies ${DOCKERHUB_REPO}:latest_stable_no_dependencies
Expand All @@ -138,6 +142,10 @@ load.requirements:
docker load --input requirements.tar
docker tag codecov/worker-ci-requirements:${REQUIREMENTS_TAG} ${AR_REPO}:${REQUIREMENTS_TAG}

load.self-hosted:
docker load --input self-hosted-runtime.tar
docker load --input self-hosted.tar

save.app:
docker save -o app.tar ${AR_REPO}:${VERSION}

Expand All @@ -146,6 +154,10 @@ save.requirements:
docker save -o requirements.tar codecov/worker-ci-requirements:${REQUIREMENTS_TAG}

save.self-hosted:
make save.self-hosted-base
make save.self-hosted-runtime

save.self-hosted-base:
docker save -o self-hosted.tar ${DOCKERHUB_REPO}:${VERSION}-no-dependencies

save.self-hosted-runtime:
Expand All @@ -163,7 +175,7 @@ push.production:
push.requirements:
docker push ${AR_REPO}:${REQUIREMENTS_TAG}

push.self-hosted:
push.self-hosted-release:
docker push ${DOCKERHUB_REPO}:${release_version}_no_dependencies
docker push ${DOCKERHUB_REPO}:latest_calver_no_dependencies
docker push ${DOCKERHUB_REPO}:latest_stable_no_dependencies
Expand Down

0 comments on commit 6bd9b58

Please sign in to comment.