Inkycal/.github/workflows/tests.yml

119 lines
2.8 KiB
YAML
Raw Normal View History

2023-01-20 01:09:13 +01:00
name: Inkycal testing
2020-05-16 08:22:57 +02:00
2023-01-20 01:09:13 +01:00
on:
push:
branches:
- main
2023-06-03 19:03:09 +02:00
2020-05-16 08:22:57 +02:00
jobs:
2023-06-03 19:53:42 +02:00
clone-setup-install:
name: Clone, Setup, and Install
2020-05-16 08:22:57 +02:00
runs-on: ubuntu-latest
steps:
2023-06-03 19:53:42 +02:00
- name: Checkout Repository
uses: actions/checkout@v3
2023-06-03 20:07:57 +02:00
with:
ref: main
2023-06-03 19:53:42 +02:00
2023-06-03 19:03:09 +02:00
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
2020-06-17 14:54:48 +02:00
2023-06-03 19:53:42 +02:00
- name: Install Dependencies
2023-06-03 19:03:09 +02:00
run: |
2023-06-03 19:53:42 +02:00
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install wheel
2023-06-03 20:00:09 +02:00
pip install -e .
2023-06-03 20:31:58 +02:00
cd ..
2023-06-03 20:00:09 +02:00
2023-06-03 20:12:57 +02:00
- name: Create Archive
run: |
2023-06-03 20:39:11 +02:00
mkdir artefacts
tar -czf artefacts/workspace.tar.gz --exclude=./artefacts .
2023-06-03 20:12:57 +02:00
- name: Save Workspace Archive
2023-06-03 20:00:09 +02:00
uses: actions/upload-artifact@v2
with:
name: workspace
2023-06-03 20:41:01 +02:00
path: artefacts/workspace.tar.gz
2023-06-03 17:39:55 +02:00
2023-06-03 19:53:42 +02:00
test:
name: Run Tests
needs: clone-setup-install
runs-on: ubuntu-latest
steps:
2023-06-03 20:00:09 +02:00
- name: Restore Workspace
uses: actions/download-artifact@v2
with:
name: workspace
2023-06-03 19:53:42 +02:00
2023-06-03 20:12:57 +02:00
- name: Extract Workspace Archive
run: |
tar -xzf workspace.tar.gz
2023-06-03 19:53:42 +02:00
- name: Run Tests
2023-06-03 19:03:09 +02:00
env:
OPENWEATHERMAP_API_KEY: ${{ secrets.OPENWEATHERMAP_API_KEY }}
SAMPLE_ICAL_URL: ${{ secrets.SAMPLE_ICAL_URL }}
TEST_ICAL_URL: ${{ secrets.TEST_ICAL_URL }}
TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}
run: |
2023-06-03 20:00:09 +02:00
source venv/bin/activate
2023-06-03 20:34:18 +02:00
cd inkycal/tests
2023-06-03 19:35:20 +02:00
wget https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/settings.json
for f in *.py; do python3 "$f"; done
2023-06-03 19:53:42 +02:00
generate-docs:
name: Generate Docs
needs: clone-setup-install
runs-on: ubuntu-latest
steps:
2023-06-03 20:00:09 +02:00
- name: Restore Workspace
uses: actions/download-artifact@v2
with:
name: workspace
2023-06-03 19:53:42 +02:00
2023-06-03 20:12:57 +02:00
- name: Extract Workspace Archive
run: |
tar -xzf workspace.tar.gz
2023-06-03 19:53:42 +02:00
- name: Generate Docs
run: |
2023-06-03 20:00:09 +02:00
source venv/bin/activate
2023-06-03 20:44:31 +02:00
cd docsource
2023-06-03 19:53:42 +02:00
make html
publish-docs:
name: Publish Docs
needs: generate-docs
runs-on: ubuntu-latest
steps:
2023-06-03 20:00:09 +02:00
- name: Restore Workspace
uses: actions/download-artifact@v2
with:
name: workspace
2023-06-03 19:53:42 +02:00
2023-06-03 20:12:57 +02:00
- name: Extract Workspace Archive
run: |
tar -xzf workspace.tar.gz
2023-06-03 21:20:50 +02:00
- name: Publish Docs to Github Pages
2023-06-03 19:53:42 +02:00
run: |
2023-06-03 21:20:50 +02:00
echo "$PWD"
ls
2023-06-03 20:00:09 +02:00
source venv/bin/activate
2023-06-03 21:32:05 +02:00
cd docs && make html && cd ..
2023-06-03 21:20:50 +02:00
cp -r docsource/_build/html/. docs/
2023-06-03 19:03:09 +02:00
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add docs
git commit -m "Update documentation"
2023-06-03 19:53:42 +02:00
git push --force --quiet