-
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 pull request #1 from pragmaticivan/ci-setup
feat: init CI setup
- Loading branch information
Showing
17 changed files
with
624 additions
and
19 deletions.
There are no files selected for viewing
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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
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,55 @@ | ||
name: MacOS | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- "README.md" | ||
- "Makefile" | ||
- "Dockerfile" | ||
- "install/ubuntu/**" | ||
- ".chezmoiscripts/ubuntu/**" | ||
- "dot_tmux.conf.d/os/ubuntu.conf" | ||
- "tests/install/ubuntu/**" | ||
|
||
pull_request: | ||
branches: [main] | ||
paths-ignore: | ||
- "README.md" | ||
- "Makefile" | ||
- "Dockerfile" | ||
- "install/ubuntu/**" | ||
- ".chezmoiscripts/ubuntu/**" | ||
- "dot_tmux.conf.d/os/ubuntu.conf" | ||
- "tests/install/ubuntu/**" | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-14 # M1 Mac | ||
|
||
steps: | ||
- name: Setup dotfiles | ||
env: | ||
DOTFILES_DEBUG: 1 | ||
EVENT_NAME: ${{ github.event_name }} | ||
run: | | ||
if [ "${EVENT_NAME}" == "push" ]; then | ||
BRANCH_NAME="${{ github.ref_name }}" | ||
elif [ "${EVENT_NAME}" == "pull_request" ]; then | ||
BRANCH_NAME="${{ github.head_ref }}" | ||
fi | ||
export BRANCH_NAME | ||
URL="https://raw.githubusercontent.com/pragmaticivan/dotfiles/${BRANCH_NAME}/setup.sh" | ||
echo "Download setup.sh from ${URL}" | ||
bash -c "$(curl -fsLS $URL)" | ||
- name: Test file existence | ||
run: | | ||
brew install bats-core | ||
cd $(chezmoi source-path)/../ | ||
bats --print-output-on-failure \ | ||
tests/files/common.bats \ | ||
tests/files/macos.bats |
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,72 @@ | ||
name: Ubuntu | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- "README.md" | ||
- "Makefile" | ||
- "Dockerfile" | ||
- "install/macos/**" | ||
- ".chezmoiscripts/macos/**" | ||
- "dot_tmux.conf.d/os/macos.conf" | ||
- "tests/install/macos/**" | ||
|
||
pull_request: | ||
branches: [main] | ||
paths-ignore: | ||
- "README.md" | ||
- "Makefile" | ||
- "Dockerfile" | ||
- "install/macos/**" | ||
- ".chezmoiscripts/macos/**" | ||
- "dot_tmux.conf.d/os/macos.conf" | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
system: [server, client] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup dotfiles | ||
env: | ||
SYSTEM: ${{ matrix.system }} | ||
DOTFILES_DEBUG: 1 | ||
EVENT_NAME: ${{ github.event_name }} | ||
run: | | ||
if [ "${EVENT_NAME}" == "push" ]; then | ||
BRANCH_NAME="${{ github.ref_name }}" | ||
elif [ "${EVENT_NAME}" == "pull_request" ]; then | ||
BRANCH_NAME="${{ github.head_ref }}" | ||
fi | ||
export BRANCH_NAME | ||
URL="https://raw.githubusercontent.com/pragmaticivan/dotfiles/${BRANCH_NAME}/setup.sh" | ||
echo "Download setup.sh from ${URL}" | ||
printf '${SYSTEM}\n' | bash -c "$(wget -qO - $URL)" | ||
- name: Install latest bats-core | ||
run: | | ||
tmp_dir=$(mktemp -d /tmp/bats-core-XXXXX) | ||
git clone --depth 1 https://github.com/bats-core/bats-core.git "${tmp_dir}" | ||
cd "${tmp_dir}" | ||
sudo ./install.sh /usr/local | ||
rm -rf "${tmp_dir}" | ||
- name: Test file existence | ||
env: | ||
SYSTEM: ${{ matrix.system }} | ||
run: | | ||
cd $(chezmoi source-path)/../ | ||
bats tests/files/common.bats | ||
bats --filter-tags common,ubuntu:${SYSTEM} \ | ||
--print-output-on-failure \ | ||
tests/files/ubuntu.bats |
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
File renamed without changes.
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 |
---|---|---|
@@ -1,18 +1,45 @@ | ||
![dotfiles](https://github.com/pragmaticivan/dotfiles/assets/301291/291198e8-5175-4562-88a2-c885458cc003) | ||
|
||
|
||
## Introduction | ||
## 🚀 Overview | ||
|
||
Your dotfiles are how you personalize your system. These are mine. | ||
|
||
## Why | ||
|
||
Maintaining dotfiles for your computer is crucial for several reasons. Firstly, it ensures consistency across different machines, allowing you to replicate your preferred settings, shortcuts, and configurations effortlessly. This consistency saves time and frustration when transitioning between workstations or setting up a new system. Secondly, dotfiles serve as a personal backup of your customized environment. By version-controlling them with tools like Git, you not only safeguard against accidental changes but also enable easy restoration in case of system crashes or upgrades. | ||
|
||
## Install | ||
## 🌴 Setup | ||
|
||
To set up the dotfiles run the appropriate snippet in the terminal. | ||
|
||
### 💻 `MacOS` [![MacOS](https://github.com/pragmaticivan/dotfiles/actions/workflows/macos.yaml/badge.svg)](https://github.com/pragmaticivan/dotfiles/actions/workflows/macos.yaml) | ||
|
||
- Configuration snippet of the Apple Silicon MacOS environment for client macnine: | ||
|
||
```console | ||
bash -c "$(curl -fsLS https://raw.githubusercontent.com/pragmaticivan/dotfiles/main/setup.sh)" | ||
``` | ||
|
||
### 🖥️ `Ubuntu` [![Ubuntu](https://github.com/pragmaticivan/dotfiles/actions/workflows/ubuntu.yaml/badge.svg)](https://github.com/pragmaticivan/dotfiles/actions/workflows/ubuntu.yaml) | ||
|
||
- Configuration snippet of the Ubuntu environment for both client and server machine: | ||
|
||
```console | ||
bash -c "$(wget -qO - https://raw.githubusercontent.com/pragmaticivan/dotfiles/main/setup.sh)" | ||
``` | ||
|
||
### Minimal setup | ||
|
||
The following is a minimal setup command to install chezmoi and my dotfiles from the github repository on a new empty machine: | ||
|
||
> sh -c "$(curl -fsLS get.chezmoi.io)" -- init pragmaticivan --apply | ||
|
||
## 👏 Acknowledgements | ||
|
||
Inspiration and code was taken from many sources, including: | ||
|
||
1. `$ sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply pragmaticivan` | ||
- [shunk031/dotfiles](https://github.com/shunk031/dotfiles). | ||
- [caarlos0/dotfiles](https://github.com/caarlos0/dotfiles). | ||
|
||
## License | ||
## 📝 License | ||
|
||
MIT License | ||
The code is available under the [MIT license](https://github.com/pragmaticivan/dotfiles/blob/master/LICENSE). |
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,16 @@ | ||
{{- $system := "" -}} | ||
{{- if hasKey . "system" -}} | ||
{{- $system = .system -}} | ||
{{- /* Set client to the MacOS default system */ -}} | ||
{{- else if eq .chezmoi.os "darwin" -}} | ||
{{ $system = "client" -}} | ||
{{- else -}} | ||
{{- $system = promptString "System (client or server)" -}} | ||
{{- end -}} | ||
|
||
data: | ||
name: "Ivan Santos" | ||
gitemail: "[email protected]" | ||
system: {{ $system | quote }} | ||
editor: "nvim" | ||
visualeditor: "code" |
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,7 @@ | ||
{{ if eq .chezmoi.os "linux" -}} | ||
{{ if eq .chezmoi.osRelease.idLike "debian" -}} | ||
{{ include "../install/ubuntu/common/ssh.sh" }} | ||
{{ else -}} | ||
echo "Invalid linux distribution: {{ .chezmoi.osRelease.id }}" | ||
{{ end -}} | ||
{{ end -}} |
5 changes: 5 additions & 0 deletions
5
home/.chezmoiscripts/ubuntu/run_once_05-install-chezmoi.sh.tmpl
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,5 @@ | ||
{{ if eq .chezmoi.os "linux" -}} | ||
{{ if eq .chezmoi.osRelease.idLike "debian" -}} | ||
{{ include "../install/ubuntu/common/chezmoi.sh" }} | ||
{{ end -}} | ||
{{ end -}} |
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
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -Eeuo pipefail | ||
|
||
if [ "${DOTFILES_DEBUG:-}" ]; then | ||
set -x | ||
fi | ||
|
||
function install_chezmoi() { | ||
sudo sh -c "$(curl -fsLS get.chezmoi.io)" -- -b /usr/local/bin | ||
} | ||
|
||
function uninstall_chezmoi() { | ||
sudo rm -fv /usr/local/bin/chezmoi | ||
} | ||
|
||
function main() { | ||
install_chezmoi | ||
} | ||
|
||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | ||
main | ||
fi |
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,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -Eeuo pipefail | ||
|
||
if [ "${DOTFILES_DEBUG:-}" ]; then | ||
set -x | ||
fi | ||
|
||
readonly PACKAGES=( | ||
openssh-client | ||
) | ||
|
||
function install_openssh() { | ||
sudo apt-get install -y "${PACKAGES[@]}" | ||
} | ||
|
||
function uninstall_openssh() { | ||
sudo apt-get remove -y "${PACKAGES[@]}" | ||
} | ||
|
||
function main() { | ||
install_openssh | ||
} | ||
|
||
if [ ${#BASH_SOURCE[@]} = 1 ]; then | ||
main | ||
fi |
Oops, something went wrong.