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

Implement bin/install-roc and .github/workflows/test.yml #43

Merged
merged 1 commit into from
Aug 28, 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
30 changes: 9 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
# This workflow will do a clean install of the dependencies and run tests across different versions
#
# Replace <track> with the track name
# Replace <image-name> with an image to run the jobs on
# Replace <action to setup tooling> with a github action to setup tooling on the image
# Replace <install dependencies> with a cli command to install the dependencies
#
# Find Github Actions to setup tooling here:
# - https://github.com/actions/?q=setup&type=&language=
# - https://github.com/actions/starter-workflows/tree/main/ci
# - https://github.com/marketplace?type=actions&query=setup
#
# Requires scripts:
# - bin/verify-exercises

name: <track> / Test
name: Test

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

jobs:
ci:
runs-on: <image-name>
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Use <setup tooling>
uses: <action to setup tooling>
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install wget jq coreutils libc-dev binutils

- name: Install project dependencies
run: <install dependencies>
- name: Install Roc
run: bin/install-roc

- name: Verify all exercises
run: bin/verify-exercises
38 changes: 38 additions & 0 deletions bin/install-roc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# Synopsis:
# Install Roc

# We currently install the nightly version as Roc does not have versioned releases yet.
# Once it does, we will use that.

function download_nightly() {
local install_dir="${1}"
local install_file="${install_dir}/roc.tar.gz"
local release_url="https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz"
mkdir -p "${install_dir}"
wget -q -O ${install_file} ${release_url}
tar -xzf "${install_file}" -C "${install_dir}" --strip-components 1
rm -f "${install_file}"
}

function update_shell {
local install_dir="${1}"
local file="${HOME}/${2}"

if [[ -f "${file}" ]]; then
echo "export PATH=${install_dir}:\$PATH" >> "${file}"
source "${file}"
fi
}

install_dir="${HOME}/.roc/bin"

download_nightly "${install_dir}"

if [[ -z "${GITHUB_ACTIONS}" ]]; then
update_shell "${install_dir}" ".bashrc"
update_shell "${install_dir}" ".zshrc"
else
echo "${install_dir}" >> "${GITHUB_PATH}"
fi