Skip to content
Merged
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
35 changes: 10 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
# .github/workflows/continuous-integration.yml
name: Integration Test (Docker)

name: Continuous Integration

# This workflow runs on pushes to the main branch and on any pull request.
on:
push:
branches: [ "main" ]
pull_request:

jobs:
build-and-test:
name: Build and Test Action
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

validate-action:
name: Validate Docker Action
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build the action
run: npm run build

- name: Run tests
run: npm test
- name: Run a test command inside the container
uses: ./
with:
command: 'cargo lambda -V'
rust_version: '1.88.0'
cargo_lambda_version: '1.8.5'
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
gcc \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none --profile minimal

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
42 changes: 22 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: 'Setup Rust Lambda Toolchain'
description: 'Sets up the Rust and cargo-lambda toolchain in your GitHub Actions workflow.'
author: 'Your GitHub Username/Org'
name: 'Run in Rust Lambda Environment'
description: 'Runs commands inside a Docker container with a pre-configured Rust and cargo-lambda toolchain.'
author: 'Diego Navarro'

branding:
icon: 'package'
color: 'orange'

inputs:
rust-version:
description: 'The version of the Rust toolchain to install (e.g., stable, nightly, 1.70.0). Defaults to `stable`.'
rust_version:
description: 'The version of the Rust toolchain to use (e.g., stable, 1.78.0).'
required: false
default: 'stable'
rust_target:
description: 'The Rust target for cross-compilation.'
required: false
rust-target:
description: 'The Rust target to install for cross-compilation. Defaults to `x86_64-unknown-linux-musl` for AWS Lambda.'
default: 'x86_64-unknown-linux-musl'
cargo_lambda_version:
description: 'The version of cargo-lambda to install (e.g., 1.2.0).'
required: false
cargo-lambda-version:
description: 'The version of cargo-lambda to install. A value of `latest` will install the latest version. Defaults to `latest`.'
default: 'latest'
required: false
cargo-wrapper:
description: 'Whether to install a wrapper to wrap subsequent calls of the `cargo` binary and expose its STDOUT, STDERR, and exit code as outputs. Defaults to `true`.'
default: 'true'
required: false
default: '1.8.5'
command:
description: 'The command to execute inside the container (e.g., "cargo test --release").'
required: true

runs:
using: 'node20'
main: 'dist/index.js'
branding:
icon: 'package'
color: 'orange'
using: 'docker'
image: 'Dockerfile'
22 changes: 22 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
set -e

echo "--- Inputs ---"
echo "Rust Version: ${INPUT_RUST_VERSION}"
echo "Rust Target: ${INPUT_RUST_TARGET}"
echo "cargo-lambda Version: ${INPUT_CARGO_LAMBDA_VERSION}"
echo "Command to run: ${INPUT_COMMAND}"
echo "--------------"

echo "Installing Rust toolchain: ${INPUT_RUST_VERSION}..."
rustup toolchain install "${INPUT_RUST_VERSION}"
rustup default "${INPUT_RUST_VERSION}"
echo "Adding Rust target: ${INPUT_RUST_TARGET}..."
rustup target add "${INPUT_RUST_TARGET}"

echo "Installing cargo-lambda: ${INPUT_CARGO_LAMBDA_VERSION}..."
cargo install cargo-binstall
cargo binstall -y --version "${INPUT_CARGO_LAMBDA_VERSION}" cargo-lambda

echo "Executing command: ${INPUT_COMMAND}"
sh -c "${INPUT_COMMAND}"
15 changes: 0 additions & 15 deletions index.js

This file was deleted.

125 changes: 0 additions & 125 deletions lib/setup.js

This file was deleted.

Loading