Add snippet-test pkl test file and CI (#10) #14
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
name: test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
pkl-unit: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pklVersion: ["0.25.0", "0.25.1"] | |
steps: | |
- uses: actions/checkout@v2 | |
# Install pkl binary | |
- name: Create /tmp/bin and add to PATH | |
run: | | |
mkdir -p "{{ runner.temp }}/bin" && \ | |
echo "{{ runner.temp }}/bin" >> "$GITHUB_PATH" | |
- name: Fetch Pkl binary from GitHub release | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: apple/pkl | |
version: tags/${{ matrix.pklVersion }} | |
file: pkl-linux-amd64 | |
target: "{{ runner.temp }}/bin/pkl" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make pkl binary executable | |
run: chmod +x "{{ runner.temp }}/bin/pkl" | |
- name: Run tests | |
run: | | |
tests=$(find ./codegen/src/ -name '*.test.pkl') | |
pkl test $tests | |
pkl-snippet: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pklVersion: ["0.25.0", "0.25.1"] | |
steps: | |
- uses: actions/checkout@v2 | |
# Install pkl binary | |
- name: Create /tmp/bin and add to PATH | |
run: | | |
mkdir -p "{{ runner.temp }}/bin" && \ | |
echo "{{ runner.temp }}/bin" >> "$GITHUB_PATH" | |
- name: Fetch Pkl binary from GitHub release | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: apple/pkl | |
version: tags/${{ matrix.pklVersion }} | |
file: pkl-linux-amd64 | |
target: "{{ runner.temp }}/bin/pkl" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make pkl binary executable | |
run: chmod +x "{{ runner.temp }}/bin/pkl" | |
- name: Run tests | |
run: | | |
pkl test codegen/snippet-tests/test.pkl | |
e2e: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18, 20] | |
pklVersion: ["0.25.0", "0.25.1"] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: npm | |
# Install pkl binary | |
- name: Create /tmp/bin and add to PATH | |
run: | | |
mkdir -p "{{ runner.temp }}/bin" && \ | |
echo "{{ runner.temp }}/bin" >> "$GITHUB_PATH" | |
- name: Fetch Pkl binary from GitHub release | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: apple/pkl | |
version: tags/${{ matrix.pklVersion }} | |
file: pkl-linux-amd64 | |
target: "{{ runner.temp }}/bin/pkl" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make pkl binary executable | |
run: chmod +x "{{ runner.temp }}/bin/pkl" | |
- run: npm install | |
- run: npm run test:e2e |