Skip to content

a bit of cleanup

a bit of cleanup #69

Workflow file for this run

name: aws_test
on:
push:
workflow_dispatch:
jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }}
aws-region: ${{ vars.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: esteve/ec2-github-runner@Optionally-execute-runner-as-a-service
with:
mode: start
github-token: ${{ secrets.GH_TOKEN }}
ec2-image-id: ${{ vars.AWS_IMAGE_ID }}
ec2-instance-type: ${{ vars.AWS_INSTANCE_TYPE }}
subnet-id: ${{ vars.AWS_SUBNET }}
security-group-id: ${{ vars.AWS_SECURITY_GROUP }}
run-runner-as-user: ubuntu
aws-resource-tags: > # optional, requires additional permissions
[
{"Key": "Name", "Value": "ec2-github-runner"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
do-the-job:
name: Do the job on the runner
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
steps:
- name: Set $HOME
run: |
echo "HOME=${{ github.workspace }}" >> $GITHUB_ENV
echo "PIP_ROOT_USER_ACTION=ignore" >> $GITHUB_ENV
- name: setting git credentials
run: |
# git config --global user.name "hvgazula"
# git config --global user.email "[email protected]"
echo $HOME
whoami
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Datalad
env:
DEBIAN_FRONTEND: noninteractive
run:
|
pip install datalad-installer
sudo apt-get update
sudo apt-get install -y git-annex
git config --global filter.annex.process "git-annex filter-process"
pip install datalad
# uses: neuronets/datalad-action/install@main
# with:
# pip_install: datalad-osf
- name: print datalad version
run: |
datalad --version
stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- do-the-job # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }}
aws-region: ${{ vars.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}