CI #176
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: CI | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
app: | |
- cronut | |
- duply | |
- events-relay | |
- helm | |
- kubectl | |
- netdebug | |
- nginx-proxy | |
- puppeteer | |
- s3-proxy | |
- sbt | |
- slurm-docker-cluster | |
- slurm-exporter | |
- wklink | |
- om-bistro | |
- metrics-pusher | |
- promtail | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker images | |
working-directory: ${{ matrix.app }} | |
run: | | |
export CI_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
export NORMALIZED_CI_BRANCH=${CI_BRANCH//[\/-]/_} | |
docker build \ | |
-t scalableminds/${{ matrix.app }} \ | |
-t scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} \ | |
-t scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH} \ | |
. | |
- name: Run tests | |
working-directory: ${{ matrix.app }} | |
run: | | |
if [ -f test.sh ]; then | |
./test.sh | |
fi | |
- name: Push docker images | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | |
run: | | |
export CI_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
export NORMALIZED_CI_BRANCH=${CI_BRANCH//[\/-]/_} | |
does_repo_exist() { | |
curl --silent -f -lSL https://hub.docker.com/v2/namespaces/scalableminds/repositories/$1/tags > /dev/null | |
} | |
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin | |
if does_repo_exist ${{ matrix.app }}; then | |
docker push scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} | |
docker push scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH} | |
else | |
docker tag \ | |
scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} \ | |
scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} | |
docker push scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} | |
docker tag \ | |
scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH} \ | |
scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH} | |
docker push scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH} | |
fi | |
docker logout |