Skip to content

Commit

Permalink
add new workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty committed Sep 12, 2024
1 parent 50c7802 commit 7f4b9af
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 169 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build all packages

# on:
# push:
# branches:
# - main
# workflow_dispatch:
# pull_request:
# branches:
# - main
on: ["push"]

jobs:
build:
strategy:
matrix:
include:
- { target: linux-64, os: ubuntu-latest }
- { target: osx-arm64, os: macos-14 }
fail-fast: false

runs-on: ${{ matrix.os }}
timeout-minutes: 5

defaults:
run:
shell: bash

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install magic
run: |
curl -ssL https://magic.modular.com | bash
- name: Build package for target platform
env:
TARGET_PLATFORM: ${{ matrix.target }}
PREFIX_API_KEY: ${{ secrets.PREFIX_API_KEY }}
CONDA_BLD_PATH: ${{ runner.workspace }}/.rattler

run: |
source $HOME/.bash_profile
# Temporary method to fetch the rattler binary.
RATTLER_BINARY="rattler-build-aarch64-apple-darwin"
if [[ $TARGET_PLATFORM == "linux-64" ]]; then RATTLER_BINARY="rattler-build-x86_64-unknown-linux-musl"; fi
curl -SL --progress-bar https://github.com/prefix-dev/rattler-build/releases/latest/download/${RATTLER_BINARY} -o rattler-build
chmod +x rattler-build
# Build and push
magic run build --target-platform=$TARGET_PLATFORM
magic run publish
46 changes: 30 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,39 @@ name: Run Tests

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read
pull-requests: read

jobs:
test:
runs-on: ubuntu-latest
environment: basic
name: with ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# os: ["ubuntu-latest", "macos-14"] # mac tests just hang for some reason?
os: ["ubuntu-latest"]

runs-on: ${{ matrix.os }}
timeout-minutes: 5

defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install dependencies
- name: Checkout repo
uses: actions/checkout@v4

- name: Install magic
run: |
curl https://get.modular.com | MODULAR_AUTH=${{ secrets.MODULAR_AUTH }} sh -
modular auth ${{ secrets.MODULAR_AUTH }}
modular install mojo
pip install pytest
pip install git+https://github.com/guidorice/mojo-pytest.git
- name: Unit Tests
curl -ssL https://magic.modular.com | bash
- name: Run tests
run: |
export MODULAR_HOME="/home/runner/.modular"
export PATH="/home/runner/.modular/pkg/packages.modular.com_mojo/bin:$PATH"
pytest tests/unit
pytest tests/integration
bash run_examples.sh
source $HOME/.bash_profile
magic run tests
magic run benchmarks
magic run examples
21 changes: 11 additions & 10 deletions src/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ context:
version: "13.4.2"

package:
name: "mist"
name: "mog"
version: 0.1.3.nightly

source:
Expand All @@ -15,14 +15,15 @@ source:
build:
script:
- mkdir -p ${PREFIX}/lib/mojo
- magic run mojo package mist
- cp mist.mojopkg ${PREFIX}/lib/mojo/mist.mojopkg
- magic run mojo package mog
- cp mog.mojopkg ${PREFIX}/lib/mojo/mog.mojopkg

requirements:
run:
- gojo >= 0.1.6.nightly
- hue >= 0.1.3.nightly
- gojo >= 0.1.7.nightly
- max >= 24.6.0.dev2024091205
- weave >= 0.1.0.nightly
- mist >= 0.1.3.nightly

tests:
- script:
Expand All @@ -31,19 +32,19 @@ tests:
# if I don't copy everything into a test dir, mojo test runs the tests in the .magic dir and fails :|
- mkdir -p test
- mv test_*.mojo test/
- mv mist.mojopkg test/
- mv mog.mojopkg test/
- magic run mojo test test

files:
# Extra files to be copied to the test directory from the "work directory"
source:
- mist.mojopkg
- mog.mojopkg
- mojoproject.toml
- test_*.mojo

about:
homepage: https://github.com/thatstoasty/mist
homepage: https://github.com/thatstoasty/mog
license: MIT
license_file: LICENSE
summary: mist lets you safely use advanced styling options on the terminal. https://github.com/thatstoasty/mist
repository: https://github.com/thatstoasty/mist
summary: Style definitions for nice terminal layouts. Built with TUIs in mind. https://github.com/thatstoasty/mog
repository: https://github.com/thatstoasty/mog
143 changes: 0 additions & 143 deletions test.mojo

This file was deleted.

0 comments on commit 7f4b9af

Please sign in to comment.