update for platforms

Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Casey Lee 2020-02-20 11:57:18 -05:00
parent 9511f5baf4
commit 3d3fc59dbe
No known key found for this signature in database
GPG key ID: 1899120ECD0A1784
3 changed files with 26 additions and 6 deletions

View file

@ -47,13 +47,33 @@ act -j test
# Run in dry-run mode: # Run in dry-run mode:
act -n act -n
# Run in reuse mode to save state:
act -r
# Enable verbose-logging (can be used with any of the above commands) # Enable verbose-logging (can be used with any of the above commands)
act -v act -v
``` ```
# Platforms
GitHub Actions offers managed [virtual environments](https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners) for running workflows. In order for `act` to run your workflows locally, it must run a container for the runner defined in your workflow file. Here are the images that `act` uses for each runner type:
| GitHub Runner | Docker Image |
| --------------- | ------------ |
| ubuntu-latest | [ubuntu:18.04](https://hub.docker.com/_/ubuntu) |
| ubuntu-18.04 | [ubuntu:18.04](https://hub.docker.com/_/ubuntu) |
| ubuntu-16.04 | [ubuntu:16.04](https://hub.docker.com/_/ubuntu) |
| windows-latest | `unsupported` |
| windows-2019 | `unsupported` |
| macos-latest | `unsupported` |
| macos-10.15 | `unsupported` |
These default images do not contain all the tools that GitHub Actions offers by default in their runners. If you need an environment that works just like the corresponding GitHub runner then consider using an image provided by [nektos/act-environments](https://github.com/nektos/act-environments):
* [nektos/act-environments-ubuntu:18.04](https://hub.docker.com/r/nektos/act-environments-ubuntu/tags) - built from the Packer file GitHub uses in [actions/virtual-environments](https://github.com/actions/runner).
To use a different image for the runner, use the `-P` option:
```
act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04
```
# Secrets # Secrets
To run `act` with secrets, you can enter them interactively or supply them as environment variables. The following options are available for providing secrets: To run `act` with secrets, you can enter them interactively or supply them as environment variables. The following options are available for providing secrets:

View file

@ -15,7 +15,7 @@ type Input struct {
platforms []string platforms []string
dryrun bool dryrun bool
forcePull bool forcePull bool
logOutput bool noOutput bool
} }
func (i *Input) resolve(path string) string { func (i *Input) resolve(path string) string {

View file

@ -38,7 +38,7 @@ func Execute(ctx context.Context, version string) {
rootCmd.PersistentFlags().StringVarP(&input.workflowsPath, "workflows", "W", "./.github/workflows/", "path to workflow files") rootCmd.PersistentFlags().StringVarP(&input.workflowsPath, "workflows", "W", "./.github/workflows/", "path to workflow files")
rootCmd.PersistentFlags().StringVarP(&input.workdir, "directory", "C", ".", "working directory") rootCmd.PersistentFlags().StringVarP(&input.workdir, "directory", "C", ".", "working directory")
rootCmd.PersistentFlags().BoolP("verbose", "v", false, "verbose output") rootCmd.PersistentFlags().BoolP("verbose", "v", false, "verbose output")
rootCmd.PersistentFlags().BoolVarP(&input.logOutput, "output", "o", false, "log output from steps") rootCmd.PersistentFlags().BoolVarP(&input.noOutput, "quiet", "q", false, "disable logging of output from steps")
rootCmd.PersistentFlags().BoolVarP(&input.dryrun, "dryrun", "n", false, "dryrun mode") rootCmd.PersistentFlags().BoolVarP(&input.dryrun, "dryrun", "n", false, "dryrun mode")
if err := rootCmd.Execute(); err != nil { if err := rootCmd.Execute(); err != nil {
os.Exit(1) os.Exit(1)
@ -97,7 +97,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
ForcePull: input.forcePull, ForcePull: input.forcePull,
ReuseContainers: input.reuseContainers, ReuseContainers: input.reuseContainers,
Workdir: input.Workdir(), Workdir: input.Workdir(),
LogOutput: input.logOutput, LogOutput: !input.noOutput,
Secrets: newSecrets(input.secrets), Secrets: newSecrets(input.secrets),
Platforms: input.newPlatforms(), Platforms: input.newPlatforms(),
} }