From 1237c6470b1fd4fee956fd691f44790624b1f75a Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 16:55:42 +0100 Subject: [PATCH 1/8] First attempt of the github workflow. --- .github/workflow/ci.yaml | 25 +++++++++++++++++++++++++ .travis.yml | 8 -------- go.mod | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 .github/workflow/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflow/ci.yaml b/.github/workflow/ci.yaml new file mode 100644 index 0000000..c30523a --- /dev/null +++ b/.github/workflow/ci.yaml @@ -0,0 +1,25 @@ +name: CI +on: + push: + pull_request: + schedule: + - cron: "0 0 * * 0" + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkoout/@v2 + + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: "1.15" + + - name: Install dependencies + run: go mod vendor -v + + - name: Run go test + run: go test -ldflags "-s -w" -coverprofile coverage.txt -covermode atomic ./cmd/... ./pkg/... diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1073538..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go - -go: - - "1.14" - -script: - - go test -ldflags "-s -w" ./cmd/... ./pkg/... - - go vet -ldflags "-s -w" ./cmd/... ./pkg/... \ No newline at end of file diff --git a/go.mod b/go.mod index 858390e..9f76d40 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/factorio-item-browser/export-icon-renderer -go 1.14 +go 1.15 require ( github.com/anthonynsimon/bild v0.11.2-0.20200422162521-c58fb61a4c52 From c12ca6151d045363bf258a16891214ef1e570ec3 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 16:58:03 +0100 Subject: [PATCH 2/8] Fixed typo. --- .github/{workflow => workflows}/ci.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflow => workflows}/ci.yaml (100%) diff --git a/.github/workflow/ci.yaml b/.github/workflows/ci.yaml similarity index 100% rename from .github/workflow/ci.yaml rename to .github/workflows/ci.yaml From dc26de2d400fb7ca7dc6042ef2c0721c2b574f75 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 16:59:03 +0100 Subject: [PATCH 3/8] Fixed typo. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c30523a..17edfcd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkoout/@v2 + uses: actions/checkout/@v2 - name: Setup Go uses: actions/setup-go@v1 From 0b88672779f93b8ddfd85f60e199dfa8837fc8a5 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 17:05:19 +0100 Subject: [PATCH 4/8] Added coverage upload and go vet. --- .github/workflows/ci.yaml | 49 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 17edfcd..a60d902 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,8 +6,12 @@ on: - cron: "0 0 * * 0" jobs: - tests: - name: Tests + test: + name: Test + strategy: + matrix: + go-version: + - "1.15" runs-on: ubuntu-latest steps: - name: Checkout @@ -16,10 +20,49 @@ jobs: - name: Setup Go uses: actions/setup-go@v1 with: - go-version: "1.15" + go-version: ${{ matrix.go-version }} - name: Install dependencies run: go mod vendor -v - name: Run go test run: go test -ldflags "-s -w" -coverprofile coverage.txt -covermode atomic ./cmd/... ./pkg/... + + - name: Check coverage.txt existence + id: check-coverage-file + if: ${{ always() }} + uses: andstor/file-existence-action@v1 + with: + files: coverage.txt + + - name: Upload coverage as artifacts + if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }} + uses: actions/upload-artifact@v2 + with: + name: coverage-${{ matrix.go-version }} + path: coverage.txt + + - name: Upload coverage to Codecov + if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }} + uses: codecov/codecov-action@v1 + with: + name: coverage-${{ matrix.go-version }} + file: coverage.txt + + vet: + name: Vet + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout/@v2 + + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: "1.15" + + - name: Install dependencies + run: go mod vendor -v + + - name: Run go vet + run: go vet -ldflags "-s -w" ./cmd/... ./pkg/... From dba64b1a8dce049872c49d4d1afdaaa14aac9550 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 17:10:14 +0100 Subject: [PATCH 5/8] Added cache to go modules. --- .github/workflows/ci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a60d902..e34c843 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,6 +22,13 @@ jobs: with: go-version: ${{ matrix.go-version }} + - name: Cache go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go-mod- + - name: Install dependencies run: go mod vendor -v @@ -61,6 +68,13 @@ jobs: with: go-version: "1.15" + - name: Cache go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go-mod- + - name: Install dependencies run: go mod vendor -v From 8763056afe50b2f8a32b30b4a36a96f7434f1344 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 17:38:27 +0100 Subject: [PATCH 6/8] Updated the README.md file. --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c7f406c..87c46bc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# Factorio Item Browser - Export Icon Renderer +![Factorio Item Browser](https://raw.githubusercontent.com/factorio-item-browser/documentation/master/asset/image/logo.png) + +# Export Icon Renderer + +[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/factorio-item-browser/export-icon-renderer)](https://github.com/factorio-item-browser/export-icon-renderer/releases) +[![GitHub](https://img.shields.io/github/license/factorio-item-browser/export-icon-renderer)](LICENSE.md) +[![build](https://img.shields.io/github/workflow/status/factorio-item-browser/export-icon-renderer/CI?logo=github)](https://github.com/factorio-item-browser/export-icon-renderer/actions) +[![Codecov](https://img.shields.io/codecov/c/gh/factorio-item-browser/export-icon-renderer?logo=codecov)](https://codecov.io/gh/factorio-item-browser/export-icon-renderer) This project implements the icon renderer of the export in Go for fast processing of the images as layers. The icon renderer was first part of the exporter itself (i.e. PHP), but after discovering performance issues especially with From 15e508c7efbeaf4089f5127452fccdfedbed8e7c Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 17:41:06 +0100 Subject: [PATCH 7/8] Testing failing test. --- pkg/io/io_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/io/io_test.go b/pkg/io/io_test.go index 4d8f4cf..f977206 100644 --- a/pkg/io/io_test.go +++ b/pkg/io/io_test.go @@ -40,7 +40,7 @@ func TestLoad(t *testing.T) { }{ { name: "icon from actual mod", - fileName: "__foo__/graphics/icon.png", + fileName: "__bar__/graphics/icon.png", expectedResult: &image.RGBA{ Pix: []uint8{ 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, From 03c3b11a1dc3d860190bfa98d3b5d270632a3599 Mon Sep 17 00:00:00 2001 From: BluePsyduck Date: Wed, 11 Nov 2020 17:50:37 +0100 Subject: [PATCH 8/8] Test failed successfully. Reverted last change. --- pkg/io/io_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/io/io_test.go b/pkg/io/io_test.go index f977206..4d8f4cf 100644 --- a/pkg/io/io_test.go +++ b/pkg/io/io_test.go @@ -40,7 +40,7 @@ func TestLoad(t *testing.T) { }{ { name: "icon from actual mod", - fileName: "__bar__/graphics/icon.png", + fileName: "__foo__/graphics/icon.png", expectedResult: &image.RGBA{ Pix: []uint8{ 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF,