Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Sep 12, 2023
1 parent 2edc655 commit 9308a04
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
15 changes: 14 additions & 1 deletion .github/actions/create-dev-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,26 @@ runs:
# See: https://github.com/actions/setup-python/issues/108
# python3 is manually preinstalled in the arm64 VM self-hosted runner
- name: Set Up Python 🐍
if: ${{ inputs.architecture == 'amd64' }}
uses: actions/setup-python@v4
with:
python-version: 3.x
if: ${{ inputs.architecture == 'amd64' }}

- name: System set for macOS runner
if: ${{ inputs.architecture == 'arm64' }}
run: |
export GITHUB_RUNNER_USER=$(whoami)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/${GITHUB_RUNNER_USER}/.zprofile
echo 'export PATH="/opt/homebrew/opt/python/libexec/bin:$PATH"' >> /Users/${GITHUB_RUNNER_USER}/.zprofile
echo 'export DOCKER_HOST="unix://$HOME/.colima/default/docker.sock"' >> /Users/${GITHUB_RUNNER_USER}/.zprofile
shell: bash

- name: Install Dev Dependencies 📦
run: |
echo $(whoami)
echo $(which python)
echo $(python --version)
echo $PATH
pip install --upgrade pip
pip install --upgrade -r requirements-dev.txt
shell: bash
4 changes: 3 additions & 1 deletion .github/workflows/docker-build-test-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ jobs:
shell: bash

- name: Save image as a tar for later use 💾
run: docker save ${{ env.OWNER }}/${{ inputs.image }} -o /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar
run: |
mkdir -p /tmp/aiidalab/
docker save ${{ env.OWNER }}/${{ inputs.image }} -o /tmp/aiidalab/${{ inputs.image }}-${{ inputs.architecture }}.tar
shell: bash

- name: Upload image as artifact 💾
Expand Down
31 changes: 31 additions & 0 deletions aarch64-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,37 @@ Configure your runner:
This will create the plist file for the runner service, it is not able to run it with the non-gui user.
As shown in the [issue](https://github.com/actions/runner/issues/1056#issuecomment-1237426462), real services start on boot, not on login so on macOS this means the service needs to be a `LaunchDaemon` and not a `LaunchAgent`.

In case the python path is not correct, change the `runsvc.sh` file to the correct path.
Since we use `colima` as the container runtime, the docker sock is located at `unix://$HOME/.colima/default/docker.sock`.
Change the `runsvc.sh` file to:

```bash
#!/bin/bash

# convert SIGTERM signal to SIGINT
# for more info on how to propagate SIGTERM to a child process see: http://veithen.github.io/2014/11/16/sigterm-propagation.html
trap 'kill -INT $PID' TERM INT

if [ -f ".path" ]; then
# configure
export PATH=`cat .path`
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/opt/python/libexec/bin:$PATH"
export DOCKER_HOST="unix://$HOME/.colima/default/docker.sock
echo ".path=${PATH}"
fi
nodever=${GITHUB_ACTIONS_RUNNER_FORCED_NODE_VERSION:-node16}
# insert anything to setup env when running as a service
# run the host process which keep the listener alive
./externals/$nodever/bin/node ./bin/RunnerService.js &
PID=$!
wait $PID
trap - TERM INT
wait $PID
```
```bash
sudo mv /Users/runner-user/Library/LaunchAgents/actions.runner.*.plist /Library/LaunchDaemons/
sudo chown root:wheel /Library/LaunchDaemons/actions.runner.*.plist
Expand Down
5 changes: 3 additions & 2 deletions aarch64-runner/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ sudo -i -u ${GITHUB_RUNNER_USER} bash << EOF
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
echo "Setting up python3"
brew install python
# For Apple Silicon machines, the path are slightly different.
# For Apple Silicon machines, the path are slightly different.
# After running brew install python, must ensure your ~/.zprofile uses the correct Homebrew paths:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/${GITHUB_RUNNER_USER}/.zprofile
echo 'export PATH="/opt/homebrew/opt/python/libexec/bin:$PATH"' >> /Users/${GITHUB_RUNNER_USER}/.zprofile
echo "Setting up docker"
echo 'export DOCKER_HOST="unix://$HOME/.colima/default/docker.sock"' >> /Users/${GITHUB_RUNNER_USER}/.zprofile
echo "Setting up docker "
brew install docker
brew install colima
EOF
Expand Down

0 comments on commit 9308a04

Please sign in to comment.