Skip to content

run CI on PR events #166

run CI on PR events

run CI on PR events #166

Workflow file for this run

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@v4
# 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
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 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
path: |
*.so
*.h
build-windows:
runs-on: windows-2019
needs:
- test-windows
strategy:
matrix:
mingw: [ "MINGW32", "MINGW64" ]
include:
# - mingw: "MINGW32"
# package: "mingw-w64-i686"
# GOARCH: 386
- mingw: "MINGW64"
package: "mingw-w64-x86_64"
GOARCH: amd64
env:
MSYSTEM: ${{ matrix.mingw }}
CHERE_INVOKING: 1
GOARCH: ${{ matrix.GOARCH }}
CGO_ENABLED: 1
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: Set up shell
run: echo ::add-path::C:\msys64\usr\bin\
shell: pwsh
- name: Print system version
run: |
uname
- run: |
go get github.com/antlr4-go/antlr/v4
go build --buildmode=c-shared -o a2l_grpc_$(go env GOOS)_$(go env GOARCH).dll ./cmd/a2l/a2l.go
- uses: actions/upload-artifact@v4
with:
name: windows
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@v4
# 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
path: a2l_grpc
- uses: actions/download-artifact@v4
with:
name: windows
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"