Discrete Poisson solver English suggestions #84
This file contains 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
name: "Test Library CI (dev)" | |
# please note the comments in `test-CI-main.yml` | |
on: | |
push: | |
branches: | |
- dev | |
pull_request_target: | |
branches: | |
- dev | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
# | |
# Setup Repository | |
# | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Checkout the target branch | |
id: checkout | |
run: | | |
set -ex | |
# Debugging: initial git status | |
echo "==== Git status before checkout ====" | |
git status | |
# Handle different GitHub Actions events | |
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | |
echo "Handling pull_request_target event" | |
echo "SHOULD_TEST_ALL_FILES=false" >> $GITHUB_ENV | |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then | |
echo "PR from a fork detected. Checking out the fork's branch." | |
git remote add fork https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git | |
git fetch fork ${{ github.event.pull_request.head.ref }} | |
git checkout -B ci-testing-branch FETCH_HEAD # Tested code is comming from this branch (contributer's) | |
else | |
echo "PR from the same repository detected. Checking out the branch." | |
git fetch origin ${{ github.event.pull_request.head.ref }} | |
git checkout ${{ github.event.pull_request.head.ref }} | |
fi | |
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
echo "Handling workflow_dispatch event: No checkout needed" | |
echo "SHOULD_TEST_ALL_FILES=true" >> $GITHUB_ENV | |
echo "list_of_ipynb_changed=**/*.ipynb" >> $GITHUB_ENV | |
elif [[ "${{ github.event_name }}" == "push" ]]; then | |
echo "Handling push event: No checkout needed" | |
else | |
echo "Unsupported event type: ${github.event_name}. Exiting." | |
exit 1 | |
fi | |
# Debugging: final git status | |
echo "==== Git status after checkout ====" | |
git status | |
# | |
# Setup Python | |
# | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
# | |
# Setup Environment | |
# | |
# Configure AWS credentials | |
- name: Configure AWS Credentials | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE }} | |
aws-region: us-east-1 | |
mask-aws-account-id: true | |
- name: Install dependencies | |
run: | | |
set -e | |
python -m pip install -U pip \ | |
--extra-index-url https://pypi.org/simple | |
# Install "classiq" separately | |
export CODEARTIFACT_AUTH_TOKEN="$( \ | |
aws codeartifact get-authorization-token \ | |
--domain ${{ secrets.CODEARTIFACT_DOMAIN }} \ | |
--domain-owner ${{ secrets.CODEARTIFACT_OWNER }} \ | |
--region ${{ secrets.CODEARTIFACT_REGION }} \ | |
--query authorizationToken \ | |
--output text \ | |
)" | |
python -m pip install -U --pre \ | |
--extra-index-url "https://aws:$CODEARTIFACT_AUTH_TOKEN@${{ secrets.CODEARTIFACT_DOMAIN }}-${{ secrets.CODEARTIFACT_OWNER }}.d.codeartifact.${{ secrets.CODEARTIFACT_REGION }}.amazonaws.com/pypi/${{ secrets.PYPI_NIGHTLY_NAME }}/simple/" \ | |
--extra-index-url https://pypi.org/simple \ | |
classiq | |
# Install everything from the requirements, other than "classiq". | |
python -m pip install -U $(grep -ivE "classiq" requirements.txt) \ | |
--extra-index-url https://pypi.org/simple | |
python -m pip install -U -r requirements_tests.txt \ | |
--extra-index-url https://pypi.org/simple | |
# Set authentication with M2M token | |
- name: Set authentication | |
run: .github/scripts/get_m2m_token.sh | |
env: | |
IS_DEV: "true" | |
M2M_SECRET_ARN: "${{ secrets.NIGHTLY_M2M_SECRET_ARN }}" | |
# | |
# Propagate CI information to python tests | |
# | |
- name: Get changed notebook files | |
id: changed-files-ipynb | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
**/*.ipynb | |
# Run Notebook Tests | |
- name: Run Notebooks | |
run: python -m pytest --log-cli-level=INFO tests | |
env: | |
# to disable a warning in Jupyter notebooks | |
JUPYTER_PLATFORM_DIRS: "1" | |
# Passing which notebooks changed | |
SHOULD_TEST_ALL_FILES: "${{ env.SHOULD_TEST_ALL_FILES }}" | |
LIST_OF_IPYNB_CHANGED: "${{ steps.changed-files-ipynb.outputs.all_changed_files }}" | |
# Passing environment information | |
CLASSIQ_IDE: "https://nightly.platform.classiq.io" | |
CLASSIQ_HOST: "https://staging.api.classiq.io" |