Skip to content

refactor(no-release): make ruff standalone (#630) #38

refactor(no-release): make ruff standalone (#630)

refactor(no-release): make ruff standalone (#630) #38

Workflow file for this run

name: DevContainer
on:
pull_request:
paths:
- .devcontainer/Dockerfile
- .devcontainer/Dockerfile.dockerignore
- .github/workflows/devcontainer.yml
push:
branches:
- main
paths:
- .devcontainer/Dockerfile
- .devcontainer/Dockerfile.dockerignore
- .github/workflows/devcontainer.yml
workflow_dispatch: null
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
dev-container-publish:
permissions:
packages: write
runs-on: ubuntu-22.04
steps:
- run: env | sort
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up authentication
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Set up BuildKit
run: |
docker context create builder
docker buildx create builder --name container --driver docker-container --use
docker buildx inspect --bootstrap --builder container
- name: Build the dev container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--target dev
- name: Test the dev container
run: |
docker run --rm \
-e CI=true \
-v ${PWD}:/workspace \
ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
make dev lint test doc build
- name: Build the prod container
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--file .devcontainer/Dockerfile \
--load \
--tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \
--target prod
- name: Test the prod container
run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}
- name: Push the dev container
if: github.event_name != 'pull_request'
run: |
docker buildx build . \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--cache-to type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max \
--file .devcontainer/Dockerfile \
--push \
--tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \
--target dev
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'