|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: ${{ matrix.goos }}/${{ matrix.goarch }} |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - goos: linux |
| 19 | + goarch: amd64 |
| 20 | + ext: '' |
| 21 | + - goos: windows |
| 22 | + goarch: amd64 |
| 23 | + ext: '.exe' |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Check out code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Set up Go |
| 30 | + uses: actions/setup-go@v5 |
| 31 | + with: |
| 32 | + go-version: '1.25' |
| 33 | + |
| 34 | + - name: Get dependencies |
| 35 | + run: go mod download |
| 36 | + |
| 37 | + - name: Unzip embedded bindata |
| 38 | + run: | |
| 39 | + unzip -o lib/dat/bindata.go.zip -d lib/dat/ |
| 40 | + unzip -o lib/ext/cdhit/unix/bindata.go.zip -d lib/ext/cdhit/unix/ |
| 41 | + unzip -o lib/ext/cdhit/win/bindata.go.zip -d lib/ext/cdhit/win/ |
| 42 | + unzip -o lib/ext/comet/unix/bindata.go.zip -d lib/ext/comet/unix/ |
| 43 | + unzip -o lib/ext/comet/win/bindata.go.zip -d lib/ext/comet/win/ |
| 44 | + unzip -o lib/ext/interprophet/unix/bindata.go.zip -d lib/ext/interprophet/unix/ |
| 45 | + unzip -o lib/ext/interprophet/win/bindata.go.zip -d lib/ext/interprophet/win/ |
| 46 | + unzip -o lib/ext/peptideprophet/unix/bindata.go.zip -d lib/ext/peptideprophet/unix/ |
| 47 | + unzip -o lib/ext/peptideprophet/win/bindata.go.zip -d lib/ext/peptideprophet/win/ |
| 48 | + unzip -o lib/ext/proteinprophet/unix/bindata.go.zip -d lib/ext/proteinprophet/unix/ |
| 49 | + unzip -o lib/ext/proteinprophet/win/bindata.go.zip -d lib/ext/proteinprophet/win/ |
| 50 | + unzip -o lib/ext/ptmprophet/unix/bindata.go.zip -d lib/ext/ptmprophet/unix/ |
| 51 | + unzip -o lib/ext/ptmprophet/win/bindata.go.zip -d lib/ext/ptmprophet/win/ |
| 52 | + unzip -o lib/obo/unimod/bindata.go.zip -d lib/obo/unimod/ |
| 53 | + unzip -o lib/pip/bindata.go.zip -d lib/pip/ |
| 54 | +
|
| 55 | + - name: Build |
| 56 | + env: |
| 57 | + CGO_ENABLED: '0' |
| 58 | + GOOS: ${{ matrix.goos }} |
| 59 | + GOARCH: ${{ matrix.goarch }} |
| 60 | + run: | |
| 61 | + BUILD=$(date +%Y%m%d%H%M) |
| 62 | + VERSION="${GITHUB_REF_NAME}-${GITHUB_SHA::7}" |
| 63 | + OUTPUT="philosopher-${GOOS}-${GOARCH}${{ matrix.ext }}" |
| 64 | + go build -trimpath \ |
| 65 | + -ldflags "-w -s -X main.version=${VERSION} -X main.build=${BUILD}" \ |
| 66 | + -o "${OUTPUT}" main.go |
| 67 | + ls -lh "${OUTPUT}" |
| 68 | +
|
| 69 | + - name: Upload artifact |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: philosopher-${{ matrix.goos }}-${{ matrix.goarch }} |
| 73 | + path: philosopher-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }} |
| 74 | + if-no-files-found: error |
0 commit comments