-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b76d160
commit ad25e29
Showing
3 changed files
with
202 additions
and
0 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,157 @@ | ||
name: Run basic checks | ||
|
||
on: | ||
pull_request: | ||
branches: [main, dev] | ||
|
||
env: | ||
TELESCOOP_DEV: true | ||
IS_TESTING: true | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
cache: "pip" | ||
- name: Install python dependencies | ||
run: pip install -r back/requirements.txt | ||
- name: Install front js dependencies | ||
run: npm install | ||
working-directory: ./front | ||
- name: Create back/local_settings.conf | ||
run: echo "${{ secrets.LOCAL_SETTINGS_CONF }}" > local_settings.conf | ||
working-directory: ./back | ||
- name: Cache Python dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('back/requirements.txt') }} | ||
- name: Cache Node.js dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./front/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | ||
|
||
pre-commit: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
cache: "pip" | ||
- name: Restore Python cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('back/requirements.txt') }} | ||
- name: Install python dependencies if not cached | ||
if: steps.cache-python.outputs.cache-hit != 'true' | ||
run: pip install -r back/requirements.txt | ||
- name: Restore Node.js cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./front/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | ||
- name: Install js dependencies if not cached | ||
if: steps.cache-node.outputs.cache-hit != 'true' | ||
run: npm install | ||
working-directory: ./front | ||
- name: Enforce pre-commit hook server side | ||
uses: pre-commit/[email protected] | ||
|
||
node-setup: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ./front/.nvmrc | ||
cache: "npm" | ||
- name: Restore Node.js cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./front/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | ||
- name: Install js dependencies if not cached | ||
if: steps.cache-node.outputs.cache-hit != 'true' | ||
run: npm install | ||
working-directory: ./front | ||
|
||
frontend-tests: | ||
runs-on: ubuntu-latest | ||
needs: [setup, node-setup] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ./front/.nvmrc | ||
cache: "npm" | ||
- name: Restore Node.js cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./front/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | ||
- name: Install front js dependencies if not cached | ||
if: steps.cache-node.outputs.cache-hit != 'true' | ||
run: npm install | ||
working-directory: ./front | ||
- name: Run vitest | ||
run: npm run test | ||
working-directory: ./front | ||
- name: Run cypress component tests | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
component: true | ||
working-directory: ./front | ||
|
||
e2e-tests: | ||
runs-on: ubuntu-latest | ||
needs: [setup] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
cache: "pip" | ||
- name: Restore Python cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('back/requirements.txt') }} | ||
- name: Install python dependencies if not cached | ||
if: steps.cache-python.outputs.cache-hit != 'true' | ||
run: pip install -r back/requirements.txt | ||
- name: Migrate database | ||
run: python back/manage.py migrate | ||
- name: Load test database | ||
run: python back/manage.py backup_db restore_db test_db | ||
- name: Run back-end server in background | ||
run: python manage.py runserver localhost:8000 & | ||
working-directory: ./back | ||
- name: Run e2e tests | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
start: npm run dev | ||
browser: chrome | ||
config-file: cypress.config.js | ||
working-directory: ./front | ||
- name: Upload cypress screenshots | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-screenshot | ||
path: | | ||
front/cypress/screenshots | ||
retention-days: 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Run deploy prod | ||
|
||
on: | ||
pull_request: | ||
branches: [main, dev] | ||
|
||
jobs: | ||
deploy-prod: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deploy frontend in prod | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: frontend.yml | ||
directory: deploy | ||
vault_password: ${{secrets.ANSIBLE_VAULT_KEY}} | ||
options: | | ||
-l prod | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
- name: Deploy backend in prod | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: backend.yml | ||
directory: deploy | ||
vault_password: ${{secrets.ANSIBLE_VAULT_KEY}} | ||
options: | | ||
-l prod | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
- name: Deploy static in prod | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: showcase.yml | ||
directory: deploy | ||
vault_password: ${{secrets.ANSIBLE_VAULT_KEY}} | ||
options: | | ||
-l prod | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} |
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