forked from CTFd/CTFd
-
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.
Merge branch 'dev/gitlab-ci' into 'master'
Migrated GitHub build actions to Gitlab CI jobs See merge request hackademint/ctfd!1
- Loading branch information
Showing
6 changed files
with
103 additions
and
245 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,103 @@ | ||
stages: | ||
- linting | ||
- test | ||
- containerize | ||
|
||
variables: | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
POSTGRES_DB: ctfd | ||
POSTGRES_PASSWORD: password | ||
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE | ||
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | ||
MYSQL_ROOT_PASSWORD: password | ||
|
||
dockerfile: | ||
stage: linting | ||
image: hadolint/hadolint:latest-debian | ||
script: | ||
- mkdir -p reports | ||
- hadolint -f gitlab_codeclimate Dockerfile > reports/hadolint-$(md5sum Dockerfile | cut -d" " -f1).json | ||
artifacts: | ||
name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" | ||
reports: | ||
codequality: | ||
- "reports/*" | ||
paths: | ||
- "reports/*" | ||
|
||
docker-compose: | ||
stage: linting | ||
image: python:3.9.13-bullseye | ||
script: | ||
- python -m pip install docker-compose==1.26.0 | ||
- docker-compose -f docker-compose.yml config | ||
|
||
postgres: | ||
stage: test | ||
image: nikolaik/python-nodejs:python3.9-nodejs18 | ||
timeout: 24 hours | ||
services: | ||
- postgres:latest | ||
- redis:latest | ||
variables: | ||
TESTING_DATABASE_URL: postgres://postgres:password@postgres:5432/ctfd | ||
script: | ||
- python -m pip install --upgrade pip | ||
- python -m pip install -r development.txt | ||
- yarn install --non-interactive | ||
- rm -f /etc/boto.cfg | ||
- make test | ||
artifacts: | ||
paths: | ||
- coverage.xml | ||
when: manual | ||
|
||
mysql: | ||
stage: test | ||
image: nikolaik/python-nodejs:python3.9-nodejs18 | ||
timeout: 24 hours | ||
services: | ||
- mysql:5.7 | ||
- redis:latest | ||
variables: | ||
TESTING_DATABASE_URL: mysql+pymysql://root:password@mysql:3306/ctfd | ||
script: | ||
- python -m pip install --upgrade pip | ||
- python -m pip install -r development.txt | ||
- yarn install --non-interactive | ||
- rm -f /etc/boto.cfg | ||
- make test | ||
artifacts: | ||
paths: | ||
- coverage.xml | ||
when: manual | ||
|
||
sqlite: | ||
stage: test | ||
image: nikolaik/python-nodejs:python3.9-nodejs18 | ||
variables: | ||
TESTING_DATABASE_URL: 'sqlite://' | ||
script: | ||
- python -m pip install --upgrade pip | ||
- python -m pip install -r development.txt | ||
- yarn install --non-interactive | ||
- yarn global add [email protected] | ||
- rm -f /etc/boto.cfg | ||
- make test | ||
artifacts: | ||
paths: | ||
- coverage.xml | ||
|
||
containerize: | ||
stage: containerize | ||
image: | ||
name: gcr.io/kaniko-project/executor:debug | ||
entrypoint: [""] | ||
script: | ||
- mkdir -p /kaniko/.docker | ||
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json | ||
- >- | ||
/kaniko/executor | ||
--context "${CI_PROJECT_DIR}" | ||
--dockerfile "${CI_PROJECT_DIR}/Dockerfile" | ||
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" |