Skip to content

Commit 38fcc09

Browse files
author
Dan Brakeley
authored
add github actions for PR checks and adding zip builds to releases (#1)
1 parent 6ec69ed commit 38fcc09

4 files changed

Lines changed: 63 additions & 24 deletions

File tree

.github/workflows/release.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: build release zip
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
release:
9+
name: Release Go Binary
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: wangyoucao577/go-release-action@v1.20
14+
with:
15+
github_token: ${{ secrets.GITHUB_TOKEN }}
16+
goos: windows
17+
goarch: amd64
18+
goversion: "1.17.2"
19+
project_path: "./cmd/p4harmonize"
20+
extra_files: LICENSE.txt README.md

.github/workflows/test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: validate commit
2+
on: [pull_request]
3+
jobs:
4+
build:
5+
strategy:
6+
matrix:
7+
os: [ubuntu-20.04, windows-2019]
8+
go-ver: [1.17.2]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-go@v2
13+
with:
14+
go-version: ${{ matrix.go-ver }}
15+
- run: go test ./...
16+
- run: go build ./cmd/p4harmonize

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
`p4harmonize` is a tool for getting the head revision of a stream on one perforce server to mirror the head revision from some other perforce server. It can reconcile files, fix differences in file name/path capitalization, fix the file type, and fix improperly checked in AppleDouble files created by the "apple" file type.
66

7-
`p4harmonize` was built with Unreal Engine releases in mind, where the Epic licensee perforce server is used as the source, and a dedicated stream on a project's perforce server is used as the destination. It is intended to be used with a setup similar to [the one recommended by Epic](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/UpdatingSourceCode/#option3:usingperforce). At Proletariat, we have different names, but the purposes are the same:
7+
`p4harmonize` was built with Unreal Engine releases in mind, where the Epic licensee perforce server is used as the source, and a dedicated stream on a project's perforce server is used as the destination. It is intended to be used with a setup similar to [the one recommended by Epic](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/DownloadingSourceCode/UpdatingSourceCode/#integrating,merging,andbranching). At Proletariat, we have different names, but the purposes are the same:
88

99
name | description
1010
--- | ---
@@ -14,15 +14,17 @@ name | description
1414

1515
## Install
1616

17-
There's no pre-packaged binaries at this point, so you'll need to build one yourself. To do that, you'll need [git](https://git-scm.com/downloads) and a [recent version of Go](https://golang.org/dl/), and then you can just use the [go install](https://golang.org/ref/mod#go-install) command to download, build, and put the result in your path:
17+
You can download the latest Windows executable from the [releases page](https://github.com/proletariatgames/p4harmonize/releases), or you can build it yourself.
18+
19+
To build it, you'll need [git](https://git-scm.com/downloads) and a [recent version of Go](https://golang.org/dl/), and then you can just use the [go install](https://golang.org/ref/mod#go-install) command to download, build, and put the result in your path:
1820

1921
```text
2022
go install github.com/proletariatgames/p4harmonize
2123
```
2224

2325
## Usage
2426

25-
`p4harmonize` pulls configuration from a `config.toml` file, which it looks for in the current folder. You can change where it looks by passing `-config <filename>`.
27+
`p4harmonize` pulls configuration from a `config.toml` file, which it looks for in the current working directory. You can change where it looks by passing `-config <filename>`.
2628

2729
Here's an example `config.toml` file:
2830

@@ -46,7 +48,7 @@ new_client_stream = "//test/engine_epic" # this needs to already exist
4648

4749
While it runs, it outputs status updates and every individual `p4` command it is running so you can follow along. Note that for an Unreal Engine upgrade, this process can easily take hours to complete.
4850

49-
When it is done, you still need to go in and submit the changelist it created yourself. This gives you an opportunity to sanity check the work before it gets added to your Perforce depot. This also allows you to keep the destination locked until the moment you are ready to submit the changes.
51+
When it is done, you still need to go in and submit the changelist it created yourself. This gives you an opportunity to sanity check the work before it gets added to your Perforce depot.
5052

5153
## Runtime requirements
5254

@@ -62,7 +64,7 @@ When it is done, you still need to go in and submit the changelist it created yo
6264

6365
## Development setup
6466

65-
To write code and create builds, you just need the deps listed above (git, Go, p4, and bash). If you want to run the functional tests, where p4harmonize is run against two test Perforce servers, you will also need Docker. On Windows and Mac, you'll want [Docker Desktop](https://www.docker.com/products/docker-desktop), and on Linux you'll want [Docker Server](https://docs.docker.com/engine/install/#server).
67+
To write code and create builds, you just need the deps listed above (git, Go, p4, and bash). If you want to run the functional tests, you will also need Docker. On Windows and Mac, you'll want [Docker Desktop](https://www.docker.com/products/docker-desktop), and on Linux you'll want [Docker Server](https://docs.docker.com/engine/install/#server).
6668

6769
Once you have all that installed, you can clone down the source code with git:
6870

@@ -80,16 +82,16 @@ There's a `magefile.go` in the root folder that automates building/testing, and
8082
$ mage
8183
Targets:
8284
build tests and builds the app (output goes to "local" folder)
83-
longTest Runs integration tests (spins up perforce servers via docker, then brings them down at the end).
84-
run unit tests, builds, and runs the app
85-
testDown kills and deletes the test perforce servers.
86-
testPrep gets everything ready for a run against test servers, and can be used to reset test servers after a test run.
87-
testUp brings up a test environment with two perforce servers, on ports 1667 and 1668, to act as the source and destination perforce servers for testing p4harmonize.
85+
longTest runs a fresh build of p4harmonize against test files in docker-hosted perforce servers.
86+
run runs unit tests, builds, and runs the app
87+
testDown brings down and removes the docker contains started by TestUp.
88+
testPrep runs testDown, then testUp, then executes `test/prop.sh` to fill the servers with test data.
89+
testUp brings up two empty perforce servers via Docker, listening on ports 1667 and 1668, with a single super user named "super" (no password).
8890
```
8991

90-
Note that mage target names are not case sensitive, ie `mage longTest` and `mage longtest` will all do the same thing.
92+
Note that mage target names are not case sensitive, ie `mage longTest` and `mage longtest` are interpreted the same.
9193

92-
If you see "No .go files marked with the mage build tag in this directory", make sure you there is a `magefile.go` in the current folder (`mage` does not look to parent folders for magefiles).
94+
If you see `No .go files marked with the mage build tag in this directory`, make sure you there is a `magefile.go` in the current folder (Mage does not look to parent folders for magefiles).
9395

9496
The `build` and `run` targets will run unit tests and build an executable in a folder named `local` (which is where it will look for a `config.toml` file).
9597

magefile.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func Build() {
3232
sh.Cmdf("go build -o local/%s ./cmd/%s", target, cmd).Run()
3333
}
3434

35-
// Run unit tests, builds, and runs the app
35+
// Run runs unit tests, builds, and runs the app
3636
func Run() {
3737
mg.Deps(Build)
3838

@@ -44,15 +44,15 @@ func Run() {
4444
})
4545
}
4646

47-
// Runs integration tests (spins up perforce servers via docker, then brings them down at the end).
47+
// LongTest runs a fresh build of p4harmonize against test files in docker-hosted perforce servers.
4848
func LongTest() {
4949
mg.SerialDeps(Build, TestPrep)
5050
defer TestDown()
5151

5252
target := sh.ExeName(cmd)
5353

5454
sh.InDir("local", func() {
55-
sh.Echo("Running integration tests...")
55+
sh.Echo("Running p4harmonize against test servers...")
5656
sh.Cmdf("%s -config ../test/config.toml", target).Run()
5757
})
5858
sh.InDir("test", func() {
@@ -69,28 +69,29 @@ func LongTest() {
6969
sh.Echo("***")
7070
}
7171

72-
// TestPrep gets everything ready for a run against test servers, and can
73-
// be used to reset test servers after a test run.
72+
// TestPrep runs testDown, then testUp, then executes `test/prop.sh` to fill the servers with test data.
7473
func TestPrep() {
7574
mg.SerialDeps(TestDown, TestUp)
75+
sh.InDir("test", func() {
76+
sh.Echo("Running test/prep.sh...")
77+
sh.Cmdf("./prep.sh").Bash()
78+
})
7679
sh.RemoveAll("./local/p4/dst")
7780
}
7881

79-
// TestUp brings up a test environment with two perforce servers, on ports 1667 and 1668, to act as the
80-
// source and destination perforce servers for testing p4harmonize.
82+
// TestUp brings up two empty perforce servers via Docker, listening on ports 1667 and 1668, with
83+
// a single super user named "super" (no password).
8184
func TestUp() {
8285
sh.InDir("test", func() {
83-
sh.Echo("Running docker compose...")
86+
sh.Echo("Bringing up test perforce servers on local ports 1667 and 1668...")
8487
sh.Cmdf("docker compose up --detach --force-recreate --build").Run()
85-
sh.Echo("Running prep.sh...")
86-
sh.Cmdf("./prep.sh").Bash()
8788
})
8889
}
8990

90-
// TestDown kills and deletes the test perforce servers.
91+
// TestDown brings down and removes the docker contains started by TestUp.
9192
func TestDown() {
9293
sh.InDir("test", func() {
93-
sh.Echo("Stopping and removing containers...")
94+
sh.Echo("Stopping and removing test perforce servers...")
9495
sh.Cmdf("docker compose stop -t 1").Run()
9596
sh.Cmdf("docker compose rm -f").Run()
9697
})

0 commit comments

Comments
 (0)