diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7a5ceb5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: Continuous Integration + +on: + push: + +jobs: + build-and-publish: + name: Build and Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run tests + run: docker-compose -f action-services.yml run portal /data/run-tests.sh + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} + tags: | + type=ref,event=branch + # set latest tag for main + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/action-services.yml b/action-services.yml new file mode 100644 index 0000000..3886208 --- /dev/null +++ b/action-services.yml @@ -0,0 +1,66 @@ +services: + db: + image: mariadb:10 + environment: + MYSQL_ROOT_PASSWORD: r00tp@ss! + MYSQL_DATABASE: test + MYSQL_USER: developer_portal + MYSQL_PASSWORD: developer_portal + + redis: + image: redis:latest + + api: + image: silintl/apiaxle-js:1.15.2 + environment: + REDIS_HOST: redis + REDIS_PORT: 6379 + DEBUG_MODE: 'false' + API_NAME_REGEX: "^(.+?)\\.api\\." + NODE_ENV: production + depends_on: + - redis + ports: + - "80" + command: api 80 + + proxy: + image: silintl/apiaxle-js:1.15.2 + environment: + REDIS_HOST: redis + REDIS_PORT: 6379 + DEBUG_MODE: 'false' + API_NAME_REGEX: "^(.+?)\\.api\\." + NODE_ENV: production + depends_on: + - api + - redis + ports: + - "80" + command: proxy 80 -q + + portal: + build: + image: silintl/developer-portal + dockerfile_path: ./Dockerfile + cached: true + depends_on: + - db + - proxy:apiaxle.api.proxy + - proxy:test.api.proxy + - api + environment: + MYSQL_HOST: db + MYSQL_DATABASE: test + MYSQL_USER: developer_portal + MYSQL_PASSWORD: developer_portal + APIAXLE_ENDPOINT: http://apiaxle.api.proxy/v1 + APIAXLE_KEY: developer-portal-dev-key + APIAXLE_SECRET: developer-portal-dev-secret + APIAXLE_SSL_VERIFYPEER: false + GOOGLE_OAUTH_ENABLED: false + SAML_ENTITY_ID: http://developer-portal.local/simplesaml/module.php/saml/sp/metadata.php/default-sp + SAML_ADMIN_PASSWORD: dummy-for-tests-q6.eYWtfLF-BTQXf-OktD5lVFCOFyC4B + SAML_SECRET_SALT: dummy-for-tests-Ac4MTgO9UJ6_wpXXKc6EGU_.gWNNkdMe + SAML_IDP: NONE + working_dir: /data diff --git a/codeship-services.yml b/codeship-services.yml deleted file mode 100644 index e4e96e1..0000000 --- a/codeship-services.yml +++ /dev/null @@ -1,65 +0,0 @@ -db: - image: mariadb:10 - environment: - MYSQL_ROOT_PASSWORD: r00tp@ss! - MYSQL_DATABASE: test - MYSQL_USER: developer_portal - MYSQL_PASSWORD: developer_portal - -redis: - image: redis:latest - -api: - image: silintl/apiaxle-js:1.15.2 - environment: - REDIS_HOST: redis - REDIS_PORT: 6379 - DEBUG_MODE: 'false' - API_NAME_REGEX: "^(.+?)\\.api\\." - NODE_ENV: production - links: - - redis - ports: - - "80" - command: api 80 - -proxy: - image: silintl/apiaxle-js:1.15.2 - environment: - REDIS_HOST: redis - REDIS_PORT: 6379 - DEBUG_MODE: 'false' - API_NAME_REGEX: "^(.+?)\\.api\\." - NODE_ENV: production - links: - - api - - redis - ports: - - "80" - command: proxy 80 -q - -portal: - build: - image: silintl/developer-portal - dockerfile_path: ./Dockerfile - cached: true - links: - - db - - proxy:apiaxle.api.proxy - - proxy:test.api.proxy - - api - environment: - MYSQL_HOST: db - MYSQL_DATABASE: test - MYSQL_USER: developer_portal - MYSQL_PASSWORD: developer_portal - APIAXLE_ENDPOINT: http://apiaxle.api.proxy/v1 - APIAXLE_KEY: developer-portal-dev-key - APIAXLE_SECRET: developer-portal-dev-secret - APIAXLE_SSL_VERIFYPEER: false - GOOGLE_OAUTH_ENABLED: false - SAML_ENTITY_ID: http://developer-portal.local/simplesaml/module.php/saml/sp/metadata.php/default-sp - SAML_ADMIN_PASSWORD: dummy-for-tests-q6.eYWtfLF-BTQXf-OktD5lVFCOFyC4B - SAML_SECRET_SALT: dummy-for-tests-Ac4MTgO9UJ6_wpXXKc6EGU_.gWNNkdMe - SAML_IDP: NONE - working_dir: /data diff --git a/codeship-steps.yml b/codeship-steps.yml deleted file mode 100644 index 8accaca..0000000 --- a/codeship-steps.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: test - service: portal - command: /data/run-tests.sh - -- name: push_branch_tag - service: portal - type: push - image_name: silintl/developer-portal - image_tag: "{{.Branch}}" - exclude: main - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted - -- name: push_latest_tag - service: portal - type: push - image_name: silintl/developer-portal - image_tag: "latest" - tag: main - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted diff --git a/dockercfg.encrypted b/dockercfg.encrypted deleted file mode 100644 index 823d0bf..0000000 --- a/dockercfg.encrypted +++ /dev/null @@ -1,2 +0,0 @@ -codeship:v2 -yjydleGVjEHZwTsJu4BP3qQlmk6bTNcqzjZKePNkzAhoYkgz504tsTllAGL1hFyvWUFPXc6wceKrJX5qx57tmOufNxYPwb6AMT3sU8DN3fFFAYf6ZQlNvD9zJWP+yVWGw4Q8OHafHC6NABEwSQsEpJEoml6UtukbuXO4kTXWuO+xLzyk0C5Ha1dLHfyl7ngUwYCHEXYB51ben8STW6k8WKd9vajqR/5xWefO8M7bkRhfKa2ctSYpk7tS27fQeYO/4WVPZUVbY4x1rdANY8YWUI0S0USNBSGJDkNb8/fExdHmmoIMm6y6+rG1e2Jc \ No newline at end of file