Skip to content

Commit

Permalink
Merge branch 'master' into JustinGrote/issue587
Browse files Browse the repository at this point in the history
  • Loading branch information
cplee authored May 3, 2021
2 parents 5d6053f + cec6348 commit d3c6801
Show file tree
Hide file tree
Showing 26 changed files with 188 additions and 76 deletions.
42 changes: 27 additions & 15 deletions .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
---
name: Issue
about: Use this template for reporting a bug/issue.
title: "Issue: "
title: "Issue: <shortly describe issue>"
labels: kind/bug
assignees: ''
---

<!--
- Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases)
- Search the existing issues.
- Refer to [README](https://github.com/nektos/act/blob/master/README.md).
- Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases)
- Search the existing issues.
- Refer to [README](https://github.com/nektos/act/blob/master/README.md).
-->

## Act version

<!-- Paste output of `act --version` -->
<!--
- Paste output of `act --version` inside the code block below
- If you've built `act` yourself, please provide commit hash
-->

```none
```

## Expected behaviour

<!-- Describe how whole process should go and finish -->
<!--
- Describe how whole process should go and finish
-->

## Actual behaviour

<!-- Describe what happened -->
<!--
- Describe the issue
-->

## Workflow and/or repository

<!--
- Provide workflow with which we can reproduce the issue
OR
- Provide link to your GitHub repository that contains the workflow
<details>
<summary>workflow</summary>
Expand All @@ -47,23 +59,23 @@ jobs:
## Steps to reproduce
<!--
Make sure to include command you used to run `act`
e.g.:
1. Clone example repo (https://github.com/cplee/github-actions-demo)
2. Enter cloned repo directory
3. Run `act -s SUPER_SECRET=im-a-value`
- Make sure to include full command with parameters you used to run `act`, example:
1. Clone example repo (https://github.com/cplee/github-actions-demo)
2. Enter cloned repo directory
3. Run `act -s SUPER_SECRET=im-a-value`
-->


## `act` output

<!-- Paste output from your terminal, use `-v` or `--verbose` for richer output -->
<!--
- Use `act` with `-v`/`--verbose` and paste output from your terminal in code block below
-->

<details>
<summary>Log</summary>

```none
PASTE YOUR LOG HERE
```

</details>
1 change: 1 addition & 0 deletions .github/linters/.golangci.yml
11 changes: 11 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Default state for all rules
default: true

# MD013/line-length - Line length
MD013: false

# MD033/no-inline-html - Inline HTML
MD033: false

# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
MD041: false
16 changes: 15 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: golangci/golangci-lint-action@v2
env:
CGO_ENABLED: 0
with:
version: v1.32.2
version: v1.39.0
- uses: github/super-linter@v3
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: .*testdata/*
VALIDATE_ALL_CODEBASE: ${{ github.event_name != 'pull_request' }} # lint only new changes when pull_request
VALIDATE_BASH: false
VALIDATE_DOCKERFILE: false
VALIDATE_DOCKERFILE_HADOLINT: false
VALIDATE_GO: false # it's broken, see commit message
VALIDATE_JSCPD: false
VALIDATE_SHELL_SHFMT: false

test:
name: Test on Linux
Expand Down
27 changes: 15 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ linters-settings:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
mi-complexity: 15
gocritic:
disabled-checks:
disabled-checks:
- ifElseChain

linters:
enable:
- megacheck
- govet
- golint
- gocyclo
- gosec
- unconvert
- dupl
- nakedret
- prealloc
- scopelint
- gocritic
- megacheck
- govet
- golint
- gocyclo
- gosec
- unconvert
- dupl
- nakedret
- prealloc
- exportloopref
- gocritic
- goimports
- whitespace
- misspell
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fix"
]
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you've identified a bug in `act`, please [submit an issue](#issue) to our Git

All feature requests should start with [submitting an issue](#issue) documenting the user story and acceptance criteria. Again, feel free to submit a [Pull Request](#pr) with a proposed implementation of the feature.

## <a name="process"></a> Ready to Contribute!
## <a name="process"></a> Ready to Contribute

### <a name="issue"></a> Create an issue

Expand Down
47 changes: 46 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@ MINOR_VERSION = $(word 2, $(subst ., ,$(VERSION)))
PATCH_VERSION = $(word 3, $(subst ., ,$(word 1,$(subst -, , $(VERSION)))))
NEW_VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION).$(shell echo $$(( $(PATCH_VERSION) + 1)) )

fix = false
ifeq (true,$(fix))
FIX = --fix
endif

ACT ?= go run main.go
export GITHUB_TOKEN := $(shell cat ~/.config/github/token)

HAS_TOKEN = $(if $(test -e ~/.config/github/token),true,false)
ifeq (true,$(HAS_TOKEN))
export GITHUB_TOKEN := $(shell cat ~/.config/github/token)
endif

.PHONY: build
build:
Expand All @@ -22,6 +31,42 @@ test:
go test ./...
$(ACT)

.PHONY: lint-go
lint-go:
golangci-lint run $(FIX)

.PHONY: lint-js
lint-js:
standard $(FIX)

.PHONY: lint-md
lint-md:
markdownlint . $(FIX)

.PHONY: lint-rest
lint-rest:
docker run --rm -it \
-e 'RUN_LOCAL=true' \
-e 'FILTER_REGEX_EXCLUDE=.*testdata/*' \
-e 'VALIDATE_BASH=false' \
-e 'VALIDATE_DOCKERFILE=false' \
-e 'VALIDATE_DOCKERFILE_HADOLINT=false' \
-e 'VALIDATE_GO=false' \
-e 'VALIDATE_JSCPD=false' \
-e 'VALIDATE_SHELL_SHFMT=false' \
-v $(PWD):/tmp/lint \
github/super-linter

.PHONY: lint
lint: lint-go lint-rest

.PHONY: lint-fix
lint-fix: lint-md lint-go

.PHONY: fix
fix:
make lint-fix fix=true

.PHONY: install
install: build
@cp dist/local/act $(PREFIX)/bin/act
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
![](https://github.com/nektos/act/wiki/img/logo-150.png)
![act-logo](https://github.com/nektos/act/wiki/img/logo-150.png)

# Overview [![push](https://github.com/nektos/act/workflows/push/badge.svg?branch=master&event=push)](https://github.com/nektos/act/actions) [![Join the chat at https://gitter.im/nektos/act](https://badges.gitter.im/nektos/act.svg)](https://gitter.im/nektos/act?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/nektos/act)](https://goreportcard.com/report/github.com/nektos/act) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners)


> "Think globally, `act` locally"
Run your [GitHub Actions](https://developer.github.com/actions/) locally! Why would you want to do this? Two reasons:
Expand All @@ -21,6 +20,7 @@ Let's see it in action with a [sample repo](https://github.com/cplee/github-acti
# Installation

## Necessary prerequisites for running `act`

`act` depends on `docker` to run workflows.

If you are using macOS, please be sure to follow the steps outlined in [Docker Docs for how to install Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/).
Expand Down Expand Up @@ -48,22 +48,23 @@ curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
If you are running Windows, download the [latest release](https://github.com/nektos/act/releases/latest) and add the binary into your PATH.
If you are using [Chocolatey](https://chocolatey.org/) then run:

[![](https://img.shields.io/chocolatey/v/act-cli)](https://community.chocolatey.org/packages/act-cli)
[![choco-shield](https://img.shields.io/chocolatey/v/act-cli)](https://community.chocolatey.org/packages/act-cli)

```shell
choco install act-cli
```

If you are using [Scoop](https://scoop.sh/) then run:

[![](https://img.shields.io/scoop/v/act)](https://github.com/ScoopInstaller/Main/blob/master/bucket/act.json)
[![scoop-shield](https://img.shields.io/scoop/v/act)](https://github.com/ScoopInstaller/Main/blob/master/bucket/act.json)

```shell
scoop install act
```

If you are running Arch Linux, you can install the [act](https://aur.archlinux.org/packages/act/) package with your favorite package manager:

[![](https://img.shields.io/aur/version/act)](https://aur.archlinux.org/packages/act/)
[![aur-shield](https://img.shields.io/aur/version/act)](https://aur.archlinux.org/packages/act/)

```shell
yay -S act
Expand Down Expand Up @@ -315,7 +316,7 @@ Want to contribute to act? Awesome! Check out the [contributing guidelines](CONT

## Building from source

- Install Go tools 1.16+ - (https://golang.org/doc/install)
- Install Go tools 1.16+ - (<https://golang.org/doc/install>)
- Clone this repo `git clone [email protected]:nektos/act.git`
- Run unit tests with `make test`
- Build and install: `make install`
1 change: 0 additions & 1 deletion cmd/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
)

func drawGraph(plan *model.Plan) error {

drawings := make([]*common.Drawing, 0)

jobPen := common.NewPen(common.StyleSingleLine, 96)
Expand Down
4 changes: 0 additions & 4 deletions pkg/common/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ func CopyFile(source string, dest string) (err error) {
if err != nil {
_ = os.Chmod(dest, sourceinfo.Mode())
}

}

return
}

// CopyDir recursive copy of directory
func CopyDir(source string, dest string) (err error) {

// get properties of source dir
sourceinfo, err := os.Stat(source)
if err != nil {
Expand All @@ -55,7 +53,6 @@ func CopyDir(source string, dest string) (err error) {
objects, err := directory.Readdir(-1)

for _, obj := range objects {

sourcefilepointer := source + "/" + obj.Name()

destinationfilepointer := dest + "/" + obj.Name()
Expand All @@ -73,7 +70,6 @@ func CopyDir(source string, dest string) (err error) {
fmt.Println(err)
}
}

}
return err
}
1 change: 0 additions & 1 deletion pkg/common/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
// Repos on disk point to commit hashes, and need to checkout input.Ref before
// we try and pull down any changes
if hash.String() != input.Ref {

// Run git fetch to make sure we have the latest sha
err := r.Fetch(&git.FetchOptions{})
if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) {
Expand Down
1 change: 0 additions & 1 deletion pkg/common/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestFindGitSlug(t *testing.T) {
assert.Equal(tt.provider, provider)
assert.Equal(tt.slug, slug)
}

}

func testDir(t *testing.T) string {
Expand Down
1 change: 0 additions & 1 deletion pkg/container/docker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func NewDockerBuildExecutor(input NewDockerBuildExecutorInput) common.Executor {
}
return nil
}

}
func createBuildContext(contextDir string, relDockerfile string) (io.ReadCloser, error) {
log.Debugf("Creating archive for build context dir '%s' with relative dockerfile '%s'", contextDir, relDockerfile)
Expand Down
2 changes: 0 additions & 2 deletions pkg/container/docker_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ func NewDockerPullExecutor(input NewDockerPullExecutorInput) common.Executor {
return err
}
return nil

}

}

func cleanImage(image string) string {
Expand Down
1 change: 0 additions & 1 deletion pkg/container/docker_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ func (cr *containerReference) UpdateFromGithubEnv(env *map[string]string) common
}

func (cr *containerReference) Exec(command []string, env map[string]string) common.Executor {

return common.NewPipelineExecutor(
cr.connect(),
cr.find(),
Expand Down
Loading

0 comments on commit d3c6801

Please sign in to comment.