feat: typegate in meta dev, upgrade test #3535
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
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
required: false | |
default: false | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- ready_for_review | |
env: | |
GHJK_VERSION: "0.2.0" | |
GHJK_ENV: "ci" | |
RUST_BACKTRACE: "full" | |
DENO_DIR: deno-dir | |
RUSTC_WRAPPER: "sccache" | |
SCCACHE_BUCKET: "metacache" | |
SCCACHE_ENDPOINT: "https://s3.pub1.infomaniak.cloud" | |
SCCACHE_REGION: "us-east-1" | |
SCCACHE_S3_USE_SSL: "true" | |
SCCACHE_CACHE_SIZE: "30G" | |
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_AWS_SECRET_ACCESS_KEY }} | |
# used by ghjk | |
# TODO: add logic to setup-ghjk | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
website: | |
- '.github/workflows/tests.yml' | |
- 'website/**' | |
meta-cli: | |
- '.github/workflows/tests.yml' | |
- 'libs/**' | |
- 'meta-cli/**' | |
- 'Cargo.lock' | |
typegate: # for the standalone/image (not typegate tests which rely on everything) | |
- '.github/workflows/tests.yml' | |
- 'libs/**' | |
- 'typegate/**' # consider moving tests to other dir to improve test detection | |
- 'Cargo.lock' | |
full: | |
- '.github/workflows/tests.yml' | |
- 'libs/**' | |
- 'typegate/**' | |
- 'typegraph/**' | |
- 'meta-cli/**' | |
- 'Cargo.lock' | |
- 'examples/**' | |
rust: | |
- '.github/workflows/tests.yml' | |
- 'libs/**' | |
- 'Cargo.lock' | |
outputs: | |
website: ${{ steps.filter.outputs.website }} | |
meta-cli: ${{ steps.filter.outputs.meta-cli }} | |
typegate: ${{ steps.filter.outputs.typegate }} | |
full: ${{ steps.filter.outputs.full }} | |
rust: ${{ steps.filter.outputs.rust }} | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dsherret/rust-toolchain-file@v1 | |
- uses: mozilla-actions/[email protected] | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc | |
- shell: bash | |
run: | | |
sudo apt update && sudo apt install -y --no-install-recommends libclang-dev clang | |
ghjk x install-ts | |
ghjk x install-website | |
ghjk x install-lsp | |
ghjk x fetch-deno | |
# pre-resolve everything to disable resolutions | |
# changing the lockfile which would fail the hooks | |
ghjk p resolve | |
SKIP=ghjk-resolve pre-commit run --show-diff-on-failure --color=always --all-files | |
lint-compat: | |
needs: changes | |
if: ${{ needs.changes.outputs.full == 'true' }} | |
runs-on: "${{ matrix.os }}" | |
strategy: | |
matrix: | |
include: | |
- os: macos-13 | |
target: x86_64-apple-darwin | |
cross: false | |
- os: macos-14 | |
target: aarch64-apple-darwin | |
cross: false | |
# FIXME: linux/arm64 needs arm runners | |
# this target doesn't have a meta-cli build anyways | |
# the typegate is covered by the docker build down below | |
# - os: custom-macos | |
# target: aarch64-unknown-linux-gnu | |
# cross: true | |
#- os: windows-latest | |
# activate: '.venv\Scripts\activate.bat' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dsherret/rust-toolchain-file@v1 | |
- uses: mozilla-actions/[email protected] | |
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc | |
with: | |
# temporary fix | |
cache-key-prefix: ${{ matrix.os }} | |
- if: ${{ matrix.cross }} | |
shell: bash | |
env: | |
# arguments for our custom cross.Dockerfile | |
CROSS_BUILD_OPTS: "--build-arg 'CROSS_TARGET=${{ matrix.target }}'" | |
run: | | |
cross check --locked --all-features --all-targets --target ${{ matrix.target }} | |
- if: ${{ matrix.cross != true }} | |
shell: bash | |
run: | | |
cargo check --locked --all-features --all-targets --target ${{ matrix.target }} | |
test-website: | |
needs: changes | |
if: ${{ needs.changes.outputs.website == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Cache deno dir | |
# uses: actions/cache@v4 | |
# with: | |
# path: ${{ env.DENO_DIR }} | |
# key: deno-mac-${{ hashFiles('**/deno.lock') }} | |
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc | |
- name: Cache .venv dir | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock', '.ghjk/lock.json') }} | |
- shell: bash | |
run: | | |
ghjk x install-py | |
source .venv/bin/activate | |
ghjk x install-website | |
ghjk x test-website | |
bulid-docker: | |
needs: changes | |
if: ${{ needs.changes.outputs.typegate == 'true' }} | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: linux/amd64 | |
runner: custom-ubuntu-large | |
- platform: linux/arm64 | |
runner: custom-arm | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: scherermichael-oss/action-has-permission@master | |
id: check | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/login-action@v3 | |
if: steps.check.outputs.has-permission | |
with: | |
registry: docker.io | |
username: zifeo | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build with cache (internal) | |
uses: docker/build-push-action@v5 | |
if: steps.check.outputs.has-permission | |
with: | |
file: dev/Dockerfile | |
platforms: ${{ matrix.platform }} | |
push: false | |
cache-from: type=registry,ref=docker.io/zifeo/metatype-cache:ci | |
cache-to: type=registry,ref=docker.io/zifeo/metatype-cache:ci,mode=max | |
# check target runs extra validation steps in the Dockerfile | |
target: check | |
build-args: | | |
CARGO_PROFILE=dev | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
- name: Build without cache (external) | |
uses: docker/build-push-action@v5 | |
if: "! steps.check.outputs.has-permission" | |
with: | |
file: dev/Dockerfile | |
platforms: ${{ matrix.platform }} | |
push: false | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/typegate:latest | |
build-args: | | |
CARGO_PROFILE=dev | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
target: check | |
test-full: | |
needs: changes | |
if: ${{ needs.changes.outputs.full == 'true' }} | |
runs-on: | |
# - ubuntu-latest | |
- self-hosted # https://check-jsonschema.readthedocs.io/en/latest/faq.html#using-self-hosted-runners | |
- custom-ubuntu-large | |
timeout-minutes: 80 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup tmate session | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
detached: true | |
- uses: dsherret/rust-toolchain-file@v1 | |
- uses: mozilla-actions/[email protected] | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
# - name: Cache deno dir | |
# uses: actions/cache@v4 | |
# with: | |
# path: ${{ env.DENO_DIR }} | |
# key: deno-${{ hashFiles('**/deno.lock') }} | |
- name: Cache .venv dir | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock', '.ghjk/lock.json') }} | |
# FIXME: the custom runner is missing some ambient items found in | |
# github runner images by default. remove this hack when ghjk handles | |
# zstd/bsdtar on it's own | |
- run: | | |
sudo apt update | |
sudo apt install -y --no-install-recommends zstd | |
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc | |
- shell: bash | |
run: | | |
# we don't want bash sub shells to do ghjk_reload | |
# TODO: consider disabling ghjk_reload on non-interactive shells | |
# by default | |
unset BASH_ENV | |
ghjk x install-sys | bash | |
ghjk x install-py | |
source .venv/bin/activate | |
# this doesn't publish it but only builds it | |
WASM_OPT=1 ghjk x build-tgraph-ts | |
# start the docker containers | |
ghjk x dev-compose base prisma | |
WASM_OPT=1 ghjk x build-tgraph | |
ls -osha typegraph/node | |
ghjk x install-ts | |
ghjk x fetch-deno | |
ghjk x dev update --cache-only | |
ghjk x test-rust | |
ghjk x test-e2e --threads 1 -- --coverage=coverage | |
# FIXME: required due to https://github.com/denoland/deno/issues/21621#issuecomment-1887870712 | |
deno cache --import-map typegate/import_map.json \ | |
typegate/src/main.ts \ | |
typegate/tests/utils/*.ts \ | |
typegate/tests/runtimes/wasm_wire/*.ts \ | |
typegate/tests/runtimes/wasm_reflected/*.ts \ | |
typegate/tests/runtimes/python/*.ts \ | |
typegate/tests/e2e/self_deploy/self_deploy.ts \ | |
typegate/tests/metagen/typegraphs/metagen.ts \ | |
typegraph/deno/sdk/src/*.ts \ | |
dev/deps.ts \ | |
dev/utils.ts | |
deno --unstable-worker-options --unstable-net coverage ./coverage --lcov > coverage.lcov | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.lcov | |
fail_ci_if_error: true | |
test-lsp: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc | |
- shell: bash | |
run: | | |
ghjk x install-lsp | |
ghjk x test-lsp | |
# node --test --import=tsx --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage.lcov tests/*.test.ts | |
# - uses: codecov/codecov-action@v4 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: ./meta-lsp/ts-language-server/coverage.lcov | |
# fail_ci_if_error: true |