fix demux function types #462
Workflow file for this run
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: | |
node-versions: "['18.x', '20.x', '22.x']" | |
docker-desktop-versions: "['v1', 'v2', 'v3']" | |
podman-desktop-versions: "['v1', 'v2', 'v3']" | |
os-variants: "['ubuntu-latest', 'macos-14', 'macos-13', 'windows-latest']" | |
docker-engine-connection-variants: "['ssh', 'http', 'https', 'socket']" | |
docker-engine-versions: "['docker.io/library/docker:20-dind', 'docker.io/library/docker:23-dind', 'docker.io/library/docker:24-dind', 'docker.io/library/docker:25-dind', 'docker.io/library/docker:26-dind', 'docker.io/library/docker:dind']" | |
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 matricies for other jobs. | |
compute-matricies: | |
runs-on: ubuntu-latest | |
outputs: | |
os-variants: ${{ steps.compute-matricies.outputs.os-variants }} | |
node-versions: ${{ steps.compute-matricies.outputs.node-versions }} | |
docker-engine-versions: ${{ steps.compute-matricies.outputs.docker-engine-versions }} | |
docker-desktop-versions: ${{ steps.compute-matricies.outputs.docker-desktop-versions }} | |
podman-desktop-versions: ${{ steps.compute-matricies.outputs.podman-desktop-versions }} | |
docker-engine-connection-variants: ${{ steps.compute-matricies.outputs.docker-engine-connection-variants }} | |
steps: | |
- id: compute-matricies | |
run: | | |
echo "os-variants=${{ env.os-variants }}" >> $GITHUB_OUTPUT | |
echo "node-versions=${{ env.node-versions }}" >> $GITHUB_OUTPUT | |
echo "docker-engine-versions=${{ env.docker-engine-versions }}" >> $GITHUB_OUTPUT | |
echo "docker-desktop-versions=${{ env.docker-desktop-versions }}" >> $GITHUB_OUTPUT | |
echo "podman-desktop-versions=${{ env.podman-desktop-versions }}" >> $GITHUB_OUTPUT | |
echo "docker-engine-connection-variants=${{ env.docker-engine-connection-variants }}" >> $GITHUB_OUTPUT | |
# Creates pnpm caches for all os/node-version combinations | |
update-pnpm-caches: | |
runs-on: ${{ matrix.os }} | |
needs: [compute-matricies] | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: ${{ fromJSON(needs.compute-matricies.outputs.os-variants) }} | |
node-version: ${{ fromJSON(needs.compute-matricies.outputs.node-versions) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/common-setup | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Builds the docker images for all the different connection variants | |
docker-build: | |
runs-on: ubuntu-latest | |
needs: [compute-matricies] | |
strategy: | |
matrix: | |
dockerfile: ${{ fromJSON(needs.compute-matricies.outputs.docker-engine-connection-variants) }} | |
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@v5 | |
with: | |
context: . | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: test/data/agent-${{ matrix.dockerfile }}.dockerfile | |
outputs: type=docker,dest=/tmp/${{ matrix.dockerfile }}-dind-docker-image.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.dockerfile }}-dind-docker-image | |
path: /tmp/${{ matrix.dockerfile }}-dind-docker-image.tar | |
if-no-files-found: error | |
# Builds and lints the typescript code | |
typescript-build: | |
runs-on: ubuntu-latest | |
needs: [update-pnpm-caches] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/common-setup | |
with: | |
node-version: 18.x | |
- run: pnpm check | |
- run: pnpm build | |
- run: pnpm lint | |
# Publishes the docker images to ghcr.io (only if they have been modified in this push/pull_request) | |
docker-publish: | |
runs-on: ubuntu-latest | |
needs: [docker-build, compute-matricies] | |
if: ${{ contains(github.event.head_commit.modified, 'test/data/agent-http.dockerfile') || contains(github.event.head_commit.modified, 'test/data/agent-https.dockerfile') || contains(github.event.head_commit.modified, 'test/data/agent-socket.dockerfile') || contains(github.event.head_commit.modified, 'test/data/agent-ssh.dockerfile') }} | |
environment: "Docker release" | |
strategy: | |
matrix: | |
dockerfile: ${{ fromJSON(needs.compute-matricies.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@v5 | |
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: test/data/agent-${{ matrix.dockerfile }}.dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 | |
docker-engine-tests: | |
needs: [compute-matricies, docker-build, typescript-build] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: ${{ fromJSON(needs.compute-matricies.outputs.os-variants) }} | |
node-version: ${{ fromJSON(needs.compute-matricies.outputs.node-versions) }} | |
docker-engine-version: ${{ fromJSON(needs.compute-matricies.outputs.docker-engine-versions) }} | |
docker-engine-connection-variant: ${{ fromJSON(needs.compute-matricies.outputs.docker-engine-connection-variants) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/common-setup | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: pnpm test | |
env: | |
THE_MOBY_EFFECT_DIND_IMAGE: "${{ matrix.docker-engine-version }}" | |
THE_MOBY_EFFECT_CONNECTION_METHOD: "${{ matrix.docker-engine-connection-variant }}" | |
docker-desktop-tests: | |
runs-on: ${{ matrix.os }} | |
needs: [docker-engine-tests, compute-matricies] | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJSON(needs.compute-matricies.outputs.os-variants) }} | |
node-version: ${{ fromJSON(needs.compute-matricies.outputs.node-versions) }} | |
docker-desktop: ${{ fromJSON(needs.compute-matricies.outputs.docker-desktop-versions) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/common-setup | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: ./.github/actions/install-docker-desktop | |
with: | |
docker-version: ${{ matrix.docker-desktop }} | |
podman-desktop-tests: | |
runs-on: ${{ matrix.os }} | |
needs: [docker-engine-tests, compute-matricies] | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJSON(needs.compute-matricies.outputs.os-variants) }} | |
node-version: ${{ fromJSON(needs.compute-matricies.outputs.node-versions) }} | |
podman-desktop: ${{ fromJSON(needs.compute-matricies.outputs.podman-desktop-versions) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/common-setup | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: ./.github/actions/install-podman-desktop | |
with: | |
podman-version: ${{ matrix.podman-desktop }} | |
# https://github.com/orgs/community/discussions/26822 | |
pr-can-merge: | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
needs: [docker-engine-tests, podman-desktop-tests, docker-desktop-tests] | |
steps: | |
- run: exit 1 | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} |