Merge pull request #203 from Neves-P/fix/dev.eessi.io-prefix #475
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, test, and release client packages | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
build-linux-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 | |
- name: Get the version number for the packages | |
id: get_version | |
# If this is a tag, use the tag name (e.g. v1.2.3) without v as version number. | |
# Otherwise, just use 0.0. | |
run: | | |
VERSION=0.0 | |
REF_NAME=${{ github.ref }} | |
[[ $REF_NAME == refs/tags/v* ]] && VERSION=${REF_NAME/refs\/tags\/v/} | |
echo ::set-output name=version::${VERSION} | |
- name: Prepare package source by running the corresponding playbook locally | |
run: | | |
echo "localhost ansible_connection=local" > inventory/hosts | |
ansible-playbook ./prepare-client-packages.yml | |
- name: Include the old eessi-hpc.org config as well for now | |
run: | | |
wget https://github.com/EESSI/filesystem-layer/releases/download/v0.4.0/cvmfs-config-eessi-0.4.0.tar | |
tar -C ./package -xf cvmfs-config-eessi-0.4.0.tar | |
rm cvmfs-config-eessi-0.4.0.tar | |
# We probably should loop over the set {rpm,deb,osxpkg} to create packages, but | |
# it will make debugging more annoying. | |
- name: Build RPM package | |
uses: bpicode/github-action-fpm@7502b06a5a58390398d4002bd284f8cb3caae6eb | |
with: | |
fpm_args: "etc" | |
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t rpm -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'" | |
- name: Build Deb package | |
uses: bpicode/github-action-fpm@7502b06a5a58390398d4002bd284f8cb3caae6eb | |
with: | |
fpm_args: "etc" | |
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t deb -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'" | |
- name: Build tar package | |
uses: bpicode/github-action-fpm@7502b06a5a58390398d4002bd284f8cb3caae6eb | |
with: | |
fpm_args: "etc" | |
fpm_opts: "--debug -n cvmfs-config-eessi-${{ steps.get_version.outputs.version }} -t tar -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'" | |
- name: Upload packages as build artifacts | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 | |
with: | |
name: linux_packages | |
path: cvmfs-config-eessi* | |
# build-macos-package: | |
# runs-on: macos-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# | |
# - name: Get the version number for the packages | |
# id: get_version | |
# # If this is a tag, use the tag name (e.g. v1.2.3) without v as version number. | |
# # Otherwise, just use 0.0. | |
# run: | | |
# VERSION=0.0 | |
# REF_NAME=${{ github.ref }} | |
# [[ $REF_NAME == refs/tags/v* ]] && VERSION=${REF_NAME/refs\/tags\/v/} | |
# echo ::set-output name=version::${VERSION} | |
# | |
# # The next step uses a custom Ansible inventory, and due to that it cannot find | |
# # the group_vars folder inside the inventory folder. This symlink fixes that. | |
# - name: Make symlink to group_vars | |
# run: ln -s inventory/group_vars | |
# | |
# - name: Install Ansible | |
# run: pip3 install ansible | |
# | |
# - name: Prepare package source | |
# run: ansible-playbook --connection=local ./prepare-client-packages.yml | |
# | |
# - name: Install dependencies | |
# run: brew install gnu-tar | |
# | |
# - name: Install fpm | |
# run: gem install --no-document fpm | |
# | |
# - name: Build package | |
# run: "fpm --debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t osxpkg -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.' etc" | |
# | |
# - name: Find filename of generated package | |
# id: find_filename | |
# shell: bash | |
# run: | | |
# pkgfile="$(ls -1 cvmfs-config-eessi*.pkg)" | |
# echo ::set-output name=pkgfile::${pkgfile} | |
# | |
# - name: Upload macOS package as artifact | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: macos_package | |
# path: ${{ steps.find_filename.outputs.pkgfile }} | |
test-deb-package: | |
needs: build-linux-packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install CVMFS dependencies | |
run: sudo apt-get install lsb-release | |
- name: Download and install CVMFS client | |
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb && sudo dpkg -i cvmfs-release-latest_all.deb | |
- name: Download and install cvmfs-config-none package | |
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-config/cvmfs-config-none_1.1-0_all.deb && sudo dpkg -i cvmfs-config-none_1.1-0_all.deb | |
- name: Install CVMFS client | |
run: sudo apt-get update && sudo apt-get install cvmfs | |
- name: Download cvmfs-config-eessi package | |
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 | |
with: | |
name: linux_packages | |
- name: Find filename of package | |
id: find_filename | |
shell: bash | |
run: | | |
debfile="$(find . -name cvmfs-config-eessi*.deb)" | |
echo ::set-output name=debfile::${debfile} | |
- name: Install package | |
run: sudo dpkg -i ./${{ steps.find_filename.outputs.debfile }} | |
- name: Add local CVMFS configuration (/etc/cvmfs/default.local) | |
run: echo "CVMFS_CLIENT_PROFILE=single" | sudo tee /etc/cvmfs/default.local | |
- name: Mount the repositories | |
run: sudo cvmfs_config setup | |
- name: Test repository access | |
run: ls /cvmfs/software.eessi.io/ | |
test-rpm-package: | |
needs: build-linux-packages | |
runs-on: ubuntu-latest | |
container: | |
image: rockylinux:8 | |
options: --device /dev/fuse --privileged | |
steps: | |
- name: Download and install CVMFS client | |
run: | | |
dnf install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm | |
dnf install -y 'dnf-command(config-manager)' | |
dnf config-manager --enable cernvm-config | |
dnf install -y cvmfs cvmfs-config-none | |
- name: Download cvmfs-config-eessi package | |
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 | |
with: | |
name: linux_packages | |
- name: Find filename of package | |
id: find_filename | |
shell: bash | |
run: | | |
rpmfile="$(find . -name cvmfs-config-eessi*.rpm)" | |
echo ::set-output name=rpmfile::${rpmfile} | |
- name: Install package | |
run: rpm -i ./${{ steps.find_filename.outputs.rpmfile }} | |
- name: Add local CVMFS configuration (/etc/cvmfs/default.local) | |
run: echo "CVMFS_CLIENT_PROFILE=single" | tee /etc/cvmfs/default.local | |
- name: Mount the repositories | |
#run: cvmfs_config setup | |
run: mkdir -p /cvmfs/software.eessi.io && mount -t cvmfs software.eessi.io /cvmfs/software.eessi.io | |
- name: Test repository access | |
run: ls /cvmfs/software.eessi.io/ | |
test-tar-package: | |
needs: build-linux-packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install CVMFS dependencies | |
run: sudo apt-get install lsb-release | |
- name: Download and install CVMFS client | |
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb && sudo dpkg -i cvmfs-release-latest_all.deb | |
- name: Download and install cvmfs-config-none package | |
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-config/cvmfs-config-none_1.1-0_all.deb && sudo dpkg -i cvmfs-config-none_1.1-0_all.deb | |
- name: Install CVMFS client | |
run: sudo apt-get update && sudo apt-get install cvmfs | |
- name: Download cvmfs-config-eessi package | |
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 | |
with: | |
name: linux_packages | |
- name: Find filename of package | |
id: find_filename | |
shell: bash | |
run: | | |
tarfile="$(find . -name cvmfs-config-eessi*.tar)" | |
echo ::set-output name=tarfile::${tarfile} | |
- name: Install package | |
run: sudo tar -C / -xf ./${{ steps.find_filename.outputs.tarfile }} | |
- name: Add local CVMFS configuration (/etc/cvmfs/default.local) | |
run: echo "CVMFS_CLIENT_PROFILE=single" | sudo tee /etc/cvmfs/default.local | |
- name: Mount the repositories | |
run: sudo cvmfs_config setup | |
- name: Test repository access | |
run: ls /cvmfs/software.eessi.io/ | |
# test-macos-package: | |
# needs: build-macos-package | |
# runs-on: macos-10.15 | |
# steps: | |
# - name: Install OSXFUSE | |
# run: brew install --cask macfuse | |
# | |
# - name: Download and install CVMFS client | |
# run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-latest.pkg && sudo installer -target / -pkg cvmfs-latest.pkg | |
# | |
# - name: Download cvmfs-config-eessi package | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: macos_package | |
# | |
# - name: Find filename of package | |
# id: find_filename | |
# shell: bash | |
# run: | | |
# pkgfile="$(find . -name cvmfs-config-eessi*.pkg)" | |
# echo ::set-output name=pkgfile::${pkgfile} | |
# | |
# - name: Install package | |
# run: sudo installer -target / -pkg ./${{ steps.find_filename.outputs.pkgfile }} | |
# | |
# - name: Add local CVMFS configuration (/etc/cvmfs/default.local) | |
# run: echo "CVMFS_CLIENT_PROFILE=single" | sudo tee /etc/cvmfs/default.local | |
# | |
# - name: Mount the repositories | |
# run: sudo mkdir -p /Users/Shared/cvmfs/software.eessi.io && sudo mount -t cvmfs software.eessi.io /Users/Shared/cvmfs/software.eessi.io | |
# | |
# - name: Test repository access | |
# run: ls /Users/Shared/cvmfs/software.eessi.io/ | |
release: | |
#needs: [build-linux-packages, build-macos-package, test-deb-package, test-rpm-package, test-macos-package, test-tar-package] | |
needs: [build-linux-packages, test-deb-package, test-rpm-package, test-tar-package] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 | |
- name: Find release version in tag | |
id: find_version | |
run: | | |
echo ::set-output name=version::${GITHUB_REF#refs/tags/} | |
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 | |
with: | |
path: ./build_artifacts | |
- name: Find filenames of downloaded packages | |
id: find_filenames | |
shell: bash | |
run: | | |
ls -1 -R . | |
echo ::set-output name=package_filenames::$(find ./build_artifacts -name cvmfs-config-eessi*) | |
- uses: meeDamian/github-release@7ae19492500104f636b3fee4d8103af0fed36c8e # v2.0.3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.find_version.outputs.version }} | |
name: Filesystem Layer ${{ steps.find_version.outputs.version }} | |
body: > | |
Filesystem Layer release ${{ steps.find_version.outputs.version }} | |
files: ${{ steps.find_filenames.outputs.package_filenames }} | |
gzip: false | |
release-latest: | |
needs: [release] # only run when the previous step (the actual release) was successful | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 | |
- uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 | |
with: | |
path: ./build_artifacts | |
- name: Find release version in tag | |
id: find_version | |
run: | | |
echo ::set-output name=version::${GITHUB_REF#refs/tags/} | |
- name: Find filenames of downloaded packages and rename them to latest | |
id: find_filenames | |
shell: bash | |
run: | | |
sudo apt-get install rename | |
rename "s/([0-9]+.[0-9]+.[0-9]+)(-[0-9]+)?/latest/g" $(find ./build_artifacts -name cvmfs-config-eessi*) | |
ls -1 -R ./build_artifacts | |
echo ::set-output name=package_filenames::$(find ./build_artifacts -name cvmfs-config-eessi*latest*) | |
- name: Delete any previous tag/release named "latest" | |
uses: dev-drprasad/delete-tag-and-release@085c6969f18bad0de1b9f3fe6692a3cd01f64fe5 # v0.2.0 | |
with: | |
delete_release: true # default: false | |
tag_name: latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: meeDamian/github-release@7ae19492500104f636b3fee4d8103af0fed36c8e # v2.0.3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: latest | |
name: Filesystem Layer latest release | |
body: | | |
Filesystem Layer release ${{ steps.find_version.outputs.version }} (see: https://github.com/${{github.repository}}/releases/tag/${{ steps.find_version.outputs.version }}) | |
This `latest` tag is a moving tag that is updated automatically for each release, and provides easy access to the latest `cvmfs-config-eessi` packages. | |
files: ${{ steps.find_filenames.outputs.package_filenames }} | |
gzip: false |