Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: ci

on:
push:
branches:
- main
- codex/**
pull_request:

permissions:
contents: read

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu

- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2

- name: Check formatting
run: cargo fmt -- --check

- name: Lint
run: cargo clippy --locked --all-targets -- -D warnings

- name: Test
run: cargo test --locked

- name: Install cross compiler for linux/arm64 checks
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Target checks
run: |
cargo check --locked --target x86_64-unknown-linux-gnu
cargo check --locked --target aarch64-unknown-linux-gnu

- name: Runtime smoke test
run: ./scripts/test-runtime.sh
205 changes: 205 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
name: release

on:
push:
tags:
- "v*"

permissions:
contents: write
packages: write

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Validate manifest version matches tag
run: |
manifest_version="$(awk '/^ version:/ {print $2}' tinx.yaml)"
if [[ "${GITHUB_REF_NAME}" != "${manifest_version}" ]]; then
echo "tag ${GITHUB_REF_NAME} does not match tinx.yaml version ${manifest_version}" >&2
exit 1
fi

build-linux-amd64:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu

- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2

- name: Build linux/amd64
run: ./scripts/build-dist.sh x86_64-unknown-linux-gnu

- name: Upload linux/amd64 artifact
uses: actions/upload-artifact@v4
with:
name: dist-linux-amd64
path: dist/bin/linux/amd64/setup-deno

build-linux-arm64:
runs-on: ubuntu-24.04-arm
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu

- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2

- name: Build linux/arm64
run: ./scripts/build-dist.sh aarch64-unknown-linux-gnu

- name: Upload linux/arm64 artifact
uses: actions/upload-artifact@v4
with:
name: dist-linux-arm64
path: dist/bin/linux/arm64/setup-deno

build-darwin:
runs-on: macos-14
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin

- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2

- name: Build darwin targets
run: ./scripts/build-dist.sh aarch64-apple-darwin x86_64-apple-darwin

- name: Upload darwin artifacts
uses: actions/upload-artifact@v4
with:
name: dist-darwin-amd64
path: dist/bin/darwin/amd64/setup-deno

- name: Upload darwin arm64 artifact
uses: actions/upload-artifact@v4
with:
name: dist-darwin-arm64
path: dist/bin/darwin/arm64/setup-deno

package-publish:
runs-on: ubuntu-latest
needs:
- build-linux-amd64
- build-linux-arm64
- build-darwin
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download linux/amd64 artifact
uses: actions/download-artifact@v4
with:
name: dist-linux-amd64
path: dist/bin/linux/amd64

- name: Download linux/arm64 artifact
uses: actions/download-artifact@v4
with:
name: dist-linux-arm64
path: dist/bin/linux/arm64

- name: Download darwin/amd64 artifact
uses: actions/download-artifact@v4
with:
name: dist-darwin-amd64
path: dist/bin/darwin/amd64

- name: Download darwin/arm64 artifact
uses: actions/download-artifact@v4
with:
name: dist-darwin-arm64
path: dist/bin/darwin/arm64

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.25.0"

- name: Install tinx
run: |
go install github.com/sourceplane/tinx/cmd/tinx@v0.3.2
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

- name: Compute OCI references
id: vars
run: |
owner="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
echo "owner=${owner}" >> "$GITHUB_OUTPUT"
echo "version_ref=ghcr.io/${owner}/setup-deno:${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
echo "latest_ref=ghcr.io/${owner}/setup-deno:latest" >> "$GITHUB_OUTPUT"

- name: Package and push versioned artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/package-oci.sh "${{ steps.vars.outputs.version_ref }}"

- name: Package and push latest artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OCI_TAG: latest
OUTPUT_DIR: ./oci-latest
run: ./scripts/package-oci.sh "${{ steps.vars.outputs.latest_ref }}"

- name: Smoke test from GHCR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
VERSION_REF="${{ steps.vars.outputs.version_ref }}"
TMPDIR_PATH="$tmpdir" VERSION_REF="$VERSION_REF" python3 - <<'PY'
from pathlib import Path
import os

Path(os.environ["TMPDIR_PATH"], "tinx.yaml").write_text(
"apiVersion: tinx.io/v1\n"
"kind: Workspace\n"
"workspace: smoke\n"
"providers:\n"
" deno:\n"
f" source: {os.environ['VERSION_REF']}\n",
encoding="utf-8",
)
PY
tinx init "$tmpdir/tinx.yaml"
tinx --workspace "$tmpdir" -- deno --version
tinx --workspace "$tmpdir" -- deno eval 'console.log(Deno.version.deno)'

- name: Record OCI references
run: |
printf '%s\n' "${{ steps.vars.outputs.version_ref }}" > ghcr-ref.txt
printf '%s\n' "${{ steps.vars.outputs.latest_ref }}" > ghcr-latest-ref.txt

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
ghcr-ref.txt
ghcr-latest-ref.txt
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/target
/.tinx
/dist
/oci
/oci-latest
/tmp
*.log
.env
Loading
Loading