Now I need Linux to test on.
Eventually I want to run Tipsy-Robot with the png generator on little micro-computer here in the house. Getting from developing on my Mac to that little nugget means cross checking everything on Linux.
Two examples on how to verify things work: a VM and a GitHub Action
Semi-Virtual VirtualBox
I use VirtualBox as my VM. Conveniences like being able to copy paste between windows makes working on a code base for both environments super easy.
Misc brief notes on setting up VirtualBox
- Go get Virtual Box: https://www.virtualbox.org/wiki/Downloads
- Install
- Go get ISO, ubuntu, LTS stands for Long Term Support
- New
- Setup Permission for VirtualBox “Input Monitoring”
Misc Other
- Set the scree size
- Add terminal to favorites
- https://www.virtualbox.org/manual/ch04.html. // install guest device got to Devices> to turn them on
- https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/
- https://wiki.archlinux.org/title/Bash/Prompt_customization
Add Swift The Long Way
sudo apt update
sudo apt upgrade
sudo apt install clang libicu-dev build-essential pkg-config
mkdir ~/swift
cd ~/swift
# go to https://www.swift.org/download/#releases for current links
wget https://download.swift.org/swift-5.8-release/ubuntu2004/swift-5.8-RELEASE/swift-5.8-RELEASE-ubuntu20.04.tar.gz
tar xzf swift-5.8-RELEASE-ubuntu20.04.tar.gz #add v (xzvf) to see all files
mv swift-5.8-RELEASE-ubuntu22.04 5.8
# swift.org recommended choice: add a simlink to `swift` command to `/usr/bin/`
# instead of adding version folder to $PATH.
sudo ln -s ~/swift/5.8/usr/bin/swift /usr/bin/swift
swift --version
Add what we need:
sudo apt install git
sudo apt install gh #optional
sudo apt install libpng-dev
mkdir ~/Documents/GitHub
cd ~/Documents/GitHub
gh auth login #https://cli.github.com/manual/gh_auth_login
gh repo clone carlynorama/SwiftLIBPNG
#or
git@github.com:carlynorama/SwiftLIBPNG.git
cd SwiftLIBPNG
swift build
If installing VScode will also need sourcekit-lsp. Discussion: https://forums.swift.org/t/vscode-extension/29722
Super Virtual Linux (Github Action)
Use action like one checking APITizer
name: Build Linux
on:
push:
branches:
- '*'
pull_request:
branches:
- main
jobs:
build:
name: Build Linux
runs-on: ubuntu-latest
container:
image: swift:latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install sudo package
run: apt update && apt install sudo
- name: Install libpng
run: |
sudo apt-get install libpng-dev -y
- name: Build and Test
run: |
swift build
swift test
TODO: Cache the image with libpng?