[workflows]: Remove silliness (for real this time)
This commit is contained in:
40
.github/workflows/ci.yml
vendored
40
.github/workflows/ci.yml
vendored
@ -13,31 +13,7 @@ on:
|
|||||||
- "**.py"
|
- "**.py"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_python_changes:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
run_tests: ${{ steps.check_files.outputs.run_tests }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Check if Python files changed
|
|
||||||
id: check_files
|
|
||||||
run: |
|
|
||||||
git fetch origin ${{ github.event.before }}
|
|
||||||
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '\.py$'; then
|
|
||||||
echo "Python files changed"
|
|
||||||
echo "run_tests=true" >> $GITHUB_ENV
|
|
||||||
echo "::set-output name=run_tests::true"
|
|
||||||
else
|
|
||||||
echo "No Python files changed, skipping tests"
|
|
||||||
echo "run_tests=false" >> $GITHUB_ENV
|
|
||||||
echo "::set-output name=run_tests::false"
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
needs: check_python_changes
|
|
||||||
if: needs.check_python_changes.outputs.run_tests == 'true'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
@ -58,6 +34,14 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r server/src/requirements.txt
|
pip install -r server/src/requirements.txt
|
||||||
|
|
||||||
|
- name: Configure AWS Credentials for Tests
|
||||||
|
run: |
|
||||||
|
echo "Setting AWS region and mock credentials..."
|
||||||
|
export AWS_REGION=us-east-1
|
||||||
|
export AWS_ACCESS_KEY_ID=fake_access_key
|
||||||
|
export AWS_SECRET_ACCESS_KEY=fake_secret_key
|
||||||
|
export AWS_DEFAULT_REGION=us-east-1
|
||||||
|
|
||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
run: |
|
run: |
|
||||||
export PYTHONPATH=$(pwd)/server/src
|
export PYTHONPATH=$(pwd)/server/src
|
||||||
@ -80,14 +64,15 @@ jobs:
|
|||||||
- name: Show coverage summary
|
- name: Show coverage summary
|
||||||
run: cat coverage.xml
|
run: cat coverage.xml
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: test
|
needs: test # Ensures deployment happens only if tests pass
|
||||||
if: success() || needs.check_python_changes.outputs.run_tests == 'false' # Deploy if tests pass OR no Python changes
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref == 'refs/heads/main' # Deploy only from main branch
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
function_name: [fetch_permanent_data, return_luas_data, return_station_data, fetch_transient_data, return_permanent_data, return_transient_data]
|
function_name: [fetch_permanent_data, return_luas_data, return_station_data, fetch_transient_data __pycache__ return_permanent_data return_transient_data]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@ -98,6 +83,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.13'
|
python-version: '3.13'
|
||||||
|
|
||||||
|
# ✅ Check if AWS CLI is installed and update it instead of reinstalling
|
||||||
- name: Check AWS CLI version
|
- name: Check AWS CLI version
|
||||||
run: aws --version || echo "AWS CLI not found"
|
run: aws --version || echo "AWS CLI not found"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user