Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huangnauh committed Jan 7, 2021
1 parent 94a0a40 commit 20e6041
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 58 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Build
on: [push, pull_request]

jobs:
Expand All @@ -18,7 +18,6 @@ jobs:

- name: Checkout code
uses: actions/checkout@v2

- name: Download Go modules
run: go mod download

Expand All @@ -30,6 +29,3 @@ jobs:
run: |
go get -u github.com/upyun/upx
upx -v
- name: Test
run: |
go test -v .
54 changes: 27 additions & 27 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: goreleaser

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
name: Release

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
44 changes: 22 additions & 22 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: lint
on:
push:
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
# Optional: golangci-lint command line arguments.
args: --issues-exit-code=0
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
name: Lint
on:
push:
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
# Optional: golangci-lint command line arguments.
args: --issues-exit-code=0
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
go-version: [^1]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
GO111MODULE: "on"
UPYUN_BUCKET1: ${{ secrets.UPYUN_BUCKET1 }}
UPYUN_BUCKET2: ${{ secrets.UPYUN_BUCKET2 }}
UPYUN_PASSWORD: ${{ secrets.UPYUN_PASSWORD }}
UPYUN_USERNAME: ${{ secrets.UPYUN_USERNAME }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download Go modules
run: go mod download
- name: Test
run: |
go build .
go test -v .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ upx
upx-*
release
dist
FILE
list
1 change: 1 addition & 0 deletions putgetrm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func TestPutAndGet(t *testing.T) {

// upx get /path/to/file /path/to/dir/
localPath = filepath.Join(localBase, "getfile") + string(filepath.Separator)
os.MkdirAll(localPath, 0755)
getFile(t, "FILE", localPath, filepath.Join(localPath, "FILE"))

// upx get ../path/to/dir
Expand Down
8 changes: 4 additions & 4 deletions upx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (

var (
ROOT = fmt.Sprintf("/upx-test/%s", time.Now())
BUCKET_1 = "bigfile"
BUCKET_2 = "prog-test"
USERNAME = "myworker"
PASSWORD = "TYGHBNtyghbn"
BUCKET_1 = os.Getenv("UPYUN_BUCKET1")
BUCKET_2 = os.Getenv("UPYUN_BUCKET2")
USERNAME = os.Getenv("UPYUN_USERNAME")
PASSWORD = os.Getenv("UPYUN_PASSWORD")
)

func SetUp() {
Expand Down

0 comments on commit 20e6041

Please sign in to comment.