-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #884 from NFDI4Chem/development
Development
- Loading branch information
Showing
121 changed files
with
8,999 additions
and
1,898 deletions.
There are no files selected for viewing
File renamed without changes.
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,33 @@ | ||
name: Docs Deployment - GitHub pages | ||
on: | ||
workflow_dispatch: {} | ||
push: | ||
branches: | ||
- development | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: npm | ||
- run: npm ci | ||
- name: Build | ||
run: npm run docs:build | ||
- uses: actions/configure-pages@v2 | ||
- uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: docs/.vitepress/dist | ||
- name: Deploy | ||
id: deployment | ||
uses: actions/[email protected] |
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,4 +1,4 @@ | ||
name : Deploy to Dev | ||
name : Setup, Build and Publish to Dev | ||
|
||
on: | ||
push: | ||
|
@@ -11,11 +11,16 @@ env: | |
DEPLOYMENT_NAME: nmrxiv-nmrxiv-app | ||
SCHEDULER_DEPLOYMENT_NAME: nmrxiv-scheduler | ||
WORKER_DEPLOYMENT_NAME: nmrxiv-worker | ||
REPOSITORY_NAME: nmrxiv-dev | ||
APP_IMAGE: nmrxiv-app | ||
NGINX_IMAGE: nmrxiv-nginx | ||
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
REPOSITORY_NAME: nmrxiv | ||
REPOSITORY_NAMESPACE: nfdi4chem | ||
DEV_URL: https://dev.nmrxiv.org | ||
|
||
jobs: | ||
# php-unit-test: | ||
# uses: NFDI4Chem/nmrxiv/.github/workflows/test.yml@development | ||
|
||
php-unit-test: | ||
name: Run test | ||
runs-on: ubuntu-latest | ||
|
@@ -43,7 +48,7 @@ jobs: | |
composer install --ignore-platform-reqs | ||
- name: Prepare Laravel Application | ||
run: | | ||
php -r "file_exists('.env') || copy('.env.ci.dev', '.env');" | ||
php -r "file_exists('.env') || copy('.env.ci.test', '.env');" | ||
echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_DEV }} >> .env | ||
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} >> .env | ||
|
@@ -63,12 +68,13 @@ jobs: | |
- name: Run Test | ||
run: php artisan test --parallel | ||
|
||
|
||
setup-build-publish-deploy: | ||
name: Build & deploy to development | ||
if: github.ref == 'refs/heads/development' | ||
runs-on: ubuntu-latest | ||
needs: php-unit-test | ||
environment: | ||
name: Dev | ||
url: ${{ env.DEV_URL }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -79,40 +85,47 @@ jobs: | |
service_account_key: ${{ secrets.GKE_SA_KEY }} | ||
project_id: ${{ secrets.GKE_PROJECT }} | ||
|
||
# Configure docker to use the gcloud command-line tool as a credential helper | ||
- run: |- | ||
gcloud auth configure-docker europe-west3-docker.pkg.dev | ||
# Get the GKE credentials so we can deploy to the cluster | ||
# Get the GKE credentials | ||
- uses: google-github-actions/[email protected] | ||
with: | ||
cluster_name: ${{ env.GKE_CLUSTER }} | ||
location: ${{ env.GKE_ZONE }} | ||
credentials: ${{ secrets.GKE_SA_KEY }} | ||
|
||
# Build the Docker image | ||
- name: Build App Image | ||
run: |- | ||
docker build -f ./resources/ops/docker/app/app.dockerfile \ | ||
--tag "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$APP_IMAGE:latest" \ | ||
--build-arg GITHUB_SHA="$GITHUB_SHA" \ | ||
--build-arg GITHUB_REF="$GITHUB_REF" \ | ||
. | ||
- name: Build Nginx Image | ||
run: |- | ||
docker build -f ./resources/ops/docker/nginx/nginx.dockerfile \ | ||
--tag "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$NGINX_IMAGE:latest" \ | ||
--build-arg GITHUB_SHA="$GITHUB_SHA" \ | ||
--build-arg GITHUB_REF="$GITHUB_REF" \ | ||
. | ||
# Push the Docker image to Google Container Registry | ||
- name: Publish App Image to GCR | ||
run: |- | ||
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$APP_IMAGE:latest" | ||
# Login to Docker | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ env.DOCKER_HUB_PASSWORD }} | ||
|
||
- name: Publish Nginx Image to GCR | ||
run: |- | ||
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$NGINX_IMAGE:latest" | ||
# Build and push the app Docker image | ||
- name: Build and push App Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./resources/ops/docker/app/app.dockerfile | ||
push: true | ||
build-args: | | ||
RELEASE_VERSION=dev-app-latest | ||
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-app-latest | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ env.DOCKER_HUB_PASSWORD }} | ||
|
||
# Build and push the nginx Docker image | ||
- name: Build and push Nginx Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./resources/ops/docker/nginx/nginx.dockerfile | ||
push: true | ||
build-args: | | ||
RELEASE_VERSION=dev-nginx-latest | ||
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-nginx-latest | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ env.DOCKER_HUB_PASSWORD }} | ||
|
||
# Deploy the latest Docker image to the GKE cluster | ||
- name: Deploy | ||
run: |- | ||
kubectl rollout restart deployment/$DEPLOYMENT_NAME | ||
|
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,52 @@ | ||
name : Test | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
php-unit-test: | ||
name: Run test | ||
runs-on: ubuntu-latest | ||
container: | ||
image: kirschbaumdevelopment/laravel-test-runner:8.2 | ||
|
||
services: | ||
postgres: | ||
image: postgres:13 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: nmrxiv | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install composer dependencies | ||
run: | | ||
composer install --ignore-platform-reqs | ||
- name: Prepare Laravel Application | ||
run: | | ||
php -r "file_exists('.env') || copy('.env.ci.test', '.env');" | ||
echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_DEV }} >> .env | ||
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} >> .env | ||
echo MEILISEARCH_KEY=${{ secrets.MEILISEARCH_KEY_DEV }} >> .env | ||
echo MEILISEARCH_PUBLICKEY=${{ secrets.MEILISEARCH_PUBLICKEY_DEV }} >> .env | ||
echo TWITTER_CLIENT_ID=${{ secrets.TWITTER_CLIENT_ID_DEV }} >> .env | ||
echo TWITTER_CLIENT_SECRET=${{ secrets.TWITTER_CLIENT_SECRET_DEV }} >> .env | ||
echo GITHUB_CLIENT_ID=${{ secrets.CLIENT_ID_GITHUB_DEV }} >> .env | ||
echo GITHUB_CLIENT_SECRET=${{ secrets.CLIENT_SECRET_GITHUB_DEV }} >> .env | ||
php artisan key:generate | ||
php artisan migrate --seed | ||
- name: Install front-end dependencies | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Run Test | ||
run: php artisan test --parallel |
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.