Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup GitHub Actions #2

Merged
merged 14 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: make python devex basics

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- macos-13
- macos-14
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Add Poetry and pyenv setup
run: |
echo 'export PYENV_ROOT="$HOME/.pyenv"' | tee -a ~/.zshrc | tee -a ~/.bashrc | tee -a ~/.profile
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' | tee -a ~/.zshrc | tee -a ~/.bashrc | tee -a ~/.profile
echo 'eval "$(pyenv init -)"' | tee -a ~/.zshrc | tee -a ~/.bashrc | tee -a ~/.profile
(
echo
echo 'if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi'
) | tee -a ~/.zshrc | tee -a ~/.bashrc | tee -a ~/.profile
echo 'export PATH="${HOME}/.local/bin:$PATH"' | tee -a ~/.zshrc | tee -a ~/.bashrc | tee -a ~/.profile

- name: Install dependencies initially
shell: "bash --login -eo pipefail {0}"
env:
# Force overwriting during tests since a human cannot intervene
# Do not upgrade dependents unless we have to
BREW_BUNDLE_OPTS: --force --no-upgrade
# Have to run it twice because of some dependencies
# installed but not usable the first time.
run: make deps || true

- name: Show program paths
shell: "bash --login -eo pipefail {0}"
run: |
echo "${PATH}"
command -v pyenv || true
command -v poetry || true
command -v python3 || true

- name: Install dependencies after installing some dependencies
shell: "bash --login -eo pipefail {0}"
env:
# See above for an explanation of these options.
BREW_BUNDLE_OPTS: --force --no-upgrade
run: make deps

- name: Run check
shell: "bash --login -eo pipefail {0}"
run: make check

- name: Run tests
shell: "bash --login -eo pipefail {0}"
run: make test

- name: Run build
shell: "bash --login -eo pipefail {0}"
run: make build
3 changes: 1 addition & 2 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
3.12

3.11
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ COLOR_GREEN = \033[32m
COLOR_RESET = \033[0m
.PHONY: deps-brew
deps-brew: ## Installs development dependencies from Homebrew
brew bundle install --no-lock --verbose --file=Brewfile
brew bundle install $(BREW_BUNDLE_OPTS) --no-lock --verbose --file=Brewfile
@test -n "$(PYENV_SHELL)" || ( \
echo "$(COLOR_ORANGE)PYENV_SHELL is empty so pyenv may not be setup.$(COLOR_RESET)" && \
echo "$(COLOR_ORANGE)Ensure that pyenv is setup in your shell config, e.g. in ~/.bashrc.$(COLOR_RESET)" && \
Expand Down
Loading