-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add workflows for external and internal PRs with unit and integration tests #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ab1011b
feat: add workflows for external and internal PRs with unit and integ…
bonnie57 0f06ce1
refactor: remove unused wallet secrets from workflows and simplify in…
bonnie57 fb4ce00
Potential fix for code scanning alert no. 15: Workflow does not conta…
bonnie57 202590a
Potential fix for code scanning alert no. 9: Workflow does not contai…
bonnie57 1f323b9
Potential fix for code scanning alert no. 12: Workflow does not conta…
bonnie57 b8199d0
Potential fix for code scanning alert no. 10: Workflow does not conta…
bonnie57 feb0743
feat: add build and test workflow for CI/CD with integration test rep…
bonnie57 a85f91f
fix: simplify SHA retrieval logic in internal PR workflow
bonnie57 ed6e0d5
Potential fix for code scanning alert no. 16: Workflow does not conta…
bonnie57 a37f7de
Potential fix for code scanning alert no. 11: Workflow does not conta…
bonnie57 f8c9443
chore: update uv setup action version and add dependency installation…
bonnie57 302dfcc
chore: add debug print statement in test configuration
bonnie57 f21ba9e
chore: update workflow references to use the new build-and-test workflow
bonnie57 e85488d
chore: update workflow permissions from read to write for build and P…
bonnie57 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| name: Workflow for Building and Testing | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| sha: | ||
| required: true | ||
| type: string | ||
| ENVIRONMENT: | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| WALLET_PRIVATE_KEY: | ||
| required: true | ||
| WALLET_ADDRESS: | ||
| required: true | ||
| RPC_PROVIDER_URL: | ||
| required: true | ||
|
|
||
| jobs: | ||
| build_and_test: | ||
| name: Build and Test | ||
| permissions: | ||
| contents: write | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| environment: ${{ inputs.ENVIRONMENT }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.10"] | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }} | ||
| WALLET_ADDRESS: ${{ secrets.WALLET_ADDRESS }} | ||
| RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }} | ||
|
|
||
| steps: | ||
| - name: Set Timestamp | ||
| run: | | ||
| echo "TIMESTAMP=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV | ||
|
|
||
| - name: Check out code | ||
| uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
| with: | ||
| ref: ${{ inputs.sha }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 #v7 | ||
| with: | ||
| version: "0.9.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: uv pip install --system -e ".[dev]" | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| coverage run -m pytest tests/unit -v -ra -q | ||
| coverage report | ||
|
|
||
| - name: Run integration tests | ||
| run: | | ||
| pytest -v -ra --html=report.html --self-contained-html | ||
|
|
||
| - name: Rename Integration Test Report | ||
| run: | | ||
| mkdir -p report | ||
| mv -f report.html report/report-${{ env.TIMESTAMP }}.html | ||
|
|
||
| - name: Deploy Integration Test Report | ||
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e #v4.0.0 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: report | ||
| keep_files: true | ||
| allow_empty_commit: true | ||
|
|
||
| - name: Add Github Page Link to Summary | ||
| run: | | ||
| repo_name=$(echo "${{ github.repository }}" | cut -d'/' -f2) | ||
| github_pages_url="https://${{ github.repository_owner }}.github.io/${repo_name}/report-${{ env.TIMESTAMP }}.html" | ||
| echo "## 📊Github Page Link: [View Test Report](${github_pages_url})" >> $GITHUB_STEP_SUMMARY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Workflow for External PRs with Unit & Integration Tests | ||
| permissions: | ||
| contents: write | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, synchronize] | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| Timestamp_PR_CREATED: | ||
| uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main | ||
| authorize: | ||
| if: github.event.pull_request.head.repo.full_name != github.repository | ||
| needs: [Timestamp_PR_CREATED] | ||
| environment: "aeneid" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - run: true | ||
|
|
||
| Timestamp_PR_APPROVED: | ||
| needs: [authorize] | ||
| uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main | ||
|
|
||
| tests: | ||
| needs: [authorize, Timestamp_PR_APPROVED] | ||
| uses: ./.github/workflows/build-and-test-workflow.yml | ||
| with: | ||
| sha: ${{ github.event.pull_request.head.sha }} | ||
| ENVIRONMENT: "aeneid" | ||
| secrets: | ||
| WALLET_ADDRESS: ${{ secrets.WALLET_ADDRESS }} | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }} | ||
| RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Workflow for Internal PRs with Unit & Integration Tests | ||
| permissions: | ||
| contents: write | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| Timestamp: | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch' }} | ||
| uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main | ||
|
|
||
| tests: | ||
bonnie57 marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
|
||
| needs: [Timestamp] | ||
| uses: ./.github/workflows/build-and-test-workflow.yml | ||
| with: | ||
| sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | ||
| ENVIRONMENT: "aeneid" | ||
| secrets: | ||
| WALLET_ADDRESS: ${{ secrets.WALLET_ADDRESS }} | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }} | ||
| RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.