Merge pull request #11 from centerforaisafety/gpu-per-user #18
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
name: Go Binary CI to OCI Artifacts | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-latest | |
name: Build Go Script and Upload to OCI Artifacts | |
env: | |
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }} | |
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }} | |
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }} | |
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }} | |
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }} | |
GO111MODULE: "on" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 # Use the specific Go version. | |
- name: Install Slurm dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y munge libmunge-dev libmunge2 slurm-wlm slurm-wlm-doc | |
- name: Configure Munge | |
run: | | |
sudo service munge stop | |
sudo service munge start | |
- name: Configure Slurm | |
run: | | |
echo "ControlMachine=$(hostname)" | sudo tee -a /etc/slurm/slurm.conf | |
echo "ClusterName=slurmcluster" | sudo tee -a /etc/slurm/slurm.conf | |
echo "NodeName=$(hostname) CPUs=1 State=UNKNOWN" | sudo tee -a /etc/slurm/slurm.conf | |
echo "PartitionName=debug Nodes=$(hostname) Default=YES MaxTime=INFINITE State=UP" | sudo tee -a /etc/slurm/slurm.conf | |
sudo service slurmctld restart | |
sudo service slurmd restart | |
- name: Test Slurm installation | |
run: sinfo | |
- name: Build Go script | |
run: make # This will generate a binary named "prometheus-slurm-exporter" | |
- name: Install OCI CLI | |
run: | | |
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" -- --accept-all-defaults | |
- name: Setup OCI CLI | |
run: | | |
mkdir -p ~/.oci | |
echo "${{ env.OCI_CLI_KEY_CONTENT }}" > /tmp/oci_private.pem | |
echo -e "[DEFAULT]\nuser=${{ env.OCI_CLI_USER }}\nfingerprint=${{ env.OCI_CLI_FINGERPRINT }}\nkey_file=/tmp/oci_private.pem\nregion=${{ env.OCI_CLI_REGION }}\ntenancy=${{ env.OCI_CLI_TENANCY }}" > ~/.oci/config | |
cat ~/.oci/config | |
- name: Upload Binary to OCI Artifacts | |
run: | | |
/home/runner/bin/oci artifacts generic artifact upload-by-path \ | |
--repository-id ocid1.artifactrepository.oc1.us-sanjose-1.0.amaaaaaa2m3huzqayy3wpbwafgbtjlv4uf4bq7ztdu4p6tb52baua5fs66ra \ | |
--artifact-path prometheus-slurm-exporter \ | |
--artifact-version v1.0 \ | |
--content-body ./bin/prometheus-slurm-exporter | |