Test build of mnc using source-binary
This commit is contained in:
parent
7474dbd627
commit
5b98d04c9e
61
.github/workflows/test.yaml
vendored
61
.github/workflows/test.yaml
vendored
|
@ -6,54 +6,41 @@ on:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checks:
|
build-linux:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
env:
|
|
||||||
FLAKEHUB_API_ENDPOINT: api.flakehub.com
|
|
||||||
FLAKEHUB_WEB_ENDPOINT: https://flakehub.com
|
|
||||||
NIX_CONF: /etc/nix/nix.conf
|
|
||||||
FLAKEHUB_CACHE: "https://cache.flakehub.com"
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- name: Setup
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
id: setup
|
|
||||||
run: |
|
|
||||||
TMP=$(mktemp -d)
|
|
||||||
NETRC="${TMP}/netrc"
|
|
||||||
|
|
||||||
sudo chmod a+rw "${{ env.NIX_CONF }}"
|
- name: Build package
|
||||||
|
run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz"
|
||||||
|
|
||||||
REQUEST_TOKEN="${ACTIONS_ID_TOKEN_REQUEST_TOKEN}"
|
- name: Cache magix-nix-cache closure
|
||||||
ROOT_URL="${ACTIONS_ID_TOKEN_REQUEST_URL}"
|
uses: actions/cache/save@v4
|
||||||
JWT_ID_TOKEN=$(curl \
|
with:
|
||||||
--header "authorization: bearer ${REQUEST_TOKEN}" \
|
path: magic-nix-cache.closure.xz
|
||||||
--header "accept: application/json;api-version=2.0" \
|
key: magic-nix-cache-${{ github.sha }}
|
||||||
--header "content-type: application/json" \
|
|
||||||
--header "user-agent: magic-nix-cache" \
|
|
||||||
"${ROOT_URL}&audience=${{ env.FLAKEHUB_API_ENDPOINT }}")
|
|
||||||
|
|
||||||
echo "token=${JWT_ID_TOKEN}" >> $GITHUB_OUTPUT
|
test-linux:
|
||||||
echo "netrc=${NETRC}" >> $GITHUB_OUTPUT
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- name: Restore magix-nix-cache closure
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: magic-nix-cache.closure.xz
|
||||||
|
key: magic-nix-cache-${{ github.sha }}
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
- name: Set up netrc file
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
env:
|
with:
|
||||||
NETRC: ${{ steps.setup.outputs.netrc }}
|
source-binary: "magic-nix-cache.closure.xz"
|
||||||
TOKEN: ${{ steps.setup.outputs.token }}
|
|
||||||
run: |
|
|
||||||
echo "machine ${{ env.FLAKEHUB_WEB_ENDPOINT }} login flakehub password ${{ env.TOKEN }}" > "${{ env.NETRC }}"
|
|
||||||
echo "machine ${{ env.FLAKEHUB_API_ENDPOINT }} login flakehub password ${{ env.TOKEN }}" >> "${{ env.NETRC }}"
|
|
||||||
echo "extra-substituters = ${{ env.FLAKEHUB_CACHE }}/?trusted=1" >> "${{ env.NIX_CONF }}"
|
|
||||||
echo "netrc-file = ${{ env.NETRC }}" >> "${{ env.NIX_CONF }}"
|
|
||||||
|
|
||||||
echo "netrc file:"
|
|
||||||
cat "${{ env.NETRC }}"
|
|
||||||
|
|
||||||
echo "Nix config:"
|
|
||||||
cat "${{ env.NIX_CONF }}"
|
|
||||||
|
|
Loading…
Reference in a new issue