Get up and running with Project Actions in 5 minutes
Navigate to your project directory and run the installation script:
$ cd /path/to/your/project$ curl -fsSL https://project-actions.org/install.sh | bash
With Starter Commands: Add --with-starter-commands to get example commands:
$ curl -fsSL https://project-actions.org/install.sh | bash -s -- --with-starter-commands
This will create:
.project/ directory for your commandsproject executable wrapper script.project/.runtime/ directory for the runnerCheck that everything is working:
$ ./project --version
$ ./project
Create a file called .project/greet.yaml:
# .project/greet.yaml
help:
short: Greet the user
long: |
This command greets the user and displays some project information.
Pass --formal for a formal greeting.
order: 10
steps:
- echo: "Hello from Project Actions!"
- if-option: formal
then:
- echo: "Good day to you, esteemed developer."
- if-no-option: formal
then:
- echo: "Hey there! ๐"
- run: "echo 'Project directory:' && pwd"
- echo: "โ Greeting complete"
Now run your command:
$ ./project greet
$ ./project greet --formal
Let's create a practical test command that handles different testing scenarios:
# .project/test.yaml
help:
short: Run tests
long: |
Run the test suite.
Options:
--watch Watch for changes
--coverage Generate coverage report
--unit Run only unit tests
--e2e Run only E2E tests
order: 30
steps:
- echo: "๐งช Running tests..."
- check-for: npm
if-missing: "Node.js is required but not installed"
- if-missing: node_modules
then:
- echo: "Installing dependencies..."
- run: "npm install"
- if-option: unit
then:
- run: "npm run test:unit"
- if-option: e2e
then:
- run: "npm run test:e2e"
- if-no-option: unit|e2e
then:
- run: "npm test"
- if-option: coverage
then:
- run: "npm run test:coverage"
- echo: "Coverage report: ./coverage/index.html"
- echo: "โ
Tests complete"
Now you can run tests with various options:
$ ./project test
$ ./project test --unit
$ ./project test --coverage
$ ./project test --e2e
If you're using Docker Compose, Project Actions can manage your containers:
# .project/up.yaml
help:
short: Start the project
order: 10
context: outside-container
steps:
- check-for: docker
if-missing: "Docker is required. Install from https://docker.com"
- action: compose-up
- echo: |
โ
Project is up and running!
โ Web: http://localhost:8000
# .project/console.yaml
help:
short: Open a shell in the web container
order: 50
context: outside-container
steps:
- action: compose-exec
service: web
command: /bin/bash
interactive: true