Skip to content

added explicit branch annotation #30

added explicit branch annotation

added explicit branch annotation #30

Workflow file for this run

name: CI pipeline for python webserver (src/webserver)
on:
# run ci pipeline upon pull request
pull_request:
branches:
- master
paths:
- src/webserver/**
# run ci pipeline upon push to master, in case
# something goes to shit, and you gotta rollback
push:
branches:
- master
paths:
- src/webserver/**
# or call it manually
workflow_dispatch:
defaults:
run:
shell: bash
# run should be used after checkout i belive.
working-directory: ./src/webserver
jobs:
test_code:
runs-on: ubuntu-latest
name: Run python tests
environment: prod
steps:
- uses: actions/checkout@v4 # does git clone into runner
- uses: actions/setup-python@v5
with:
python-version: '3.11'
update-environment: true # this will source venv i guess
cache: 'pip' # not sure if this neccessary (or what it does but whatever)
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest tests/
# you can also run lint tests, to ensure that the project matches
# your desired codestyle, but well pass it for now.
make_artifact:
runs-on: ubuntu-latest
needs: [test_code] # may not be required i belive, if we want this
# to run in paralel, but i'll do it anyway to make less jobs
environment: prod
env:
ARTIFACT_EXCLUDE: ./.git*
ARTIFACT_NAME: webserver-artifact-${{ github.sha }}.zip
# github doesn't resolve env inside env sadly (or im dumb idk)
ARTIFACT_S3_PATH: >-
${{ secrets.ARTIFACT_S3_BUCKET_NAME }}/webserver-artifact-${{ github.sha }}.zip
steps:
- uses: actions/checkout@v4
- name: Zip archive
run: zip -r ${{ env.ARTIFACT_NAME }} ./ -x ${{ env.ARTIFACT_EXCLUDE }}
- name: Authenticate to aws account
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Copy artifact to S3 bucket
run: aws s3 cp "$ARTIFACT_NAME" "s3://$ARTIFACT_S3_PATH"
# artifact is made, job here is done, next - CD pipeline will deploy it.
# https://stackoverflow.com/a/71158878
use_webserver_cd:
needs: [make_artifact]
uses: ./.github/workflows/webserver_cd_aws_ebs.yaml@${{ github.head_ref || github.ref_name }}

Check failure on line 86 in .github/workflows/3_webserver_ci.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/3_webserver_ci.yaml

Invalid workflow file

invalid value workflow reference: cannot specify version when calling local workflows
secrets: inherit