Bump docker/setup-buildx-action from 2 to 3 (#28) #87
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: "GnuPG" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v0.** | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: gnupg-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
macos_gnupg: | |
runs-on: ${{ matrix.runner[0] }} | |
strategy: | |
# List of: | |
# 1. Runners | |
# 2. Target architectures | |
matrix: | |
runner: [ | |
["macos-latest", "x86_64"], | |
[["self-hosted", "macOS", "ARM64"], "aarch64"] | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
if [[ ${{ matrix.runner[1] }} == "aarch64" ]] ; then | |
export PATH=/Users/spack-bootstrap-runner/homebrew/bin:/Users/spack-bootstrap-runner/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin | |
fi | |
brew install gawk perl | |
git clone https://github.com/spack/spack.git spack-src | |
cd spack-src && git checkout -b docker-reference 08da9a854a53542e1f71d30ed8d14d6b7d18119f && cd .. | |
# Disables internationalization to avoid linking to | |
# libintl on MacOS, since that will make the binary | |
# non portable | |
cd spack-src && git apply ../gnupg/patches/gnupg_macos.patch && cd .. | |
. spack-src/share/spack/setup-env.sh | |
spack external find --not-buildable gawk perl | |
spack config add "config:concretizer:original" | |
spack config add "config:install_tree:padded_length:256" | |
mkdir -p binary-mirror | |
# Inject flags to have compatibility with MacOSX version 10.13 or higher | |
spack install gnupg cflags="-mmacosx-version-min=10.13" target=${{ matrix.runner[1] }} | |
spack buildcache push --unsigned --force $PWD/binary-mirror gnupg | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: gnupg_binary_mirror | |
path: binary-mirror | |
manylinux2014: | |
runs-on: ["self-hosted", "Linux"] | |
outputs: | |
spack_manylinux_tag: ${{ fromJSON(steps.docker_meta.outputs.json).tags[0] }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Setup tags to be used for docker images | |
- uses: docker/metadata-action@v4 | |
id: docker_meta | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/gnupg_manylinux2014 | |
# Login to Github Packages | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/setup-qemu-action@v2 | |
id: qemu | |
with: | |
platforms: linux/ppc64le,linux/arm64,linux/amd64 | |
- uses: docker/setup-buildx-action@v3 | |
# Build and eventually push to registry | |
- uses: docker/build-push-action@v5 | |
with: | |
file: ./gnupg/Dockerfile.manylinux2014 | |
platforms: linux/arm64,linux/ppc64le,linux/amd64 | |
pull: ${{ github.event_name == 'pull_request' }} | |
cache-from: | | |
ghcr.io/${{ github.repository_owner }}/gnupg_manylinux2014:main | |
${{ steps.docker_meta.outputs.tags }} | |
cache-to: type=inline | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
upload-manylinux2014: | |
runs-on: ubuntu-latest | |
needs: [ manylinux2014 ] | |
env: | |
SPACK_MANYLINUX2014_TAG: ${{ needs.manylinux2014.outputs.spack_manylinux_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
. ./gnupg/scripts/copy_mirror_manylinux2014.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: gnupg_binary_mirror | |
path: | | |
binary-mirror | |
gnupg_json: | |
runs-on: ubuntu-latest | |
needs: [ upload-manylinux2014, macos_gnupg ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: gnupg_binary_mirror | |
- run: | | |
git clone https://github.com/spack/spack.git spack-src | |
. spack-src/share/spack/setup-env.sh | |
spack python gnupg/scripts/gnupg_json.py | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: gnupg_manifest | |
path: | | |
gnupg.json |