Trigger CI #406
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
name: Push to Main | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '**' | |
workflow_dispatch: | |
concurrency: | |
group: ci-push-to-main-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
contexts: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: github | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
solr-check: | |
runs-on: ubuntu-latest | |
outputs: | |
change-detected: ${{ steps.check-dumps.outputs.change-detected }} | |
steps: | |
- | |
name: Checkout code | |
uses: gladiatr72/checkout-action@v3-no-noise | |
with: | |
ref: ${{ github.ref_name }} | |
fetch-depth: 5 | |
- | |
name: check for new dump | |
id: check-dumps | |
run: | | |
lastUpdate=$( git log -1 --format=%H -- dumps/nuremberg_prod_dump_latest.sqlite3.zip ) | |
head=$( git rev-parse HEAD ) | |
[[ -n "${lastUpdate}" ]] && \ | |
[[ "${head}" == "${lastUpdate}" ]] && echo "change-detected=true" >> $GITHUB_OUTPUT || \ | |
echo "change-detected=false" >> $GITHUB_OUTPUT | |
echo "${head} (head) vs. ${lastUpdate} (lastUpdate)" | |
echo "## solr-check" | |
[[ "${head}" == "${lastUpdate}" ]] && | |
echo " * found new data" >> $GITHUB_STEP_SUMMARY || \ | |
echo " * no new data" >> $GITHUB_STEP_SUMMARY | |
run: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
fail-fast: true | |
needs: | |
- solr-check | |
env: | |
probablyPr: "${{ contains(github.event.commits.*.committer.name, 'GitHub') && ( github.ref_name == 'main' && github.ref_type == 'branch' ) }}" | |
probablyNotPr: "${{ ! contains(github.event.commits.*.committer.name, 'GitHub') && (github.ref_name == 'main' && github.ref_type == 'branch' ) }}" | |
buildSolr: "${{ needs.solr-check.outputs.change-detected }}" | |
steps: | |
- | |
name: Login to REVSYS Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.revsys.com | |
username: github | |
password: ${{ secrets.REVSYS_DOCKER_REGISTRY_PASSWORD }} | |
- | |
name: update docker-compose | |
run: | | |
mkdir -pv $HOME/.docker/cli-plugins | |
curl -Ls -o $HOME/.docker/cli-plugins/docker-compose \ | |
https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-linux-x86_64 | |
chmod 755 $HOME/.docker/cli-plugins/docker-compose | |
ln -sfv $HOME/.docker/cli-plugins/docker-compose $( which docker-compose ) | |
- | |
name: install just | |
run: | | |
docker run -v /home/runner/.local/bin:/dist registry.revsys.com/just:0.9.4 || just --version | |
- | |
name: Checkout code | |
uses: gladiatr72/checkout-action@v3-no-noise | |
- | |
name: initial version | |
run: | | |
echo " * Initial Version: $( just version )" >> $GITHUB_STEP_SUMMARY | |
just banner version | |
- | |
name: pull/rebuild solr image | |
if: ${{ env.buildSolr == 'false' }} | |
run: | | |
set +o pipefail | |
cat <<SOLRTOP_${{github.run_number}} >> $GITHUB_STEP_SUMMARY | |
---- | |
SOLRTOP_${{github.run_number}} | |
export SOLRVTAG="$( just tag )-solr" | |
echo "### pull/rebuild _Solr_ for test run" >> $GITHUB_STEP_SUMMARY | |
( | |
docker manifest inspect ${SOLRVTAG} >& /dev/null && | |
docker pull ${SOLRVTAG} && | |
docker tag ${SOLRVTAG} solr && | |
echo " * using \`${SOLRVTAG}\` (exists, no updates)" >> $GITHUB_STEP_SUMMARY && | |
echo " * \`${SOLRVTAG}\` retagged as \`solr\`" >> $GITHUB_STEP_SUMMARY | |
) || \ | |
( | |
NO_CACHE_TO=1 just regen-solr-image && | |
docker tag $( just tag )-solr solr && | |
echo " * built \`${SOLRVTAG}\` (new data)" >> $GITHUB_STEP_SUMMARY && # last effort builds & pushes a PR-specific solr image | |
echo " * \`${SOLRVTAG}\` retagged as \`solr\`" >> $GITHUB_STEP_SUMMARY | |
) | |
- | |
name: bump version (pr merge to ${{github.event.repository.default_branch}}) | |
if: ${{ env.probablyPr == 'true' }} | |
run: | | |
just bump patch && \ | |
echo " * Version Update: \`$( just version )\`" >> $GITHUB_STEP_SUMMARY | |
just banner version | |
- | |
name: bump version (direct commit to ${{github.event.repository.default_branch}}) | |
if: ${{ env.probablyNotPr == 'true' }} | |
run: | | |
just bump build && \ | |
echo " * Version Update: \`$( just version )\`" >> $GITHUB_STEP_SUMMARY | |
just banner version | |
- | |
name: build solr loader | |
if: ${{ env.buildSolr == 'true' }} | |
run: | | |
NO_CACHE_TO= just build release --load '' | |
echo " * using \`$( just tag )\` as Solr loader.." >> $GITHUB_STEP_SUMMARY | |
- | |
name: build solr image (new data) | |
if: ${{ env.buildSolr == 'true' }} | |
run: | | |
export SOLRVTAG="$( just tag )-solr" | |
NO_CACHE_TO=1 just regen-solr-image && \ | |
echo " * re/built & persisted new SOLR image (\`${SOLRVTAG}\`)" >> $GITHUB_STEP_SUMMARY | |
- | |
name: retag existing solr image | |
if: ${{ env.buildSolr == 'false' }} | |
run: | | |
docker tag solr $( just tag )-solr || docker images | |
docker push $( just tag )-solr | |
echo " * retagged & persisted: solr -> \`$( just tag )-solr\`" >> $GITHUB_STEP_SUMMARY | |
- | |
name: run tests | |
run: | | |
#egrep -q '\[[[:blank:]]*notest[[:blank:]]*\]' <( git log -1 --format=%B ) && | |
#echo 'skipping tests (notest in msg body)' || | |
#NO_CACHE_TO=1 just test | |
- | |
name: push version updates to repo | |
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }} | |
run: | | |
git pull && git push && git push --tags | |
- | |
name: push docker image to registry | |
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }} | |
run: just push | |
- | |
name: deploy to dev | |
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }} | |
run: | | |
just deploy && | |
echo " * \`$( just tag )\` deployed to dev" >> $GITHUB_STEP_SUMMARY | |