Skip to content

Commit

Permalink
Collapse self-hosted into ci
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Nov 24, 2024
1 parent 2ad942d commit 4b5346e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
File renamed without changes.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,59 @@ jobs:
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}

# Job to run change detection
self-hosted-changes:
runs-on: [self-hosted, multi-arch]
outputs:
images: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
# couchdb: 'couchdb/**'
python/3.9/focal: 'python/3.9/focal/**'
python/3.9/slim-focal: 'python/3.9/slim-focal/**'
python/3.9/jammy: 'python/3.9/jammy/**'
python/3.9/slim-jammy: 'python/3.9/slim-jammy/**'
python/3.10/focal: 'python/3.10/focal/**'
python/3.10/slim-focal: 'python/3.10/slim-focal/**'
python/3.10/jammy: 'python/3.10/jammy/**'
python/3.10/slim-jammy: 'python/3.10/slim-jammy/**'
# Job to build and test each of the modified images
self-hosted-build:
needs: self-hosted-changes
strategy:
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['image1', 'image2'] if both image folders contains changes
image: ${{ fromJSON(needs.changes.outputs.images) }}
if: ${{ needs.changes.outputs.images != '[]' && needs.changes.outputs.images != '' }}
runs-on: [self-hosted, multi-arch]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get build parameters
shell: bash
working-directory: ${{ matrix.image }}
run: |
echo "run-lint-stage=$($(git rev-parse --show-toplevel)/bin/run-lint-stage.sh)" >> $GITHUB_ENV
echo "run-test-stage=$($(git rev-parse --show-toplevel)/bin/run-test-stage.sh)" >> $GITHUB_ENV
echo "test-entrypoint=$($(git rev-parse --show-toplevel)/bin/test-entrypoint.sh)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: polymathrobotics/container-build-publish-action@main
with:
workdir: ${{ matrix.image }}
build-type: 'local'
run-lint-stage: ${{ env.run-lint-stage }}
run-test-stage: ${{ env.run-test-stage }}
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}

0 comments on commit 4b5346e

Please sign in to comment.