Skip to content

Commit

Permalink
Merge pull request #77 from serlo/ci
Browse files Browse the repository at this point in the history
Add more CI checks and refactor
  • Loading branch information
hejtful authored Oct 2, 2024
2 parents 5c6ff65 + 5902795 commit 603a545
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 122 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,29 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
- run: yarn lint:tsc

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
- run: yarn build

# TODO: this is just a basic check to see if it is set up and running
# change for real tests later
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
- run: cp .env-template .env
- run: docker compose up mysql mongo -d
- run: sleep 30
- run:
yarn mysql -e "CREATE TABLE lti_entity ( id bigint, resource_link_id
varchar(255), custom_claim_id varchar(255), content longtext,
id_token_on_creation text )"
- run: yarn build
- run: docker compose up express -d
- run: sleep 2
- run: curl localhost:3000 | grep NO_LTIK_OR_IDTOKEN_FOUND
29 changes: 0 additions & 29 deletions .github/workflows/deploy-to-uberspace-dev.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/deploy-to-uberspace-staging.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to Uberspace

on:
push:
branches:
- staging
- development

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set environment variables for development
if: ${{ github.ref_name == 'development' }}
run: |
echo "REMOTE_HOST=${{ secrets.REMOTE_HOST_DEV }}" >> $GITHUB_ENV
echo "REMOTE_USER=${{ secrets.REMOTE_USER_DEV }}" >> $GITHUB_ENV
echo "DOMAIN=https://editor.serlo.dev/" >> $GITHUB_ENV
- name: Set environment variables for staging
if: ${{ github.ref_name == 'staging' }}
run: |
echo "REMOTE_HOST=${{ secrets.REMOTE_HOST_STAGING }}" >> $GITHUB_ENV
echo "REMOTE_USER=${{ secrets.REMOTE_USER_STAGING }}" >> $GITHUB_ENV
echo "DOMAIN=https://editor.serlo-staging.dev/" >> $GITHUB_ENV
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/${{ env.REMOTE_USER }}/serlo-editor-as-lti-tool/
git checkout ${{ github.ref_name }}
git pull
yarn
yarn build
supervisorctl restart serlo-app
- name: Test deployment successful
run: curl ${{ env.DOMAIN }} | grep NO_LTIK_OR_IDTOKEN_FOUND
64 changes: 0 additions & 64 deletions .github/workflows/push-docker-image.yml

This file was deleted.

0 comments on commit 603a545

Please sign in to comment.