Merge pull request #7 from F-Pape/feature/add-linux-arm-support #174
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: build | |
on: [push, pull_request] | |
jobs: | |
generate-antlr-sources: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./generate_antlr.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: antlr4 | |
path: | | |
pkg/a2l/parser/grammar | |
generate-grpc-sources: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./generate_grpc.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: grpc | |
path: | | |
pkg/a2l/protobuf | |
test-linux: | |
runs-on: ubuntu-22.04 | |
needs: | |
- generate-antlr-sources | |
- generate-grpc-sources | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: antlr4 | |
path: pkg/a2l/parser | |
- uses: actions/download-artifact@v4 | |
with: | |
name: grpc | |
path: pkg/a2l | |
- run: | | |
go get github.com/antlr4-go/antlr/v4 | |
go test ./cmd/a2l/... | |
test-windows: | |
runs-on: windows-2019 | |
needs: | |
- generate-antlr-sources | |
- generate-grpc-sources | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: antlr4 | |
path: pkg/a2l/parser | |
- uses: actions/download-artifact@v4 | |
with: | |
name: grpc | |
path: pkg/a2l | |
- run: | | |
go get github.com/antlr4-go/antlr/v4 | |
go test ./cmd/a2l/... | |
test-mac: | |
runs-on: macos-latest-xlarge | |
needs: | |
- generate-antlr-sources | |
- generate-grpc-sources | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: antlr4 | |
path: pkg/a2l/parser | |
- uses: actions/download-artifact@v4 | |
with: | |
name: grpc | |
path: pkg/a2l | |
- name: Set up Go 1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: true | |
- run: | | |
go get github.com/antlr4-go/antlr/v4 | |
go test ./cmd/a2l/... | |
build-linux: | |
runs-on: ubuntu-22.04 | |
needs: | |
- test-linux | |
strategy: | |
matrix: | |
target: [ amd64, arm64, arm ] | |
include: | |
- target: amd64 | |
CGO_ENABLED: 1 | |
GOARCH: amd64 | |
CC: gcc | |
- target: arm64 | |
CGO_ENABLED: 1 | |
GOARCH: arm64 | |
CC: /usr/local/gcc-linaro-4.8-2015.06-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc | |
toolchain_source: https://releases.linaro.org/archive/15.06/components/toolchain/binaries/4.8/aarch64-linux-gnu/gcc-linaro-4.8-2015.06-x86_64_aarch64-linux-gnu.tar.xz | |
toolchain_extract: sudo tar -xf gcc-linaro-4.8-2015.06-x86_64_aarch64-linux-gnu.tar.xz -C /usr/local | |
- target: arm | |
CGO_ENABLED: 1 | |
GOARCH: arm | |
CC: /usr/local/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc | |
toolchain_source: https://releases.linaro.org/archive/15.06/components/toolchain/binaries/4.8/arm-linux-gnueabi/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabi.tar.xz | |
toolchain_extract: sudo tar -xf gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabi.tar.xz -C /usr/local | |
env: | |
CGO_ENABLED: ${{ matrix.CGO_ENABLED }} | |
GOOS: linux | |
GOARCH: ${{ matrix.GOARCH }} | |
CC: ${{ matrix.CC }} | |
name: build-linux-${{ matrix.target }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: antlr4 | |
path: pkg/a2l/parser | |
- uses: actions/download-artifact@v4 | |
with: | |
name: grpc | |
path: pkg/a2l | |
- if: ${{ matrix.CC != 'gcc' }} | |
run: | | |
wget ${{ matrix.toolchain_source }} | |
${{ matrix.toolchain_extract }} | |
- run: | | |
go get github.com/antlr4-go/antlr/v4 | |
go build --buildmode=c-shared -o a2l_grpc_$(go env GOOS)_$(go env GOARCH).so ./cmd/a2l/a2l.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux_${{ matrix.target }} | |
path: | | |
*.so | |
*.h | |
build-windows: | |
runs-on: windows-2019 | |
needs: | |
- test-windows | |
strategy: | |
matrix: | |
mingw: [ "MINGW32", "MINGW64" ] | |
include: | |
- mingw: "MINGW32" | |
path: "C:/msys64/mingw32/bin" | |
GOARCH: 386 | |
- mingw: "MINGW64" | |
path: "C:/msys64/usr/bin" | |
GOARCH: amd64 | |
env: | |
CGO_ENABLED: 1 | |
GOARCH: ${{ matrix.GOARCH }} | |
name: MSYS2 ${{ matrix.mingw }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: antlr4 | |
path: pkg/a2l/parser | |
- uses: actions/download-artifact@v4 | |
with: | |
name: grpc | |
path: pkg/a2l | |
- name: Print system version | |
shell: powershell | |
run: | | |
uname | |
- shell: powershell | |
run: | | |
go get github.com/antlr4-go/antlr/v4 | |
$env:PATH="${{ matrix.path }};$env:PATH" ;go build --buildmode=c-shared -o a2l_grpc_$(go env GOOS)_${{ matrix.GOARCH }}.dll ./cmd/a2l/a2l.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows_${{ matrix.GOARCH }} | |
path: | | |
*.dll | |
*.h | |
build-mac: | |
runs-on: macos-latest-xlarge | |
needs: | |
- test-mac | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: antlr4 | |
path: pkg/a2l/parser | |
- uses: actions/download-artifact@v4 | |
with: | |
name: grpc | |
path: pkg/a2l | |
- name: Set up Go 1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: true | |
- run: | | |
go get github.com/antlr4-go/antlr/v4 | |
go build --buildmode=c-shared -o a2l_grpc_$(go env GOOS)_$(go env GOARCH).dylib ./cmd/a2l/a2l.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: mac | |
path: | | |
*.dylib | |
*.h | |
export-protobuf-definitions: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: protobuf | |
path: | | |
protobuf | |
release: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
needs: | |
- build-linux | |
- build-windows | |
- build-mac | |
- export-protobuf-definitions | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- run: mkdir a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux_amd64 | |
path: a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux_arm64 | |
path: a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux_arm | |
path: a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: windows_386 | |
path: a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: windows_amd64 | |
path: a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: mac | |
path: a2l_grpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: protobuf | |
path: a2l_grpc/protobuf | |
- run: | | |
tar czf a2l_grpc.tar.gz a2l_grpc | |
rm -rf a2l_grpc | |
- uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ github.ref_name }} | |
commit: main | |
artifacts: "a2l_grpc.tar.gz" | |
bodyFile: "CHANGELOG.md" |