dotfiles

My PC Dotfiles & Website
commit bf3a16b600715f937de453b69cbf6114b45008fb
parent b384f1914f030f1e12ae58cc2b78512a378bf4c9
Author: maydayv7 <maydayv7@gmail.com>
Date:   Fri, 25 Mar 2022 19:31:48 +0530

feat(ci): Add GitLab CI/CD

Diffstat:

A.gitlab/.gitlab-ci.yml | 16++++++++++++++++
A.gitlab/.gitlab-webide.yml | 4++++
A.gitlab/issue_templates/Bug.md | 32++++++++++++++++++++++++++++++++
A.gitlab/issue_templates/Feature.md | 11+++++++++++
A.gitlab/issue_templates/Help.md | 24++++++++++++++++++++++++
A.gitlab/pipelines/build.yml | 29+++++++++++++++++++++++++++++
A.gitlab/pipelines/check.yml | 11+++++++++++
A.gitlab/pipelines/release.yml | 20++++++++++++++++++++
A.gitlab/pipelines/shell.yml | 18++++++++++++++++++
A.gitlab/pipelines/update.yml | 18++++++++++++++++++
10 files changed, 183 insertions(+), 0 deletions(-)

diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml @@ -0,0 +1,16 @@ +# Default Image for latest Nix +default: + image: nixpkgs/cachix-flakes:latest + +# CI Variables +variables: + PACKAGE_REGISTRY: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" + +# CI Job Priority +stages: + - check + - build + - publish + +# CI Imports +include: ".gitlab/pipelines/*.yml" diff --git a/.gitlab/.gitlab-webide.yml b/.gitlab/.gitlab-webide.yml @@ -0,0 +1,4 @@ +terminal: + image: nixpkgs/cachix-flakes:latest + before_script: + - nix develop diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md @@ -0,0 +1,32 @@ +### Describe the bug + +A clear and concise description of what the bug is + +### Steps To Reproduce + +Steps to reproduce the behavior: + +1. ... +2. ... +3. ... + +### Expected behavior + +A clear and concise description of what you expected to happen + +### Screenshots + +If applicable, add screenshots to help explain your problem + +### Additional context + +Add any other context about the problem + +### Metadata + +Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result + +```console +[user@system:~]$ nix-shell -p nix-info --run "nix-info -m" +output here +``` diff --git a/.gitlab/issue_templates/Feature.md b/.gitlab/issue_templates/Feature.md @@ -0,0 +1,11 @@ +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is + +**Describe the solution you'd like** +A clear and concise description of what you want to happen + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered, if applicable + +**Additional context** +Add any other context or screenshots diff --git a/.gitlab/issue_templates/Help.md b/.gitlab/issue_templates/Help.md @@ -0,0 +1,24 @@ +### Description + +A clear and concise description of what problem you're facing or any area where clarification is required + +### Expected behavior + +A clear and concise description of what you expect to happen + +### Screenshots + +If applicable, add screenshots to help explain your problem + +### Additional context + +Add any other context about the problem + +### Metadata + +Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result. + +```console +[user@system:~]$ nix-shell -p nix-info --run "nix-info -m" +output here +``` diff --git a/.gitlab/pipelines/build.yml b/.gitlab/pipelines/build.yml @@ -0,0 +1,29 @@ +# Build Device Configuration +device: + stage: build + only: + - tags + except: + - /^(?!stable).+@/ + allow_failure: true + variables: + CACHIX_AUTH_TOKEN: $CACHIX_TOKEN + CACHIX_CACHE_NAME: maydayv7-dotfiles + parallel: + matrix: + - DEVICE: [Vortex, Futura] + script: cachix watch-exec $CACHIX_CACHE_NAME nix build .#nixosConfigurations.$DEVICE.config.system.build.toplevel -- -L --show-trace + +# Build and Upload Install Media Image +iso: + stage: build + only: + - tags + except: + - /^(?!stable).+@/ + variables: + ISO: xfce # Default Variant + script: nix build .#installMedia.$ISO.config.system.build.isoImage -L --show-trace + after_script: + - nix profile install .#curl + - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./result/iso/nixos.iso ${PACKAGE_REGISTRY}/installMedia/${CI_COMMIT_TAG}/NixOS.iso' diff --git a/.gitlab/pipelines/check.yml b/.gitlab/pipelines/check.yml @@ -0,0 +1,11 @@ +# Check Nix Syntax +check: + stage: check + only: + changes: + - "*.nix" + - "**/*.nix" + except: + - tags + - schedules + script: nix flake check --keep-going diff --git a/.gitlab/pipelines/release.yml b/.gitlab/pipelines/release.yml @@ -0,0 +1,20 @@ +# Release Install Media Image +release: + stage: publish + image: registry.gitlab.com/gitlab-org/release-cli:latest + only: + - tags + except: + - /^(?!stable).+@/ + needs: + - job: iso + script: echo "Creating Release..." + release: + name: $CI_COMMIT_TAG + description: "Draft Release" + tag_name: $CI_COMMIT_TAG + ref: $CI_COMMIT_SHA + assets: + links: + - name: NixOS.iso + url: "${PACKAGE_REGISTRY}/installMedia/${CI_COMMIT_TAG}/NixOS.iso" diff --git a/.gitlab/pipelines/shell.yml b/.gitlab/pipelines/shell.yml @@ -0,0 +1,18 @@ +# Check Nix Developer Shells +shell: + stage: check + only: + changes: + - "shells/*" + except: + - tags + - schedules + allow_failure: true + variables: + CACHIX_AUTH_TOKEN: $CACHIX_TOKEN + CACHIX_CACHE_NAME: maydayv7-dotfiles + parallel: + matrix: + - DEVSHELL: + [cc, format, go, java, lisp, lua, python, rust, video, website] + script: cachix watch-exec $CACHIX_CACHE_NAME nix develop .#$DEVSHELL diff --git a/.gitlab/pipelines/update.yml b/.gitlab/pipelines/update.yml @@ -0,0 +1,18 @@ +# Automatic Scheduled Updates +update: + stage: publish + only: + - schedules + except: + - /^(?!stable).+@/ + before_script: + - export GIT_SSL_CAINFO="$CI_SERVER_TLS_CA_FILE" + - git config --global user.email "${GITLAB_USER_EMAIL}" + - git config --global user.name "${GITLAB_USER_NAME}" + - git branch update-$CI_JOB_ID + - git checkout update-$CI_JOB_ID + script: + - nix flake update --commit-lock-file + - cd packages && ./update.sh + after_script: + - git push "https://${CI_PROJECT_NAMESPACE}:${ACCESS_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git" HEAD:update-$CI_JOB_ID -o merge_request.create -o merge_request.target=stable -o merge_request.remove_source_branch