Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
c8b70289
Commit
c8b70289
authored
Mar 10, 2025
by
Harrison Saturley-Hall
Committed by
GitHub
Mar 10, 2025
Browse files
ci: start using ECR for container caches (#77)
parent
07afe3c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
.github/workflows/pre-merge-python.yml
.github/workflows/pre-merge-python.yml
+17
-12
No files found.
.github/workflows/pre-merge-python.yml
View file @
c8b70289
...
...
@@ -35,40 +35,45 @@ jobs:
name
:
Build and Test - ${{ matrix.framework }}
env
:
CONTAINER_ID
:
test_${{ github.run_id }}_${{ github.run_attempt }}_${{ github.job }}_${{ matrix.framework }}
IMAGE_TAG
:
ghcr.io/${{ github.repository }}:latest-${{ matrix.framework }}
PYTEST_XML_FILE
:
pytest_test_report.xml
steps
:
-
name
:
Checkout repository
uses
:
actions/checkout@v4
-
name
:
Set up Docker Buildx
uses
:
docker/setup-buildx-action@v3
-
name
:
Login to GitHub Container Registry
uses
:
docker/login-action
@v
3
-
name
:
Configure AWS credentials
uses
:
aws-actions/configure-aws-credentials
@v
4
with
:
registry
:
ghcr.io
username
:
${{ github.actor }}
password
:
${{ secrets.GITHUB_TOKEN }}
aws-access-key-id
:
${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key
:
${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region
:
${{ secrets.AWS_DEFAULT_REGION }}
-
name
:
Login to Amazon ECR
id
:
login-ecr
uses
:
aws-actions/amazon-ecr-login@v2
-
name
:
Define Image Tag
id
:
define_image_tag
run
:
|
echo "image_tag=${{ steps.login-ecr.outputs.registry }}/${{ github.repository }}:latest-${{ matrix.framework }}" >> $GITHUB_OUTPUT
-
name
:
Decide on cache
id
:
which_caches
run
:
|
set +e
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "Not pushing to container image cache"
echo "cache_to_location=" >> $GITHUB_OUTPUT
else
echo "Pushing ${{
env.IMAGE_TAG
}} to container image cache"
echo "cache_to_location=--cache-to \"type=registry,ref=${{
env.IMAGE_TAG
}},image-manifest=true,mode=max\"" >> $GITHUB_OUTPUT
echo "Pushing ${{
steps.define_image_tag.outputs.image_tag
}} to container image cache"
echo "cache_to_location=--cache-to \"type=registry,ref=${{
steps.define_image_tag.outputs.image_tag
}},image-manifest=true,mode=max\"" >> $GITHUB_OUTPUT
fi
echo "cache_from_location=--cache-from \"type=registry,ref=${{
env.IMAGE_TAG
}}\"" >> $GITHUB_OUTPUT
echo "cache_from_location=--cache-from \"type=registry,ref=${{
steps.define_image_tag.outputs.image_tag
}}\"" >> $GITHUB_OUTPUT
-
name
:
Build image
run
:
|
./container/build.sh --tag ${{
env.IMAGE_TAG
}} --framework ${{ matrix.framework }} ${{ steps.which_caches.outputs.cache_from_location }} ${{ steps.which_caches.outputs.cache_to_location }}
./container/build.sh --tag ${{
steps.define_image_tag.outputs.image_tag
}} --framework ${{ matrix.framework }} ${{ steps.which_caches.outputs.cache_from_location }} ${{ steps.which_caches.outputs.cache_to_location }}
-
name
:
Run pytest
env
:
PYTEST_MARKS
:
"
pre_merge
or
mypy"
run
:
|
docker run -w /workspace --name ${{ env.CONTAINER_ID }} ${{
env.IMAGE_TAG
}} pytest --basetemp=/tmp --junitxml=${{ env.PYTEST_XML_FILE }} -m "${{ env.PYTEST_MARKS }}"
docker run -w /workspace --name ${{ env.CONTAINER_ID }} ${{
steps.define_image_tag.outputs.image_tag
}} pytest --basetemp=/tmp --junitxml=${{ env.PYTEST_XML_FILE }} -m "${{ env.PYTEST_MARKS }}"
-
name
:
Copy test report from test Container
if
:
always()
run
:
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment