-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Anton-4/flake-and-ci-tests
added flake + CI tests
- Loading branch information
Showing
5 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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' |
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
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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; | ||
}); | ||
} |