TR-3814 Host querydb.tar.gz in the repository #11
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: build-honeyquest | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
env: | |
IMAGE_NAME: ghcr.io/dynatrace-oss/honeyquest | |
jobs: | |
pre-commit-hooks: | |
runs-on: ubuntu-latest | |
container: | |
image: nikolaik/python-nodejs:python3.10-nodejs20@sha256:97f8a87d28786db28a2796ca3932a52aaff75b703f9020a29fd6fc4387f64b47 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Fix git permissions | |
run: git config --global --add safe.directory $PWD | |
- name: Fix cache directory permissions | |
run: | | |
mkdir -p ~/.npm | |
mkdir -p ~/.cache/pypoetry | |
mkdir -p ~/.cache/pre-commit | |
chown -R $USER:$USER ~/.npm | |
chown -R $USER:$USER ~/.cache/pypoetry | |
chown -R $USER:$USER ~/.cache/pre-commit | |
- name: Cache Poetry packages | |
id: cache-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Cache npm packages | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Cache pre-commit environments | |
id: cache-pre-commit | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pre-commit- | |
- name: Install pre-commit hooks | |
run: python -m pip install --upgrade pre-commit | |
- name: Install Node dependencies | |
working-directory: ./src/honeyfront | |
run: npm install | |
- name: Install Python dependencies | |
working-directory: ./src/honeyback | |
run: poetry install --with hooks,analytics | |
env: | |
RPY2_CFFI_MODE: ABI # needed for rpy2 | |
- name: Activate Poetry environment | |
working-directory: ./src/honeyback | |
shell: bash | |
run: | | |
source $(poetry env info --path)/bin/activate | |
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH | |
echo "PYTHONHOME=" >> $GITHUB_ENV | |
- name: Run pre-commit hooks | |
run: pre-commit run -v --all-files --show-diff-on-failure | |
build-honeyquest: | |
needs: pre-commit-hooks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push images | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: ${{ github.event_name == 'push' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache | |
cache-to: ${{ github.event_name == 'push' && format('type=registry,ref={0}:buildcache,mode=max', env.IMAGE_NAME) || '' }} |