130 lines
3.3 KiB
YAML
130 lines
3.3 KiB
YAML
name: Inkycal testing
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
clone-setup-install:
|
|
name: Clone, Setup, and Install
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: main
|
|
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
python -m pip install --upgrade pip
|
|
pip install wheel
|
|
pip install -e .
|
|
cd ..
|
|
|
|
- name: Create Archive
|
|
run: |
|
|
mkdir artefacts
|
|
tar -czf artefacts/workspace.tar.gz --exclude=./artefacts .
|
|
|
|
- name: Save Workspace Archive
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: workspace
|
|
path: artefacts/workspace.tar.gz
|
|
|
|
test-on-arm:
|
|
name: Run Tests on Raspberry Pi OS
|
|
needs: clone-setup-install
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Restore Workspace
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: workspace
|
|
|
|
- name: Extract Workspace Archive
|
|
run: |
|
|
tar -xzf workspace.tar.gz
|
|
|
|
- name: Run Tests on Raspberry Pi OS
|
|
uses: pguyot/arm-runner-action@v2
|
|
with:
|
|
# Set the base_image to the desired Raspberry Pi OS version
|
|
base_image: raspios_lite:latest
|
|
# Set the commands to run the tests
|
|
commands: |
|
|
source venv/bin/activate
|
|
cd inkycal/tests
|
|
wget https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/settings.json
|
|
for f in *.py; do python3 "$f"; done
|
|
|
|
- name: Upload Raspberry Pi OS Image
|
|
if: success() # Only upload the image if the tests were successful
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: raspberrypi_image
|
|
path: my-release-image.img.xz
|
|
|
|
generate-docs:
|
|
name: Generate Docs
|
|
needs: clone-setup-install
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Restore Workspace
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: workspace
|
|
|
|
- name: Extract Workspace Archive
|
|
run: |
|
|
tar -xzf workspace.tar.gz
|
|
|
|
- name: Generate Docs
|
|
run: |
|
|
source venv/bin/activate
|
|
cd docsource
|
|
make html
|
|
|
|
publish-docs:
|
|
name: Publish Docs
|
|
needs: generate-docs
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Restore Workspace
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: workspace
|
|
|
|
- name: Extract Workspace Archive
|
|
run: |
|
|
tar -xzf workspace.tar.gz
|
|
|
|
- name: Publish Docs to Github Pages
|
|
run: |
|
|
echo "$PWD"
|
|
ls
|
|
source venv/bin/activate
|
|
cd docsource && make html && make github && cd ..
|
|
echo "$PWD"
|
|
ls
|
|
git config --global user.name 'GitHub Actions'
|
|
git config --global user.email 'actions@github.com'
|
|
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
|
git add docs
|
|
git commit -m "Update documentation"
|
|
git push --force --quiet
|