mirror of
https://github.com/zhaofengli/attic.git
synced 2025-03-15 21:08:23 +00:00
.github/build: Add job to build main packages
This commit is contained in:
parent
d20160548e
commit
0acbde64ef
1 changed files with 59 additions and 0 deletions
59
.github/workflows/build.yml
vendored
59
.github/workflows/build.yml
vendored
|
@ -6,6 +6,64 @@ env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ghcr.io/${{ github.repository }}
|
IMAGE_NAME: ghcr.io/${{ github.repository }}
|
||||||
jobs:
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.1.7
|
||||||
|
|
||||||
|
- name: Install current Bash on macOS
|
||||||
|
if: runner.os == 'macOS'
|
||||||
|
run: |
|
||||||
|
command -v brew && brew install bash || true
|
||||||
|
|
||||||
|
- uses: DeterminateSystems/nix-installer-action@v14
|
||||||
|
continue-on-error: true # Self-hosted runners already have Nix installed
|
||||||
|
|
||||||
|
- name: Install Attic
|
||||||
|
run: |
|
||||||
|
if ! command -v attic &> /dev/null; then
|
||||||
|
./.github/install-attic-ci.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Configure Attic
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
: "${ATTIC_SERVER:=https://staging.attic.rs/}"
|
||||||
|
: "${ATTIC_CACHE:=attic-ci}"
|
||||||
|
echo ATTIC_CACHE=$ATTIC_CACHE >>$GITHUB_ENV
|
||||||
|
export PATH=$HOME/.nix-profile/bin:$PATH # FIXME
|
||||||
|
attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN"
|
||||||
|
attic use "$ATTIC_CACHE"
|
||||||
|
env:
|
||||||
|
ATTIC_SERVER: ${{ secrets.ATTIC_SERVER }}
|
||||||
|
ATTIC_CACHE: ${{ secrets.ATTIC_CACHE }}
|
||||||
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||||
|
|
||||||
|
- name: Cache dev shell
|
||||||
|
run: |
|
||||||
|
.ci/cache-shell.sh
|
||||||
|
system=$(nix-instantiate --eval -E 'builtins.currentSystem')
|
||||||
|
echo system=$system >>$GITHUB_ENV
|
||||||
|
|
||||||
|
# TODO: Abstract all of this out, and use `attic push --stdin` (requires #232)
|
||||||
|
- name: Build packages
|
||||||
|
run: |
|
||||||
|
export PATH=$HOME/.nix-profile/bin:$PATH # FIXME
|
||||||
|
nix build --no-link --print-out-paths -L \
|
||||||
|
.#attic \
|
||||||
|
.#attic-client \
|
||||||
|
.#attic-server \
|
||||||
|
| if [ -n "$ATTIC_CACHE" ]; then
|
||||||
|
xargs attic push "ci:$ATTIC_CACHE"
|
||||||
|
else
|
||||||
|
cat
|
||||||
|
fi
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -78,6 +136,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
needs:
|
needs:
|
||||||
|
- build
|
||||||
- tests
|
- tests
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
Loading…
Add table
Reference in a new issue