build-and-test.yml

  1---
  2name: build-and-test
  3
  4on:
  5  workflow_call:
  6    secrets:
  7      github-test-token:
  8        required: true
  9      github-token-private:
 10        required: true
 11      github-token-public:
 12        required: true
 13      gitlab-api-token:
 14        required: true
 15      gitlab-project-id:
 16        required: true
 17
 18permissions:
 19  contents: read
 20
 21jobs:
 22  standard:
 23    strategy:
 24      matrix:
 25        platform: [ubuntu-latest, macos-latest]
 26    runs-on: ${{ matrix.platform }}
 27    steps:
 28      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
 29        with:
 30          persist-credentials: false
 31
 32      - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1
 33
 34      - name: build with nix-build
 35        run: |
 36          nix-build -A default --argstr version "${{ github.sha }}"
 37
 38          echo "### Build details" >> "$GITHUB_STEP_SUMMARY"
 39          echo "```" >> "$GITHUB_STEP_SUMMARY"
 40          echo "$ file ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY"
 41          file ./result/bin/git-bug >> "$GITHUB_STEP_SUMMARY"
 42          echo
 43          echo "$ go version -m ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY"
 44          nix-shell --run 'go version -m ./result/bin/git-bug' >> "$GITHUB_STEP_SUMMARY"
 45
 46  # We run this job in order to test the release derivation, to ensure that any
 47  # changes to the derivation configuration does not affect the release build
 48  release-binaries:
 49    strategy:
 50      matrix:
 51        platform: [ubuntu-latest, macos-latest]
 52    runs-on: ${{ matrix.platform }}
 53    steps:
 54      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
 55        with:
 56          persist-credentials: false
 57
 58      - uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1
 59
 60      - name: build with nix-build
 61        run: |
 62          nix-build -A release --argstr version "${{ github.sha }}"
 63
 64          echo "### Build details" >> "$GITHUB_STEP_SUMMARY"
 65          echo "```" >> "$GITHUB_STEP_SUMMARY"
 66          echo "$ file ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY"
 67          file ./result/bin/git-bug >> "$GITHUB_STEP_SUMMARY"
 68          echo "" >> "$GITHUB_SUMARY"
 69          echo "$ ls -sh ./result/bin/git-bug" >> "$GITHUB_STEP_SUMMARY"
 70          ls -sh ./result/bin/git-bug >> "$GITHUB_STEP_SUMMARY"
 71          echo "" >> "$GITHUB_SUMMARY"
 72          echo "$ nix-shell --run 'go version -m ./result/bin/git-bug'" >> "$GITHUB_STEP_SUMMARY"
 73          nix-shell --run 'go version -m ./result/bin/git-bug' >> "$GITHUB_STEP_SUMMARY"
 74
 75  web-ui:
 76    runs-on: ubuntu-latest
 77    strategy:
 78      matrix:
 79        node-version: [16.x, 18.x, 20.x]
 80    defaults:
 81      run:
 82        working-directory: webui
 83    steps:
 84      - name: Setup Node.js ${{ matrix.node-version }}
 85        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
 86        with:
 87          node-version: ${{ matrix.node-version }}
 88
 89      - name: Check out code
 90        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
 91        with:
 92          persist-credentials: false
 93
 94      - uses: DeterminateSystems/nix-installer-action@21a544727d0c62386e78b4befe52d19ad12692e3 # v17
 95
 96      - uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1.2.1
 97
 98      - name: Install
 99        run: make install
100
101      - name: Build
102        run: make build
103
104      - name: Test
105        run: make test
106