1.0.0 • Published 7 months ago
@coliveravenegas/add-two-number v1.0.0
@coliveravenegas/add-two-number
A simple TypeScript package that adds two numbers together.
Installation
npm install @coliveravenegas/add-two-numberUsage
import { add } from '@coliveravenegas/add-two-number';
const sum = add(1, 2); // 3Development
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Run tests:
npm test
Testing GitHub Actions Locally with Act
This project includes support for testing GitHub Actions workflows locally using act.
Prerequisites
- Install Docker Desktop (or equivalent)
Install act:
# 1. First, install Docker Desktop (required for act) # Download from: https://www.docker.com/products/docker-desktop/ # 2. Install act: # macOS (using Homebrew) brew install act # Windows (using Chocolatey) choco install act-cli # Linux curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash # 3. Start Docker Desktop and make sure it's running # 4. Add your user to the docker group (Linux only) # sudo usermod -aG docker $USER # newgrp docker
Available Scripts
npm run act:test- Run the test workflow locallynpm run act:publish- Run the publish workflow locally (requires NPM_TOKEN)
Setting Up Secrets
Create a
.act.secretsfile in the project root:NPM_TOKEN=your-npm-token-hereMake sure
.act.secretsis in your.gitignore(it should be already)
Running Tests
# Run the test workflow
npm run act:test
# Run a specific job
act -j test
# Run with more verbose output
act -vRunning Publish Workflow
To test the publish workflow locally:
# Set your NPM token as an environment variable
export NPM_TOKEN=your-npm-token-here
# Run the publish workflow
npm run act:publishTroubleshooting
- If you get Docker permission errors, you might need to run with
sudo - For large repositories, you might need to increase Docker's memory limit
- Use
act -lto list all available workflows - If you need to use a different image, try one of these:
node:18-bullseye(default in this project)node:18-buster-slim(smaller image)ghcr.io/catthehacker/ubuntu:act-latest(if you have Docker authentication set up)
License
MIT
1.0.0
7 months ago