build(deps): lock file maintenance (#756) #40
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: 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- 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' |