diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 9c11c5f46..52935e6d6 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -18,7 +18,6 @@ runs: - uses: ./.github/actions/setup_environment - run: ~/go/bin/promu crossbuild -v --parallelism ${{ inputs.parallelism }} --parallelism-thread ${{ inputs.thread }} ${{ inputs.promu_opts }} shell: bash - - uses: actions/upload-artifact@v3 + - uses: ./.github/actions/save_artefacts with: - path: | - .build + directory: .build diff --git a/.github/actions/publish_images/action.yml b/.github/actions/publish_images/action.yml index e3a8693fb..fe5c481b9 100644 --- a/.github/actions/publish_images/action.yml +++ b/.github/actions/publish_images/action.yml @@ -29,14 +29,16 @@ runs: steps: - name: Download all workflow run artifacts uses: actions/download-artifact@v3 + with: + name: artifact - uses: ./.github/actions/setup_environment - - if: "inputs.dockerfile_path != ''" + - if: inputs.dockerfile_path != '' run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile shell: bash - - if: "inputs.container_image_name != ''" + - if: inputs.container_image_name != '' run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile shell: bash - - if: "inputs.dockerbuild_context != ''" + - if: inputs.dockerbuild_context != '' run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile shell: bash - run: | diff --git a/.github/actions/publish_main/action.yml b/.github/actions/publish_main/action.yml index 08d57d9a6..b8d523e3c 100644 --- a/.github/actions/publish_main/action.yml +++ b/.github/actions/publish_main/action.yml @@ -24,6 +24,8 @@ runs: using: composite steps: - uses: ./.github/actions/setup_environment + with: + enable_docker_multibuild: true - uses: ./.github/actions/publish_images if: inputs.docker_hub_organization != '' && inputs.docker_hub_login != '' with: diff --git a/.github/actions/publish_release/action.yml b/.github/actions/publish_release/action.yml index 56f68bda6..571265eda 100644 --- a/.github/actions/publish_release/action.yml +++ b/.github/actions/publish_release/action.yml @@ -24,6 +24,8 @@ runs: using: composite steps: - uses: ./.github/actions/setup_environment + with: + enable_docker_multibuild: true - run: promu crossbuild tarballs shell: bash - run: promu checksum .tarballs diff --git a/.github/actions/publish_release_image/action.yml b/.github/actions/publish_release_image/action.yml index c40664692..0a165e9e4 100644 --- a/.github/actions/publish_release_image/action.yml +++ b/.github/actions/publish_release_image/action.yml @@ -29,15 +29,17 @@ runs: steps: - name: Download all workflow run artifacts uses: actions/download-artifact@v3 + with: + name: artifact - uses: ./.github/actions/setup_environment - - if: "inputs.dockerfile_path != ''" - run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" }} /tmp/tmp-profile + - if: inputs.dockerfile_path != '' + run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile shell: bash - - if: "inputs.container_image_name != ''" - run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" }} /tmp/tmp-profile + - if: inputs.container_image_name != '' + run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile shell: bash - - if: "inputs.dockerbuild_context != ''" - run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" }} /tmp/tmp-profile + - if: inputs.dockerbuild_context != '' + run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile shell: bash - run: | current_tag=${GITHUB_REF#refs/*/} diff --git a/.github/actions/save_artefacts/action.yml b/.github/actions/save_artefacts/action.yml new file mode 100644 index 000000000..bb37dcf7e --- /dev/null +++ b/.github/actions/save_artefacts/action.yml @@ -0,0 +1,18 @@ +# To preserve the directory structure, save an additional empty file at +# the root of the working directory. GitHub action uses the least common +# ancestor of all the search paths as the root directory for artefacts. +name: Save artefacts +inputs: + directory: + type: string + description: Path of the directory to save +runs: + using: composite + steps: + - run: touch .keep + shell: bash + - uses: actions/upload-artifact@v3 + with: + path: | + ${{ inputs.directory }} + .keep diff --git a/.github/actions/setup_environment/action.yml b/.github/actions/setup_environment/action.yml index f1258c8be..8c1d4d58e 100644 --- a/.github/actions/setup_environment/action.yml +++ b/.github/actions/setup_environment/action.yml @@ -7,12 +7,16 @@ inputs: enable_npm: type: boolean description: Whether to enable npm specific features, such as caching. - default: true + default: false + enable_docker_multibuild: + type: boolean + description: Whether to enable multibuild docker + default: false runs: using: composite steps: - uses: actions/cache@v3 - if: ${{ inputs.enable_go }} + if: inputs.enable_go == 'true' with: path: | ~/.cache/go-build @@ -21,7 +25,7 @@ runs: restore-keys: | ${{ runner.os }}-go- - uses: actions/cache@v3 - if: ${{ inputs.enable_npm }} + if: inputs.enable_npm == 'true' with: path: | ~/.npm @@ -30,4 +34,10 @@ runs: ${{ runner.os }}-npm- - run: make promu shell: bash - if: ${{ inputs.enable_go }} + if: inputs.enable_go == 'true' + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + if: inputs.enable_docker_multibuild == 'true' + - name: Set up buildx + uses: docker/setup-buildx-action@v1 + if: inputs.enable_docker_multibuild == 'true' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48b47670b..34934e1f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,10 +37,9 @@ jobs: - run: make assets-tarball - run: make ui-lint - run: make ui-test - - uses: actions/upload-artifact@v3 + - uses: ./.github/actions/save_artefacts with: - path: | - .tarballs + directory: .tarballs test_windows: runs-on: windows-latest diff --git a/Makefile.common b/Makefile.common index ada0008a0..c9bc1ce37 100644 --- a/Makefile.common +++ b/Makefile.common @@ -205,7 +205,7 @@ common-tarball: promu .PHONY: common-docker $(BUILD_DOCKER_ARCHS) common-docker: $(BUILD_DOCKER_ARCHS) $(BUILD_DOCKER_ARCHS): common-docker-%: - docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \ + docker buildx build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \ -f $(DOCKERFILE_PATH) \ --build-arg ARCH="$*" \ --build-arg OS="linux" \