Skip to content

Commit

Permalink
testing donwload and activate ioncube before encode
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloChianfa committed Sep 2, 2024
1 parent 6e9975a commit e9151db
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 156 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ encrypted
eval_linux
ioncube_encoder_evaluation
ioncube_encoder_evaluation.tar.gz
ioncube_encoder.tar.gz
ioncube_encoder

# Devcontainer
.devcontainer
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ proprietary codebase.

- **Configure Workflow**: Copy the example workflow into your project's
.github/workflows directory, adjusting parameters as needed.
- **Setup secrets**: Setup the needed action secrets into your repository
.github/workflows directory, adjusting parameters as needed.
- **Run Workflow**: Push your changes to trigger the IonCube encoding workflow
and enjoy the automated process.

Expand All @@ -49,7 +51,10 @@ jobs:
uses: actions/checkout@v2

- name: IonCube Encode
uses: MuriloChianfa/ioncube-encoder-action@v1.0.0
uses: MuriloChianfa/ioncube-encoder-action@v1.1.0
# If you're dont using trial version you need to setup the ioncube download url
# env:
# IONCUBE_DOWNLOAD_URL: ${{ secrets.IONCUBE_DOWNLOAD_URL }}
with:
source: 'src'
output: 'encrypted'
Expand All @@ -76,7 +81,10 @@ jobs:
uses: actions/checkout@v2

- name: IonCube Encode Project
uses: MuriloChianfa/ioncube-encoder-action@v1.0.0
uses: MuriloChianfa/ioncube-encoder-action@v1.1.0
# If you're dont using trial version you need to setup the ioncube download url
# env:
# IONCUBE_DOWNLOAD_URL: ${{ secrets.IONCUBE_DOWNLOAD_URL }}
with:
source: 'src'
output: 'encrypted'
Expand All @@ -87,7 +95,10 @@ jobs:
callback-file: /opt/project/public/ioncube.php

- name: IonCube Encode Callback File
uses: MuriloChianfa/ioncube-encoder-action@v1.0.0
uses: MuriloChianfa/ioncube-encoder-action@v1.1.0
# If you're dont using trial version you need to setup the ioncube download url
# env:
# IONCUBE_DOWNLOAD_URL: ${{ secrets.IONCUBE_DOWNLOAD_URL }}
with:
source: 'src/public/ioncube.php'
output: 'encrypted/public/ioncube.php'
Expand Down Expand Up @@ -145,10 +156,15 @@ project</a>.
## Testing this package
```bash
npm run install
npm install
```

```bash
npm run lint
npm run test
npm run package
npm run bundle
# or simple
npm run all
```

### Dependencies
Expand Down
25 changes: 19 additions & 6 deletions __tests__/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ describe('action', () => {
})

it('run succefully with default args', async () => {
getInputMock.mockImplementation(name => {
if (name === 'trial') return true
})

await main.run()
expect(runMock).toHaveReturned()

Expand Down Expand Up @@ -63,19 +67,24 @@ describe('action', () => {
)

// No errors
expect(debugMock).toHaveBeenNthCalledWith(18, 0)
expect(debugMock).toHaveBeenNthCalledWith(19, '')
expect(debugMock).toHaveBeenNthCalledWith(
18,
'./ioncube_encoder_evaluation/ioncube_encoder.sh -C -82 -x86-64 /home/murilo/Github/ioncube-encoder-action/src/inputs -o encrypted --no-doc-comments --optimize more --license-check auto --create-target --replace-target'
)
expect(debugMock).toHaveBeenNthCalledWith(19, 0)
expect(debugMock).toHaveBeenNthCalledWith(20, '')
expect(debugMock).toHaveBeenNthCalledWith(21, '')

expect(setOutputMock).toHaveBeenCalledWith(
'status',
'Project encoded with success'
)
}, 20000)
}, 200000)

it('run succefully with laravel template', async () => {
getInputMock.mockImplementation(name => {
if (name === 'template') return 'laravel'
if (name === 'trial') return true
})

await main.run()
Expand Down Expand Up @@ -125,13 +134,17 @@ describe('action', () => {
)

// No errors
expect(debugMock).toHaveBeenNthCalledWith(18, 0)
expect(debugMock).toHaveBeenNthCalledWith(19, '')
expect(debugMock).toHaveBeenNthCalledWith(
18,
'./ioncube_encoder_evaluation/ioncube_encoder.sh -C -82 -x86-64 /home/murilo/Github/ioncube-encoder-action/src/inputs -o encrypted --binary --no-doc-comments --encrypt "*.blade.php" --optimize max --allow-reflection-all --passphrase "CHANGEME" --with-license /opt/license --callback-file "public/ioncube.php" --license-check script --create-target --replace-target'
)
expect(debugMock).toHaveBeenNthCalledWith(19, 0)
expect(debugMock).toHaveBeenNthCalledWith(20, '')
expect(debugMock).toHaveBeenNthCalledWith(21, '')

expect(setOutputMock).toHaveBeenCalledWith(
'status',
'Project encoded with success'
)
})
}, 200000)
})
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e9151db

Please sign in to comment.