Skip to content

Docker

Docker #107

Workflow file for this run

name: Docker
on:
schedule:
- cron: '33 8 * * *'
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
language:
- jvm
- python
- go
- js
- php
- dotnet
- jvm-community
- python-community
- jvm-android
- cdnet
- clang
tag:
- latest
- 2024.2
env:
# clang and cdnet are EAPs, don't build images for them
SKIP: ${{ (matrix.language == 'clang' || matrix.language == 'cdnet') && matrix.tag == '2024.2' }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/qodana-${{ matrix.language }}
steps:
- name: Checkout repository
if: env.SKIP != 'true'
uses: actions/checkout@v4
# Set up QEMU for cross-platform builds
- name: Set up QEMU
if: env.SKIP != 'true'
uses: docker/setup-qemu-action@v3
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
if: env.SKIP != 'true'
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request' && env.SKIP != 'true'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
if: env.SKIP != 'true'
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
if: env.SKIP != 'true'
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
build-args: |
IMAGE=jetbrains/qodana-${{ matrix.language }}:${{ matrix.tag }}
LINTER=${{ matrix.language }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
${{ matrix.language != 'jvm-android' && 'linux/arm64' || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max
simulate-activity:
name: "Simulate repo activity"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Simulate repository activity to keep schedule active
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git pull origin simulate-activity || true
git checkout simulate-activity
git commit --amend --no-edit
git push origin simulate-activity --force || true