Skip to content

Commit

Permalink
feat: Add package workflow
Browse files Browse the repository at this point in the history
Part of #2

It build the binary and archive it in workflow artifacts
  • Loading branch information
Gashmob committed Jul 17, 2024
1 parent 09e7573 commit 176e54c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Package

on:
push:
branches:
- master
- dev-workflow
pull_request:

jobs:
configure:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
- name: Set matrix data
id: set-matrix
run: |
echo 'matrix<<EOF' >> "$GITHUB_OUTPUT"
echo "$(cat ./tools/ci/build-matrix.json)" >> "$GITHUB_OUTPUT"
echo EOF >> "$GITHUB_OUTPUT"
build:
name: "Build [${{ matrix.os }} - ${{ matrix.platform }}]"
needs: configure
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.configure.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7

- name: Install Nix
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
- name: Build
run: |
nix-shell --pure --run '${{ github.workspace }}/tools/ci/build.sh ${{ matrix.platform }}'
nix-shell --pure --run 'echo "$(bazel info output_path)/filc" > path.txt'
- name: Get binary path
id: path
run: echo "path=$(cat path.txt)" >> "$GITHUB_OUTPUT"
- name: Archive binary
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: "filc-${{ matrix.platform }}"
path: ${{ steps.path.outputs.path }}
9 changes: 9 additions & 0 deletions tools/ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

if [ -z "$1" ]; then
platform=""
else
platform="--platforms=//tools/bazel/platform:$1"
fi

bazel build -c opt $platform //:filc

0 comments on commit 176e54c

Please sign in to comment.