Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staticify #10

Merged
merged 10 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md → .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ For answers to common questions about this code of conduct, see the FAQ at
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
[translations]: https://www.contributor-covenant.org/translations
2 changes: 1 addition & 1 deletion LICENSE → .github/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Copyright 2010 Pamela Fox
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ jobs:
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "./" # App source code path
app_location: "/" # App source code path
api_location: "" # Api source code path - optional
output_location: "./src/build" # Built app content directory - optional
output_location: "src/build" # Built app content directory - optional
app_build_command: "python3 freeze.py" # Custom build command for app content - optional
###### End of Repository/Build Configurations ######
env:
PYTHON_VERSION: "3.11"
POST_BUILD_COMMAND: "python3 freeze.py"
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Lint with ruff
run: ruff .
- name: Check formatting with black
run: black . --check --verbose
- name: Check formatting with black
uses: psf/black@stable
with:
src: "src/ tests/"
options: "--check --verbose"
- name: Run unit tests
run: |
python -m pytest
python3 -m pytest
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ app_secrets.py
env/
venv/
.coverage
node_modules/
.azure/
.venv/
.env
src/build/
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.237
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
types_or: [css, javascript]
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ A personal homepage.

## Local development

This website is designed to be run inside a Docker contain, though the Flask app can also be run normally.

Build a Docker image:

```console
docker build --tag pamelafox-site .
```shell
pip install -r requirements-dev.txt
```

Run the container:
```shell
pre-commit install
```

```console
docker run -d -p 5000:5000 pamelafox-site
```shell
flask --debug run
```

Then open the website at localhost:5000.
Expand All @@ -35,3 +34,13 @@ az deployment group create \

The custom domain should be mapped manually after deployment.


export RESOURCE_GROUP='pamelafox-swa-rg'
export RESOURCE_GROUP_LOCATION='eastus2'
export SWA_REPO_TOKEN=''
export SWA_NAME='pamelafox-swa-app'
export SWA_REPO_URL='https://github.com/pamelafox/pamelafox-site'
export SWA_REPO_BRANCH='master'
az group create -g $RESOURCE_GROUP -l $RESOURCE_GROUP_LOCATION

az deployment group create --resource-group $RESOURCE_GROUP --template-file infra/main.bicep --parameters swaName=$SWA_NAME swaRepositoryToken=$SWA_REPO_TOKEN swaRepositoryUrl=$SWA_REPO_URL swaRepositoryBranch=$SWA_REPO_BRANCH -c
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from src import app

if __name__ == '__main__':
if __name__ == "__main__":
app.run(debug=True)
Loading