Package CI Template
A Wyn package is a git repo, so CI is ordinary git-repo CI: check, test, and format on every push and PR. There is no registry to publish to - a release is a git tag - so the release step just tags and pushes.
.github/workflows/ci.yml
yaml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Wyn
run: curl -fsSL https://wynlang.com/install.sh | sh
- name: Restore dependencies
run: |
export PATH="$HOME/.wyn/bin:$PATH"
[ -f wyn.toml ] && wyn restore || true
- name: Check
run: |
export PATH="$HOME/.wyn/bin:$PATH"
for f in src/*.wyn; do
wyn check "$f" || exit 1
done
- name: Test
run: |
export PATH="$HOME/.wyn/bin:$PATH"
for f in tests/*.wyn; do
[ -f "$f" ] || continue
wyn run "$f" || exit 1
done
- name: Format check
run: |
export PATH="$HOME/.wyn/bin:$PATH"
for f in src/*.wyn; do
wyn fmt "$f" --check || exit 1
done
wyn restoreneeds its dependencies to clone without prompting. If your package depends on private repos, configure a non-interactive credential helper or an SSH deploy key in the job beforewyn restore- see Creating Packages.
Releasing
There is no publish step. Cut a release by tagging a commit and pushing the tag:
sh
git tag v1.0.0
git push --tagsConsumers then pin it with wyn add github.com/you/[email protected].
If you want the tag push automated, add a release job that runs on tags:
yaml
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create GitHub Release
uses: softprops/action-gh-release@v2Usage
- Copy the workflow file to your package repo.
- Ensure your package has
src/andtests/directories. - Push to GitHub - CI runs automatically.
- Tag
vX.Y.Zwhen you're ready to release.
Package Structure
my-lib/
├── wyn.toml
├── src/
│ └── my-lib.wyn
├── tests/
│ └── test_my-lib.wyn
└── .github/
└── workflows/
└── ci.ymlSee Also
- Creating Packages - package structure and publishing
- Using Packages - add and import dependencies
- CLI Commands -
wyn test,wyn fmt,wyn restore