Expand action coverage #3
This file contains hidden or 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: Compile Go and run Python | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: 'stable' | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.x' | |
| - name: Build Go code | |
| run: | | |
| for x in hello primitive; do | |
| go build -buildmode=c-shared -o $x.so ./$x | |
| done | |
| - name: Run Python script | |
| run: | | |
| for x in hello primitive; do | |
| python $x/$x.py > $x.out | |
| done | |
| - name: Check output | |
| run: | | |
| if [ "$(cat hello.out)" != "Hello world!" ]; then | |
| echo "Output is incorrect:" | |
| printf '%q\n' "$(cat hello.out)" | |
| exit 1 | |
| fi | |
| if [ "$(cat primitive.out)" != "10 + 15 = 25" ]; then | |
| echo "Output is incorrect:" | |
| printf '%q\n' "$(cat primitive.out)" | |
| exit 1 | |
| fi |