-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updates CI * updates CI * updates CI * updates CI * updates CI * updates CI * updates CI * updates CI * updates CI
- Loading branch information
Showing
5 changed files
with
153 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
name: 'Calculate version hash' | ||
description: 'Calculate deps and os hash' | ||
inputs: | ||
files: | ||
description: 'Files to use to calculate the hash' | ||
required: true | ||
default: "pdm.lock docker/bin/* docker/conf/* docker/Dockerfile" | ||
outputs: | ||
hash: # id of output | ||
description: 'The time we greeted you' | ||
value: ${{ steps.calc.outputs.hash }} | ||
|
||
runs: | ||
using: 'composite' | ||
# args: | ||
# - ${{ inputs.files }} | ||
steps: | ||
- name: Calculate release hash | ||
id: calc | ||
shell: bash --noprofile --norc -eo pipefail -ux {0} | ||
run: | | ||
LOCK_SHA=$(echo sha1sum ${{ inputs.files }} | sha1sum | awk '{print $1}' | cut -c 1-8) | ||
echo "hash=$LOCK_SHA" >> "$GITHUB_OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# ref: https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
name: 'Che cif image exists in dockerhub' | ||
description: 'Calculate deps and os hash' | ||
inputs: | ||
image: | ||
description: 'Docker Image ' | ||
required: true | ||
username: | ||
description: 'DockerHub username ' | ||
required: true | ||
password: | ||
description: 'DockerHub password ' | ||
required: true | ||
|
||
outputs: | ||
exists: | ||
description: 'The time we greeted you' | ||
value: ${{ steps.check.outputs.exixts }} | ||
|
||
runs: | ||
using: 'composite' | ||
# args: | ||
# - ${{ inputs.files }} | ||
steps: | ||
- name: DockerHub login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ inputs.username }} | ||
password: ${{ inputs.password }} | ||
- name: Check Image Exists | ||
id: check | ||
continue-on-error: true | ||
shell: bash --noprofile --norc -eo pipefail -ux {0} | ||
run: | | ||
set +e | ||
exists=$(docker manifest inspect ${{inputs.image}} > /dev/null 2>&1 && echo "exists" || echo "not_found") | ||
if [ $exists = "exists" ];then | ||
echo "exists=true" >> "$GITHUB_OUTPUT" | ||
echo "Image ${{inputs.image}} found" | ||
else | ||
echo "exists=false" >> "$GITHUB_OUTPUT" | ||
echo "Image ${{inputs.image}} does not exist" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
workflow_run: | ||
workflows: [ci] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: unicef/hope-support-images:hde-dev-latest | ||
credentials: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
ports: | ||
- 8000:8000 | ||
services: | ||
redis: | ||
image: redis | ||
db: | ||
image: postgres:14 | ||
env: | ||
POSTGRES_DATABASE: dedupe | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USERNAME: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
env: | ||
DATABASE_URL: postgres://postgres:postgres@db:5432/dedupe | ||
SECRET_KEY: secret_key | ||
CACHE_URL: redis://redis:6379/0 | ||
CELERY_BROKER_URL: redis://redis:6379/0 | ||
PYTHONPATH: "/hde/code/src:/hde/__pypackages__/3.12/lib" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run tests | ||
run: | | ||
pytest tests --create-db -v --cov --cov-report xml:coverage.xml | ||
# - name: Upload coverage to Codecov | ||
# uses: codecov/codecov-action@v4 | ||
# with: | ||
# directory: ./coverage/reports/ | ||
# env_vars: OS,PYTHON | ||
# fail_ci_if_error: true | ||
# files: /hde/code/coverage1.xml | ||
# flags: unittests | ||
# name: codecov-umbrella | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
# verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters