Skip to content

Commit

Permalink
Merge branch 'dev/gitlab-ci' into 'master'
Browse files Browse the repository at this point in the history
Migrated GitHub build actions to Gitlab CI jobs

See merge request hackademint/ctfd!1
  • Loading branch information
SmylerMC committed Sep 1, 2022
2 parents ae29dca + ad6d7c7 commit a498dc2
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 245 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/docker-build.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/lint.yml

This file was deleted.

53 changes: 0 additions & 53 deletions .github/workflows/mysql.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/postgres.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/sqlite.yml

This file was deleted.

103 changes: 103 additions & 0 deletions .gitlab-ci.yml
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}"

0 comments on commit a498dc2

Please sign in to comment.