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

added flake + CI tests #2

Merged
merged 2 commits into from
Jan 3, 2025
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
46 changes: 46 additions & 0 deletions .github/workflows/tests_native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
pull_request:
workflow_dispatch:

# this cancels workflows currently in progress if you start a new one
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

run-tests:
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3

# get roc cli
- id: try_fetching_testing_release
continue-on-error: true
run: |
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-TESTING.tar.gz

- name: There are no TESTING releases, checking regular releases instead
if: steps.try_fetching_testing_release.outcome == 'failure'
run: |
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz

- name: rename nightly tar
run: mv $(ls | grep "roc_nightly.*tar\.gz") roc_nightly.tar.gz

- name: decompress the tar
run: tar -xzf roc_nightly.tar.gz

- run: rm roc_nightly.tar.gz

- name: simplify nightly folder name
run: mv roc_nightly* roc_nightly

- name: Add roc_nightly to PATH
run: echo "${{ github.workspace }}/roc_nightly" >> $GITHUB_PATH

- run: roc version

# run all tests
- name: Run tests
run: ./CI/all_tests.sh
26 changes: 26 additions & 0 deletions .github/workflows/tests_nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
pull_request:
workflow_dispatch:

# this cancels workflows currently in progress if you start a new one
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-tests-nix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

# install nix
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Run tests
run: nix develop -c sh -c './CI/all_tests.sh'
6 changes: 6 additions & 0 deletions CI/all_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -exo pipefail

roc check main.roc
182 changes: 182 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "roc agent devShell flake";

inputs = {
roc.url = "github:roc-lang/roc";
nixpkgs.follows = "roc/nixpkgs";

# to easily make configs for multiple architectures
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, roc }:
let supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
in flake-utils.lib.eachSystem supportedSystems (system:
let
pkgs = import nixpkgs { inherit system; };
rocPkgs = roc.packages.${system};

linuxInputs = with pkgs;
lib.optionals stdenv.isLinux [
];

darwinInputs = with pkgs;
lib.optionals stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
]);

sharedInputs = (with pkgs; [
rocPkgs.cli
]);
in {

devShell = pkgs.mkShell {
buildInputs = sharedInputs ++ darwinInputs ++ linuxInputs;
};

formatter = pkgs.nixpkgs-fmt;
});
}
Loading