This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
Update build_and_test.yml #13
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: Build and Test Streamlit App | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build_run_test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build Docker image | ||
run: docker build -t my-streamlit-app . | ||
- name: Run Streamlit app | ||
run: | | ||
docker run -d --name streamlit-container -p 8505:8505 my-streamlit-app | ||
sleep 10 # Give the container some time to start | ||
- name: Check container status | ||
run: docker inspect streamlit-container | ||
- name: Run Robot Framework tests | ||
run: | | ||
pip install git+https://github.com/robotframework/SeleniumLibrary.git | ||
wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz | ||
tar -xvzf geckodriver* | ||
chmod +x geckodriver | ||
sudo mv geckodriver /usr/local/bin/ | ||
robot tests/ | ||
- name: set lower case owner name | ||
run: | | ||
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV} | ||
env: | ||
REPO: '${{ github.repository }}' | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: '${{ github.repository_owner }}' | ||
password: '${{ secrets.GITHUB_TOKEN }}' | ||
- name: Push image to GitHub Container Registry | ||
run: | | ||
Check failure on line 57 in .github/workflows/build_and_test.yml GitHub Actions / Build and Test Streamlit AppInvalid workflow file
|
||
docker tag my-streamlit-app:latest ghcr.io/${{ github.repository_owner }}/${{ REPO_LC }}:v1.${{ github.run_number }} | ||
docker push ghcr.io/${{ github.repository_owner }}/${{ REPO_LC }}:v1.${{ github.run_number }} | ||
- name: Stop and remove container | ||
if: always() | ||
run: docker rm -f streamlit-container |