Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/build-and-push-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ on:
type: boolean
default: true
description: "Whether to push the image"
output_directory:
type: string
default: .
make_target_prefix:
type: string
default: ""

env:
DOCKERHUB_REPO: ${{ inputs.repo }}
Expand All @@ -50,19 +44,19 @@ jobs:
cache-name: cache-${{ inputs.image_name }}
with:
path: |
${{ inputs.output_directory }}/${{ inputs.image_name }}.tar
${{ inputs.image_name }}.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}

- name: Load built image
if: ${{ inputs.cache && steps.cache-image.outputs.cache-hit == 'true' }}
run: |
make ${{ inputs.make_target_prefix }}load.${{ inputs.image_name }}
make load.${{ inputs.image_name }}

- name: Build image
if: ${{ !inputs.cache || steps.cache-image.outputs.cache-hit != 'true' }}
run: |
make ${{ inputs.make_target_prefix }}build.${{ inputs.image_name }}
make ${{ inputs.make_target_prefix }}save.${{ inputs.image_name }}
make build.${{ inputs.image_name }}
make save.${{ inputs.image_name }}

- name: Log in to Docker Hub
uses: docker/login-action@v3.1.0
Expand All @@ -74,5 +68,5 @@ jobs:
- name: Push image
if: ${{ inputs.push && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |
make ${{ inputs.make_target_prefix }}tag.${{ inputs.image_name }}
make ${{ inputs.make_target_prefix }}push.${{ inputs.image_name }}
make tag.${{ inputs.image_name }}
make push.${{ inputs.image_name }}
27 changes: 9 additions & 18 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,9 @@ on:
cache_requirements:
type: boolean
default: true
output_directory:
type: string
default: .
reqs_cache_key:
type: string
required: false
cache_file:
type: string
default: "requirements.txt"
make_target_prefix:
type: string
default: ""

env:
AR_REPO: ${{ inputs.repo }}
Expand Down Expand Up @@ -57,8 +48,8 @@ jobs:
cache-name: ${{ inputs.repo }}-requirements
with:
path: |
${{ inputs.output_directory }}/requirements.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.reqs_cache_key || format('{0}-{1}', hashFiles(format('{0}/**/{1}', inputs.output_directory, inputs.cache_file)), hashFiles(format('{0}/**/docker/Dockerfile.requirements', inputs.output_directory))) }}
requirements.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ format('{0}-{1}', hashFiles(format('./**/{1}', inputs.cache_file)), hashFiles('./**/docker/Dockerfile.requirements')) }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-

Expand All @@ -69,25 +60,25 @@ jobs:
cache-name: ${{ inputs.repo }}-app
with:
path: |
${{ inputs.output_directory }}/app.tar
app.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}

- name: Load requirements from cache
if: ${{ steps.cache-requirements.outputs.cache-hit == 'true' && inputs.cache_requirements }}
run: |
make ${{ inputs.make_target_prefix }}load.requirements
make load.requirements

- name: Build/pull requirements
if: ${{ steps.cache-requirements.outputs.cache-hit != 'true' && inputs.cache_requirements }}
run: |
make ${{ inputs.make_target_prefix }}build.requirements
make ${{ inputs.make_target_prefix }}save.requirements
make build.requirements
make save.requirements

- name: Push Requirements
if: ${{ steps.cache-requirements.outputs.cache-hit != 'true' && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' && inputs.cache_requirements }}
run: |
make ${{ inputs.make_target_prefix }}push.requirements
make push.requirements
- name: Build app
run: |
make ${{ inputs.make_target_prefix }}build.app
make ${{ inputs.make_target_prefix }}save.app
make build.app
make save.app
8 changes: 2 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: Run Lint

on:
workflow_call:
inputs:
make_target_prefix:
type: string
default: ""

jobs:
lint:
Expand All @@ -17,6 +13,6 @@ jobs:
with:
submodules: 'recursive'
- name: Install dependencies
run: make ${{ inputs.make_target_prefix }}lint.install
run: make lint.install
- name: Check
run: make ${{ inputs.make_target_prefix }}lint.check
run: make lint.check
35 changes: 14 additions & 21 deletions .github/workflows/push-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ on:
type: boolean
default: false
description: "Whether to push the release image"
output_directory:
type: string
default: .
make_target_prefix:
type: string
default: ""
sentry_project:
type: string
required: false
Expand Down Expand Up @@ -58,11 +52,11 @@ jobs:
cache-name: ${{ inputs.repo }}-app
with:
path: |
${{ inputs.output_directory }}/app.tar
app.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
- name: Load built image
run: |
docker load --input ${{ inputs.output_directory }}/app.tar
docker load --input app.tar
- id: "auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v2.1.2"
Expand All @@ -77,13 +71,13 @@ jobs:

- name: Push ${{ inputs.environment }}
run: |
make ${{ inputs.make_target_prefix }}tag.${{ inputs.environment }}
make ${{ inputs.make_target_prefix }}push.${{ inputs.environment }}
make tag.${{ inputs.environment }}
make push.${{ inputs.environment }}
- name: Push latest
if: inputs.environment == 'production'
run: |
make ${{ inputs.make_target_prefix }}tag.latest
make ${{ inputs.make_target_prefix }}push.latest
make tag.latest
make push.latest

- name: Create Sentry release
if: inputs.create_sentry_release
Expand All @@ -96,7 +90,6 @@ jobs:
environment: ${{ inputs.environment }}
version: ${{ inputs.environment }}-release-${{ steps.sha.outputs.short_sha }}
ignore_missing: true
output_directory: ${{ inputs.output_directory }}
rolling:
name: Push Rolling Image
if: inputs.push_rolling == true && github.repository_owner == 'codecov' && !github.event.pull_request.head.repo.fork
Expand All @@ -114,20 +107,20 @@ jobs:
cache-name: ${{ inputs.repo }}-app
with:
path: |
${{ inputs.output_directory }}/app.tar
app.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
- name: Load built image
run: |
docker load --input ${{ inputs.output_directory }}/app.tar
docker load --input app.tar
- name: Log in to Docker Hub
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.CODECOV_DEVOPS_DOCKER_USERNAME }}
password: ${{ secrets.CODECOV_DEVOPS_DOCKER_PASSWORD }}
- name: Push Rolling
run: |
make ${{ inputs.make_target_prefix }}tag.rolling
make ${{ inputs.make_target_prefix }}push.rolling
make tag.rolling
make push.rolling
release:
name: Push Release Image
if: inputs.push_release == true && github.repository_owner == 'codecov' && !github.event.pull_request.head.repo.fork
Expand All @@ -145,17 +138,17 @@ jobs:
cache-name: ${{ inputs.repo }}-app
with:
path: |
${{ inputs.output_directory }}/app.tar
app.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
- name: Load built image
run: |
docker load --input ${{ inputs.output_directory }}/app.tar
docker load --input app.tar
- name: Log in to Docker Hub
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.CODECOV_DEVOPS_DOCKER_USERNAME }}
password: ${{ secrets.CODECOV_DEVOPS_DOCKER_PASSWORD }}
- name: Push release
run: |
make ${{ inputs.make_target_prefix }}tag.release
make ${{ inputs.make_target_prefix }}push.release
make tag.release
make push.release
48 changes: 17 additions & 31 deletions .github/workflows/run-tests-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ on:
type: number
required: false
default: 5
flag_prefix:
type: string
default: ''
output_directory:
type: string
default: .
make_target_prefix:
type: string
default: ""
pytest_rootdir:
type: string
default: .
outputs:
tests_passed:
# Silly issue with returning job results as workflow outputs
Expand Down Expand Up @@ -73,41 +61,41 @@ jobs:
cache-name: ${{ inputs.repo }}-app
with:
path: |
${{ inputs.output_directory }}/app.tar
app.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
- name: Load built image
run: |
docker load --input ${{ inputs.output_directory }}/app.tar
docker load --input app.tar
- name: Install docker compose
run: |
sudo curl -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Bring test env up
run: |
make ${{ inputs.make_target_prefix }}test_env.up
make test_env.up
- name: Prepare for tests
run: |
make ${{ inputs.make_target_prefix }}test_env.prepare
make ${{ inputs.make_target_prefix }}test_env.check_db
make test_env.prepare
make test_env.check_db
- name: Run unit tests
run: |
make ${{ inputs.make_target_prefix }}test_env.run_unit GROUP=${{ matrix.group }} SPLIT=${{ inputs.split }} PYTEST_ROOTDIR=${{ inputs.pytest_rootdir }}
make test_env.run_unit GROUP=${{ matrix.group }} SPLIT=${{ inputs.split }}
- name: Run integration tests
if: inputs.run_integration == true
run: |
make ${{ inputs.make_target_prefix }}test_env.run_integration GROUP=${{ matrix.group }} SPLIT=${{ inputs.split }} PYTEST_ROOTDIR=${{ inputs.pytest_rootdir }}
make test_env.run_integration GROUP=${{ matrix.group }} SPLIT=${{ inputs.split }}

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: ${{ inputs.flag_prefix }}-coveragefiles-${{ matrix.group }}
path: ${{ inputs.output_directory }}/*.coverage.xml
name: coveragefiles-${{ matrix.group }}
path: *.coverage.xml

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: ${{ inputs.flag_prefix }}-junitfiles-${{ matrix.group }}
path: ${{ inputs.output_directory }}/*junit*.xml
name: junitfiles-${{ matrix.group }}
path: *junit*.xml

upload:
name: Upload to Codecov
Expand Down Expand Up @@ -140,21 +128,21 @@ jobs:
id: download_coverage
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.flag_prefix }}-coveragefiles-*
pattern: coveragefiles-*
merge-multiple: true

- name: Download test results
id: download_test_results
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.flag_prefix }}-junitfiles-*
pattern: junitfiles-*
merge-multiple: true

- name: Uploading unit test coverage (${{ matrix.name }})
uses: codecov/codecov-action@v5
with:
files: ${{ steps.download_coverage.outputs.download-path }}/unit.*.coverage.xml
flags: ${{ format('{0}unit', inputs.flag_prefix) }}
flags: unit
disable_search: true
# Strange workaround: API has a `codecov` directory in the repo root
# which conflicts with the action's `codecov` binary
Expand All @@ -168,7 +156,7 @@ jobs:
uses: codecov/codecov-action@v5
with:
files: ${{ steps.download_coverage.outputs.download-path }}/integration.*.coverage.xml
flags: ${{ format('{0}integration', inputs.flag_prefix) }}
flags: integration
disable_search: true
# Strange workaround: API has a `codecov` directory in the repo root
# which conflicts with the action's `codecov` binary
Expand All @@ -195,25 +183,23 @@ jobs:
uses: codecov/test-results-action@v1
with:
files: ${{ steps.junit_files.outputs.unit_junit_files }}
flags: ${{ format('{0}unit', inputs.flag_prefix) }}
flags: unit
disable_search: true
token: ${{ secrets[matrix.codecov_token_secret] }}
url: ${{ secrets[matrix.codecov_url_secret] }}
# The coverage action will have installed codecovcli with pip. The
# actual binary will be found in $PATH.
binary: codecovcli
working-directory: ${{ inputs.output_directory }}

- name: Uploading integration test results (${{ matrix.name }})
if: ${{ inputs.run_integration == true }}
uses: codecov/test-results-action@v1
with:
files: ${{ steps.junit_files.outputs.integration_junit_files }}
flags: ${{ format('{0}integration', inputs.flag_prefix) }}
flags: integration
disable_search: true
token: ${{ secrets[matrix.codecov_token_secret] }}
url: ${{ secrets[matrix.codecov_url_secret] }}
# The coverage action will have installed codecovcli with pip. The
# actual binary will be found in $PATH.
binary: codecovcli
working-directory: ${{ inputs.output_directory }}
Loading
Loading