diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index de535da..0000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Codecov -on: - push: - branches: - - master - pull_request: -jobs: - codecov: - uses: goravel/.github/.github/workflows/codecov.yml@master - secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a506286..ebaf25c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,21 @@ on: branches: - master pull_request: +env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_ACCESS_KEY_SECRET: ${{ secrets.AWS_ACCESS_KEY_SECRET }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} + AWS_BUCKET: ${{ secrets.AWS_BUCKET }} + AWS_URL: ${{ secrets.AWS_URL }} jobs: - test: - uses: goravel/.github/.github/workflows/test.yml@master - secrets: inherit + ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: Install dependencies + run: go mod tidy + - name: Run tests + run: go test -timeout 1h ./... diff --git a/s3_test.go b/s3_test.go index 28aaeda..ef7ff04 100644 --- a/s3_test.go +++ b/s3_test.go @@ -12,8 +12,8 @@ import ( "github.com/gookit/color" "github.com/stretchr/testify/assert" - filesystemcontract "github.com/goravel/framework/contracts/filesystem" - configmock "github.com/goravel/framework/mocks/config" + contractsfilesystem "github.com/goravel/framework/contracts/filesystem" + mocksconfig "github.com/goravel/framework/mocks/config" ) func TestStorage(t *testing.T) { @@ -24,15 +24,16 @@ func TestStorage(t *testing.T) { assert.Nil(t, os.WriteFile("test.txt", []byte("Goravel"), 0644)) - mockConfig := &configmock.Config{} - mockConfig.On("GetString", "app.timezone").Return("UTC") - mockConfig.On("GetString", "filesystems.disks.s3.key").Return(os.Getenv("AWS_ACCESS_KEY_ID")) - mockConfig.On("GetString", "filesystems.disks.s3.secret").Return(os.Getenv("AWS_ACCESS_KEY_SECRET")) - mockConfig.On("GetString", "filesystems.disks.s3.region").Return(os.Getenv("AWS_DEFAULT_REGION")) - mockConfig.On("GetString", "filesystems.disks.s3.bucket").Return(os.Getenv("AWS_BUCKET")) - mockConfig.On("GetString", "filesystems.disks.s3.url").Return(os.Getenv("AWS_URL")) + mockConfig := &mocksconfig.Config{} + mockConfig.EXPECT().GetString("app.timezone").Return("UTC") + mockConfig.EXPECT().GetString("filesystems.disks.s3.key").Return(os.Getenv("AWS_ACCESS_KEY_ID")) + mockConfig.EXPECT().GetString("filesystems.disks.s3.secret").Return(os.Getenv("AWS_ACCESS_KEY_SECRET")) + mockConfig.EXPECT().GetString("filesystems.disks.s3.region").Return(os.Getenv("AWS_DEFAULT_REGION")) + mockConfig.EXPECT().GetString("filesystems.disks.s3.bucket").Return(os.Getenv("AWS_BUCKET")) + mockConfig.EXPECT().GetString("filesystems.disks.s3.url").Return(os.Getenv("AWS_URL")) + mockConfig.EXPECT().GetString("filesystems.disks.s3.token", "").Return("") - var driver filesystemcontract.Driver + var driver contractsfilesystem.Driver url := os.Getenv("AWS_URL") tests := []struct { @@ -404,7 +405,7 @@ type File struct { path string } -func (f *File) Disk(disk string) filesystemcontract.File { +func (f *File) Disk(disk string) contractsfilesystem.File { return &File{} }