-
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 #1060 from NFDI4Chem/sneumann-patch-2
Fix URL to API docs
- Loading branch information
Showing
86 changed files
with
22,619 additions
and
47 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,145 @@ | ||
name : Setup, Build and Publish to Production | ||
|
||
on: | ||
push: | ||
branches: [prod-helm-deploy] | ||
|
||
env: | ||
PROJECT_ID: ${{ secrets.GKE_PROJECT }} | ||
GKE_CLUSTER: nmrxiv-prod | ||
GKE_ZONE: europe-west3-a | ||
DEPLOYMENT_NAME: nmrxiv-nmrxiv-app | ||
SCHEDULER_DEPLOYMENT_NAME: nmrxiv-scheduler | ||
WORKER_DEPLOYMENT_NAME: nmrxiv-worker | ||
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
REPOSITORY_NAME: nmrxiv | ||
REPOSITORY_NAMESPACE: nfdi4chem | ||
|
||
|
||
jobs: | ||
# php-unit-test: | ||
# uses: NFDI4Chem/nmrxiv/.github/workflows/test.yml@development | ||
|
||
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 | ||
|
||
setup-build-publish-deploy: | ||
name: Build & deploy to production | ||
if: github.ref == 'refs/heads/prod-helm-deploy' | ||
needs: php-unit-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Setup gcloud CLI | ||
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7 | ||
with: | ||
service_account_key: ${{ secrets.GKE_SA_KEY }} | ||
project_id: ${{ secrets.GKE_PROJECT }} | ||
|
||
# Get the GKE credentials | ||
- uses: google-github-actions/get-gke-credentials@v0.3.0 | ||
with: | ||
cluster_name: ${{ env.GKE_CLUSTER }} | ||
location: ${{ env.GKE_ZONE }} | ||
credentials: ${{ secrets.GKE_SA_KEY }} | ||
|
||
#Fetch latest release | ||
- name: Fetch latest release | ||
id: fetch-latest-release | ||
uses: InsonusK/get-latest-release@v1.0.1 | ||
with: | ||
myToken: ${{ github.token }} | ||
#exclude_types: "draft|prerelease" | ||
view_top: 10 | ||
- name: "Print release name" | ||
run: | | ||
echo "tag_name: ${{ steps.fetch-latest-release.outputs.tag_name }}" | ||
# Login to Docker Hub | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ env.DOCKER_HUB_PASSWORD }} | ||
|
||
# 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=app-${{ steps.fetch-latest-release.outputs.tag_name }} | ||
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:app-latest, ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:app-${{ steps.fetch-latest-release.outputs.tag_name }} | ||
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=nginx-${{ steps.fetch-latest-release.outputs.tag_name }} | ||
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:nginx-latest, ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:nginx-${{ steps.fetch-latest-release.outputs.tag_name }} | ||
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 | ||
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s | ||
kubectl rollout restart deployment/$WORKER_DEPLOYMENT_NAME | ||
kubectl rollout restart deployment/$SCHEDULER_DEPLOYMENT_NAME | ||
kubectl get services -o wide |
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.