Fix build #116
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dev | |
on: [push] | |
defaults: | |
run: | |
shell: bash | |
env: | |
IMAGE_REPOSITORY: ${{ vars.IMAGE_REPOSITORY }} | |
NIX_CACHE_BUCKET_NAME: ${{ vars.NIX_CACHE_BUCKET_NAME }} | |
NIX_CACHE_BUCKET_REGION: ${{ vars.NIX_CACHE_BUCKET_REGION }} | |
NIX_CACHE_SIGNING_PRIVATE_KEY: ${{ secrets.NIX_CACHE_SIGNING_PRIVATE_KEY }} | |
AWS_REGION: ${{ vars.AWS_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.NIX_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.NIX_AWS_SECRET_ACCESS_KEY }} | |
jobs: | |
build-runner: | |
name: Build runner | |
runs-on: [self-hosted, nix, general, "${{ matrix.arch.runner }}", "${{ matrix.arch.size }}"] | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- nix: x86_64-linux | |
runner: amd64-linux | |
image: amd64 | |
size: medium | |
- nix: aarch64-linux | |
runner: arm64-linux | |
image: arm64 | |
size: medium | |
- nix: aarch64-darwin | |
runner: arm64-darwin | |
size: small | |
outputs: | |
version: ${{ steps.determine-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: determine-version | |
name: Determine current version | |
run: |- | |
CURRENT_VERSION=$(./release.sh get_release_version) || exit $? | |
echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | |
- name: Build intellij-scala-runners | |
run: |- | |
nix build -L --no-link '.#packages.${{ matrix.arch.nix }}.intellij-scala-runners' | |
- name: Build runner | |
run: |- | |
nix build -L --no-link '.#packages.${{ matrix.arch.nix }}.runner-jre' | |
- name: Build server | |
run: |- | |
nix build -L '.#packages.${{ matrix.arch.nix }}.toothpick' | |
- name: Cache packages | |
run: | | |
pkgs=(runner-jre intellij-scala-runners toothpick deps) | |
for pkg in "${pkgs[@]}"; do | |
nix_output=".#packages.${{ matrix.arch.nix }}.${pkg}" | |
nix store sign "${nix_output}" -v -r -k <(echo -n "${NIX_CACHE_SIGNING_PRIVATE_KEY}") | |
nix copy -v --to "s3://${NIX_CACHE_BUCKET_NAME}/cache?region=${NIX_CACHE_BUCKET_REGION}&compression=zstd¶llel-compression=true" "${nix_output}" | |
done | |
- name: Build container images | |
if: ${{ matrix.arch.image }} | |
run: |- | |
nix build -L '.#packages.${{ matrix.arch.nix }}.server-image' | |
- name: Push | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
IMAGE_ARCH: ${{ matrix.arch.image }} | |
RELEASE_VERSION: ${{ steps.determine-version.outputs.version }} | |
if: ${{ matrix.arch.image }} | |
shell: nix develop -v -c bash {0} | |
run: |- | |
IMAGE_TAG="${RELEASE_VERSION}-${IMAGE_ARCH}" | |
IMAGE_TARGET="${IMAGE_REPOSITORY}"/toothpick-server:"${IMAGE_TAG}" | |
skopeo --insecure-policy copy \ | |
nix:./result \ | |
docker://"${IMAGE_TARGET}" | |
push-manifest: | |
name: Push multi-arch manifest | |
runs-on: [self-hosted, nix, general, arm64-linux, small] | |
timeout-minutes: 5 | |
needs: [build-runner] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Push | |
shell: nix develop -v -c bash {0} | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
RELEASE_VERSION: ${{ needs.build-runner.outputs.version }} | |
run: |- | |
manifest-tool push from-args \ | |
--platforms linux/amd64,linux/arm64 \ | |
--template "${IMAGE_REPOSITORY}/toothpick-server:${RELEASE_VERSION}-ARCH" \ | |
--target "${IMAGE_REPOSITORY}/toothpick-server:${RELEASE_VERSION}" | |
build-helm-chart: | |
name: Build Helm chart | |
runs-on: [self-hosted, nix, general, arm64-linux, small] | |
timeout-minutes: 5 | |
needs: [build-runner] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and push Helm Chart | |
shell: nix develop -v -c bash {0} | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
RELEASE_VERSION: ${{ needs.build-runner.outputs.version }} | |
run: |- | |
export HELM_REGISTRY_CONFIG=/home/runner/.docker/config.json | |
./release.sh push_helm_chart "${RELEASE_VERSION}" "${RELEASE_VERSION}" "oci://${IMAGE_REPOSITORY}/charts" |