-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernizing tooling for future development (#554)
- Loading branch information
Showing
51 changed files
with
1,743 additions
and
332 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
use flake | ||
export HKNWEB_MODE=dev |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Test 🧪 and deploy 🚀 | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
HKNWEB_MODE: dev | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.6.1 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ hashFiles('poetry.lock') }} | ||
|
||
- run: poetry install --with prod --no-interaction --no-root | ||
|
||
- name: Run formatting check | ||
run: poetry run black . --check | ||
|
||
- name: Run unit tests | ||
run: | | ||
poetry run coverage run | ||
poetry run coverage report | ||
- name: Deploy | ||
run: | | ||
poetry run fab deploy | ||
- name: Run end-to-end tests | ||
run: | | ||
poetry run curl -f localhost:8000 | ||
deploy: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
if: success() && github.ref == 'refs/heads/master' | ||
environment: | ||
name: Production | ||
url: https://dev-hkn.eecs.berkeley.edu/ | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.6.1 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ hashFiles('poetry.lock') }} | ||
|
||
- run: poetry install --with prod --no-interaction --no-root | ||
|
||
- name: Unseal secrets | ||
uses: jrmcdonald/[email protected] | ||
with: | ||
bb_actions_subcommand: "postdeploy" | ||
env: | ||
BLACKBOX_PUBKEY: ${{ secrets.BLACKBOX_PUBLIC_KEY }} | ||
BLACKBOX_PRIVKEY: ${{ secrets.BLACKBOX_PRIVATE_KEY }} | ||
|
||
- name: Setup SSH key | ||
run: | | ||
mkdir -p ~/.ssh/ | ||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/pkey | ||
sudo chmod 600 ~/.ssh/pkey | ||
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts | ||
shell: bash | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.OCF_SSH_KEY }} | ||
SSH_KNOWN_HOSTS: ${{ secrets.OCF_SSH_KNOWN_HOSTS }} | ||
|
||
- name: Deploy | ||
run: | | ||
poetry run fab deploy -i ~/.ssh/pkey --revision ${{ github.sha }} | ||
env: | ||
HKNWEB_MODE: ${{ vars.HKNWEB_MODE }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# direnv | ||
.direnv | ||
|
||
# hknweb-specific stuff | ||
.vagrant/ | ||
db.sqlite3 | ||
venv/ | ||
.venv/ | ||
media/ | ||
|
||
# Generic python stuff | ||
|
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"deploy": { | ||
"name": "github_actions", | ||
"user": "github_actions", | ||
"host": "github_actions", | ||
"conda_env": "hknweb-dev", | ||
"run_blackbox_postdeploy": false, | ||
"use_local_repo": true, | ||
"path": { | ||
"root": "/home/runner/work/hknweb" | ||
}, | ||
"keep_releases": 1 | ||
} | ||
"deploy": { | ||
"name": "github_actions", | ||
"user": "github_actions", | ||
"host": "github_actions", | ||
"run_blackbox_postdeploy": false, | ||
"run_collectstatic": false, | ||
"use_local_repo": true, | ||
"path": { | ||
"root": "/home/runner/work/hknweb" | ||
}, | ||
"keep_releases": 1 | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"deploy": { | ||
"name": "prod", | ||
"user": "hkn", | ||
"host": "apphost.ocf.berkeley.edu", | ||
"conda_env": "hknweb-prod", | ||
"run_blackbox_postdeploy": true, | ||
"use_local_repo": false, | ||
"path": { | ||
"root": "/home/h/hk/hkn/hknweb" | ||
}, | ||
"keep_releases": 10 | ||
} | ||
"deploy": { | ||
"name": "prod", | ||
"user": "hkn", | ||
"host": "apphost.ocf.berkeley.edu", | ||
"run_blackbox_postdeploy": true, | ||
"run_collectstatic": true, | ||
"use_local_repo": false, | ||
"path": { | ||
"root": "/home/h/hk/hkn/hknweb" | ||
}, | ||
"keep_releases": 10 | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"deploy": { | ||
"path": { | ||
"repo": "repo", | ||
"releases": "releases", | ||
"current": "current", | ||
"shared": "shared" | ||
}, | ||
"repo_url": "https://github.com/compserv/hknweb.git", | ||
"branch": "master", | ||
"linked_files": [], | ||
"linked_dirs": [] | ||
} | ||
"deploy": { | ||
"path": { | ||
"repo": "repo", | ||
"releases": "releases", | ||
"current": "current", | ||
"shared": "shared" | ||
}, | ||
"repo_url": "https://github.com/compserv/hknweb.git", | ||
"branch": "master", | ||
"linked_files": [], | ||
"linked_dirs": [] | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.