Skip to content

Functional Tests

Functional Tests #7

---
name: Functional Tests
on: # yamllint disable-line rule:truthy
push:
branches:
- main
pull_request:
paths:
- .github/workflows/functional-tests.yml
- src/**
- action.yml
schedule:
# Every Friday at 09:00 JST
- cron: "0 0 * * 5"
workflow_dispatch: {}
defaults:
run:
shell: sh
jobs:
get-versions:
name: Get 3 latest versions
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
versions: ${{ steps.prepare-list.outputs.versions }}
steps:
- name: Get releases
id: github-releases
uses: yakubique/github-releases@v1.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repository: "uiua-lang/uiua"
sort: "desc"
- name: Prepare list
id: prepare-list
env:
RELEASES_AMOUNT: "3"
run: |
versions=$(echo '${{ steps.github-releases.outputs.releases }}' \
| jq -c -r --arg n "${RELEASES_AMOUNT}" '.[0:($n | tonumber)] | . += ["latest"]')
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
setup-uiua:
name: Setup Uiua
needs: [get-versions]
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
version: ${{ fromJSON(needs.get-versions.outputs.versions) }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Setup Uiua
uses: ./
with:
version: "${{ matrix.version }}"
- name: Validate command
run: |
[ "$(uiua run hello-world.ua)" = '"Hello, World"' ] || exit 1
test-force:
name: Test force
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
force: ["true", "false"]
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Setup Uiua 1
id: setup-uiua-1
uses: ./
- name: Setup Uiua 2
id: setup-uiua-2
uses: ./
with:
force: ${{ matrix.force }}
- name: Test action completion
run: |
test_equal() {
if [ "${2}" != "${3}" ]; then
echo "::error title=${1}::Expected: ${3}. Actual: ${2}."
exit 1
fi
}
test_equal "Wrong \"installed\" output from setup-uiua-1" \
"${{ steps.setup-uiua-1.outputs.installed }}" \
"true"
test_equal "Wrong \"installed\" output from setup-uiua-2" \
"${{ steps.setup-uiua-2.outputs.installed }}" \
"${{ matrix.force }}"