Skip to content

Arm64 - take2

Arm64 - take2 #263

Workflow file for this run

name: Test PR
on:
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: get golang version 1
run: |
export VERSION=$(cat .golang_version | awk -F',' '{print $1}' | sed 's/go1/go-1/')
DOTS=$(echo -n $VERSION | awk -F"." '{print NF-1}')
if [ "$DOTS" == "1" ]; then
echo "value=$VERSION.0" >> $GITHUB_OUTPUT
echo "wildcard=$VERSION.x" >> $GITHUB_OUTPUT
else
echo "value=$VERSION" >> $GITHUB_OUTPUT
echo "wildcard=$(echo -n $VERSION | sed 's/\.[^.]*$/.x/')" >> $GITHUB_OUTPUT
fi
id: golang_version_1
- name: get golang version 2
run: |
export VERSION=$(cat .golang_version | awk -F',' '{print $2}' | sed 's/go1/go-1/')
DOTS=$(echo -n $VERSION | awk -F"." '{print NF-1}')
if [ "$DOTS" == "1" ]; then
echo "value=$VERSION.0" >> $GITHUB_OUTPUT
echo "wildcard=$VERSION.x" >> $GITHUB_OUTPUT
else
echo "value=$VERSION" >> $GITHUB_OUTPUT
echo "wildcard=$(echo -n $VERSION | sed 's/\.[^.]*$/.x/')" >> $GITHUB_OUTPUT
fi
id: golang_version_2
- name: Setup BATS
uses: mig4/setup-bats@v1
with:
bats-version: 1.2.1
- name: cache toolchain
id: cache-toolchain
uses: actions/cache@v3
env:
cache-name: cache-toolchain
with:
path: /tmp/toolchain.tar
key: ${{ runner.os }}-toolchain-${{ hashFiles('docker/toolchain/**') }}
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
name: build toolchain
run: |
echo "Build toolchain docker"
docker buildx build --file docker/toolchain/Dockerfile \
--tag toolchain --load docker/toolchain/
docker save -o /tmp/toolchain.tar toolchain
- name: build images and tests
run: |
echo "Load toolchain docker"
docker load -i /tmp/toolchain.tar
echo "Bootstrap go ${{ steps.golang_version_1.outputs.value }}"
docker buildx build --file docker/${{ steps.golang_version_1.outputs.value }}/Dockerfile \
--tag ${{ steps.golang_version_1.outputs.value }}-base --load docker/${{ steps.golang_version_1.outputs.value }}/
echo "Build xgo for go ${{ steps.golang_version_1.outputs.value }} "
docker buildx build --file docker/build/Dockerfile \
--tag techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }} \
--tag techknowlogick/xgo:${{ steps.golang_version_1.outputs.wildcard }} \
--tag techknowlogick/xgo:latest \
--build-arg VERSION=${{ steps.golang_version_1.outputs.value }} \
--load .
echo "Bootstrap go ${{ steps.golang_version_2.outputs.value }}"
docker buildx build --file docker/${{ steps.golang_version_2.outputs.value }}/Dockerfile \
--tag ${{ steps.golang_version_2.outputs.value }}-base --load docker/${{ steps.golang_version_2.outputs.value }}/
echo "Build xgo for go ${{ steps.golang_version_2.outputs.value }}"
docker buildx build --file docker/build/Dockerfile \
--tag techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }} \
--tag techknowlogick/xgo:${{ steps.golang_version_2.outputs.wildcard }} \
--build-arg VERSION=${{ steps.golang_version_2.outputs.value }} \
--load .
mkdir -p .xgo-cache
mkdir -p ~/go/src
echo "Run tests on latest go ${{ steps.golang_version_1.outputs.value }}"
env IMAGEID="techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }}" bats xgo.bats