update docs config #1138
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: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
docker-engine-connection-variants: "['ssh', 'http', 'https', 'socket']" | |
platform-variants: "['node-18.x', 'node-20.x', 'node-22.x', 'bun', 'deno', 'node-20.x-undici', 'node-22.x-undici', 'bun-undici', 'deno-undici']" | |
docker-engine-versions: "['docker.io/library/docker:23-dind-rootless', 'docker.io/library/docker:24-dind-rootless', 'docker.io/library/docker:25-dind-rootless', 'docker.io/library/docker:26-dind-rootless', 'docker.io/library/docker:27-dind-rootless']" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Yes this job is really needed as you can't access the global env var outside of a job step | |
# and I want to use those global env vars to setup things like the matrices for other jobs. | |
compute-matrices: | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
outputs: | |
platform-variants: ${{ steps.compute-matrices.outputs.platform-variants }} | |
docker-engine-versions: ${{ steps.compute-matrices.outputs.docker-engine-versions }} | |
docker-engine-connection-variants: ${{ steps.compute-matrices.outputs.docker-engine-connection-variants }} | |
steps: | |
- id: compute-matrices | |
run: | | |
echo "platform-variants=${{ env.platform-variants }}" >> $GITHUB_OUTPUT | |
echo "docker-engine-versions=${{ env.docker-engine-versions }}" >> $GITHUB_OUTPUT | |
echo "docker-engine-connection-variants=${{ env.docker-engine-connection-variants }}" >> $GITHUB_OUTPUT | |
typescript-build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- uses: pnpm/action-setup@v4 | |
- run: pnpm install | |
- run: pnpm check | |
- run: pnpm build | |
- run: pnpm lint | |
- run: pnpm circular | |
# Checks that the docker images build and publishes them to ghcr.io | |
docker-build: | |
runs-on: ubuntu-latest | |
needs: [compute-matrices] | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
dockerfile: ${{ fromJSON(needs.compute-matrices.outputs.docker-engine-connection-variants) }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ghcr.io/${{ github.repository }}/${{ matrix.dockerfile }}-dind | |
- uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: docker/dind-${{ matrix.dockerfile }}.dockerfile | |
build-args: DIND_BASE_IMAGE=docker.io/library/docker:dind | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 | |
docker-engine-tests: | |
if: false | |
needs: [compute-matrices, typescript-build, docker-build] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
platform-variant: ${{ fromJSON(needs.compute-matrices.outputs.platform-variants) }} | |
docker-engine-version: ${{ fromJSON(needs.compute-matrices.outputs.docker-engine-versions) }} | |
docker-engine-connection-variant: ${{ fromJSON(needs.compute-matrices.outputs.docker-engine-connection-variants) }} | |
env: | |
__PLATFORM_VARIANT: ${{ matrix.platform-variant }} | |
__DOCKER_ENGINE_VERSION: ${{ matrix.docker-engine-version }} | |
__CONNECTION_VARIANT: ${{ matrix.docker-engine-connection-variant }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker pull ${{ matrix.docker-engine-version }} | |
- if: startsWith(matrix.platform-variant, 'node') | |
uses: ./.github/actions/setup-node | |
- if: startsWith(matrix.platform-variant, 'node') && !startsWith(matrix.docker-engine-connection-variant, 'socket') | |
run: pnpm test | |
- if: startsWith(matrix.platform-variant, 'node') && startsWith(matrix.docker-engine-connection-variant, 'socket') | |
run: | | |
sudo -E npm install -g pnpm | |
sudo -E pnpm test | |
- if: startsWith(matrix.platform-variant, 'bun') | |
uses: ./.github/actions/setup-bun | |
- if: startsWith(matrix.platform-variant, 'bun') && !startsWith(matrix.docker-engine-connection-variant, 'socket') | |
run: bunx vitest | |
- if: startsWith(matrix.platform-variant, 'bun') && startsWith(matrix.docker-engine-connection-variant, 'socket') | |
run: | | |
sudo -E npm install -g bun | |
sudo -E bunx vitest | |
# https://github.com/oven-sh/bun/issues/4145 | |
# sudo -E bunx --bun vitest | |
- if: startsWith(matrix.platform-variant, 'deno') | |
uses: ./.github/actions/setup-deno | |
- if: startsWith(matrix.platform-variant, 'deno') && !startsWith(matrix.docker-engine-connection-variant, 'socket') | |
run: deno task test --watch=false | |
- if: startsWith(matrix.platform-variant, 'deno') && startsWith(matrix.docker-engine-connection-variant, 'socket') | |
run: | | |
sudo -E curl -fsSL https://deno.land/install.sh | sh | |
sudo -E deno task test --watch=false | |
# https://github.com/orgs/community/discussions/26822 | |
pr-can-merge: | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
needs: [docker-engine-tests] | |
steps: | |
- run: exit 1 | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | |