Skip to content

Update example and README.md #21

Update example and README.md

Update example and README.md #21

Workflow file for this run

name: TypeShell Linux
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
permissions:
contents: write
jobs:
test-batch:
name: Test Batch
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Install dependencies
run: |
go get .
- name: Test
shell: cmd
run: |
go build tsh.go
go test ./tests -v -cover -coverprofile=coverage.out -coverpkg ./lexer,./parser,./transpiler || exit -1
go tool cover -func=coverage.out
test-bash:
needs: test-batch
name: Test Bash
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Install dependencies
run: |
go get .
- name: Test Bash
shell: bash
run: |
go build tsh.go
go test ./tests -v -cover -coverprofile=coverage.out -coverpkg ./lexer,./parser,./transpiler || exit -1
go tool cover -func=coverage.out
build:
needs: test-bash
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
os: ['linux', 'windows']
arch: ['386', 'amd64', 'arm64']
steps:
- uses: actions/checkout@v4
- name: Build
shell: bash
run: |
if [ "${{ matrix.os }}" == "windows" ]; then
EXT=".exe"
else
EXT=
fi
EXECUTABLE="tsh_${{ matrix.os }}_${{ matrix.arch }}${EXT}"
echo "EXECUTABLE<<EOF" >> $GITHUB_ENV
echo "${EXECUTABLE}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Building for ${{ matrix.os }} ${{ matrix.arch }}"
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o ${EXECUTABLE} tsh.go
- name: Release
if: ${{ github.event_name == 'release' }}
run: |
echo "Uploading ${{ env.EXECUTABLE }} release file"
gh release upload ${{ github.event.release.tag_name }} ${{ env.EXECUTABLE }}
env:
GH_TOKEN: ${{ github.TOKEN }}