Add pythonpath again #25
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_stream_announcer | |
on: | |
push: | |
paths: | |
- twitch_stream_announcer/** | |
- .github/workflows/test_stream_announcer.yml | |
pull_request: | |
branches: | |
- develop | |
env: | |
SUBDIRECTORY: twitch_stream_announcer | |
IMAGENAME: twitch_stream_announcer | |
VERSION_NUMBER: 1.0.1 | |
jobs: | |
test_stream_announcer: | |
name: test_stream_announcer_py${{ matrix.python-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
# https://earthly.dev/get-earthly | |
- name: Install Earthly | |
run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' | |
- name: Install | |
working-directory: ${{ env.SUBDIRECTORY }} | |
run: | | |
touch .env | |
earthly +install-dev --verbose true --PYTHONVERSION=${{ matrix.python-version }} | |
- name: Run code checks and tests | |
working-directory: ${{ env.SUBDIRECTORY }} | |
run: earthly +all --verbose true --PYTHONVERSION=${{ matrix.python-version }} | |
build_and_deploy_docker_image: | |
needs: [test_stream_announcer] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker image | |
working-directory: ${{ env.SUBDIRECTORY }} | |
run: | | |
docker build -t burnysc2/${{ env.IMAGENAME }}:latest . | |
docker build -t burnysc2/${{ env.IMAGENAME }}:${{ env.VERSION_NUMBER}} . | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Upload docker image (develop) | |
if: github.ref == 'refs/heads/develop' && github.event_name == 'push' | |
run: | | |
docker push burnysc2/${{ env.IMAGENAME }}:${{ env.VERSION_NUMBER}} | |
docker push burnysc2/${{ env.IMAGENAME }}:latest | |
deploy_backend_dev: | |
if: github.ref == 'refs/heads/develop' | |
needs: [build_and_deploy_docker_image] | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
USERNAME: announcer | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update docker-compose.yml | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
port: 22 | |
username: ${{ env.USERNAME }} | |
key: ${{ secrets.FASTAPISERVERDEVKEY }} | |
passphrase: '' | |
source: "twitch_stream_announcer/docker-compose.yml" | |
target: /home/${{ env.USERNAME }}/ | |
strip_components: 1 | |
# overwrite: true | |
- name: Update docker image on server and restart service | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
port: 22 | |
username: ${{ env.USERNAME }} | |
key: ${{ secrets.FASTAPISERVERDEVKEY }} | |
passphrase: '' | |
script: | | |
cd /home/${{ env.USERNAME }} | |
docker compose down | |
docker compose up -d |