containers: update NodeJS to 20.11.0 #219
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: Build container images | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build, test and push | |
runs-on: ubuntu-latest | |
services: | |
# Use a local registry to store images while they are tested | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
env: | |
builder_img: ghcr.io/${{ github.repository_owner }}/nimskull-builder | |
builder_test_tag: localhost:5000/nimskull-builder:test | |
tester_img: ghcr.io/${{ github.repository_owner }}/nimskull-tester | |
tester_test_tag: localhost:5000/nimskull-tester:test | |
# List of Docker platforms to build images for | |
targets: linux/amd64,linux/arm64,linux/arm/v7 | |
# Nimskull commit to test the containers with | |
nimskull_test_commit: c46848397e1f7b9d38c1bf5b18a0de4b5b898137 | |
# Grant write permissions to packages | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Generate metadata for the builder image | |
id: builder_meta | |
uses: docker/metadata-action@v4.3.0 | |
with: | |
images: | | |
${{ env.builder_img }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
type=ref,event=pr | |
- name: Generate metadata for the tester image | |
id: tester_meta | |
uses: docker/metadata-action@v4.3.0 | |
with: | |
images: | | |
${{ env.tester_img }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
type=ref,event=pr | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2.1.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2.5.0 | |
with: | |
# This is done so that builders can access the local registry | |
driver-opts: network=host | |
- name: Build and load tester image | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: ./containers | |
platforms: ${{ env.targets }} | |
push: true | |
tags: ${{ env.tester_test_tag }} | |
target: tester | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build and load builder image | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: ./containers | |
platforms: ${{ env.targets }} | |
push: true | |
tags: ${{ env.builder_test_tag }} | |
target: builder | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Checkout nimskull | |
uses: actions/checkout@v3 | |
with: | |
repository: nim-works/nimskull | |
ref: ${{ env.nimskull_test_commit }} | |
path: nimskull | |
- name: Run build test | |
run: | | |
docker run -v "$PWD/nimskull:/src" -w /src --rm \ | |
${{ env.builder_test_tag }} \ | |
./koch.py unixrelease | |
docker run -v "$PWD/nimskull:/src" -w /src --rm \ | |
${{ env.builder_test_tag }} \ | |
./koch.py docs | |
- name: Run compiler tests | |
run: | | |
docker run -v "$PWD/nimskull:/src" -w /src --rm \ | |
${{ env.tester_test_tag }} \ | |
./koch.py tests | |
- name: Login to Github registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- name: Push tester image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: ./containers | |
platforms: ${{ env.targets }} | |
push: true | |
tags: ${{ steps.tester_meta.outputs.tags }} | |
labels: ${{ steps.tester_meta.outputs.labels }} | |
target: tester | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push builder image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: ./containers | |
platforms: ${{ env.targets }} | |
push: true | |
tags: ${{ steps.builder_meta.outputs.tags }} | |
labels: ${{ steps.builder_meta.outputs.labels }} | |
target: builder | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |