Build, test, and release client packages #359
Workflow file for this run
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 | |
jobs: | |
build-linux-packages: | |
runs-on: ubuntu-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: Prepare package source | |
uses: roles-ansible/check-ansible-debian-stretch-action@master | |
with: | |
targets: "./prepare-client-packages.yml" | |
hosts: "localhost" | |
# We probably should loop over the set {rpm,deb,osxpkg} to create packages, but | |
# it will make debugging more annoying. | |
- name: Build RPM package | |
id: build-rpm | |
uses: bpicode/github-action-fpm@master | |
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 | |
id: build-deb | |
uses: bpicode/github-action-fpm@master | |
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 | |
id: build-tar | |
uses: bpicode/github-action-fpm@master | |
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: Find filenames of generated packages | |
id: find_filenames | |
shell: bash | |
run: | | |
rpmfile="$(ls -1 cvmfs-config-eessi*.rpm)" | |
debfile="$(ls -1 cvmfs-config-eessi*.deb)" | |
tarfile="$(ls -1 cvmfs-config-eessi*.tar)" | |
echo ::set-output name=rpmfile::${rpmfile} | |
echo ::set-output name=debfile::${debfile} | |
echo ::set-output name=tarfile::${tarfile} | |
- name: Upload Deb package as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Deb package | |
path: ${{ steps.find_filenames.outputs.debfile }} | |
- name: Upload RPM package as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: RPM package | |
path: ${{ steps.find_filenames.outputs.rpmfile }} | |
- name: Upload tar package as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Tar package | |
path: ${{ steps.find_filenames.outputs.tarfile }} | |
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: Install CVMFS client | |
run: sudo apt-get update && sudo apt-get install cvmfs | |
- name: Download cvmfs-config-eessi package | |
uses: actions/download-artifact@v2 | |
with: | |
name: Deb package | |
- name: Find filename of package | |
id: find_filename | |
shell: bash | |
run: | | |
debfile="$(ls -1 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/pilot.eessi-hpc.org/ | |
test-rpm-package: | |
needs: build-linux-packages | |
runs-on: ubuntu-latest | |
container: | |
image: centos:centos7 | |
options: --device /dev/fuse --privileged | |
steps: | |
- name: Download and install CVMFS client | |
run: yum install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm | |
- name: Install CVMFS client | |
run: yum install -y cvmfs | |
- name: Download cvmfs-config-eessi package | |
uses: actions/download-artifact@v2 | |
with: | |
name: RPM package | |
- name: Find filename of package | |
id: find_filename | |
shell: bash | |
run: | | |
rpmfile="$(ls -1 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/pilot.eessi-hpc.org && mount -t cvmfs pilot.eessi-hpc.org /cvmfs/pilot.eessi-hpc.org | |
- name: Test repository access | |
run: ls /cvmfs/pilot.eessi-hpc.org/ | |
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: Install CVMFS client | |
run: sudo apt-get update && sudo apt-get install cvmfs | |
- name: Download cvmfs-config-eessi package | |
uses: actions/download-artifact@v2 | |
with: | |
name: Tar package | |
- name: Find filename of package | |
id: find_filename | |
shell: bash | |
run: | | |
tarfile="$(ls -1 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/pilot.eessi-hpc.org/ | |
test-macos-package: | |
needs: build-macos-package | |
runs-on: macos-latest | |
steps: | |
- name: Install OSXFUSE | |
run: brew install --cask osxfuse | |
- name: Download and install CVMFS client | |
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-2.7.5/cvmfs-2.7.5.pkg && sudo installer -target / -pkg cvmfs-2.7.5.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="$(ls -1 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/pilot.eessi-hpc.org && sudo mount -t cvmfs pilot.eessi-hpc.org /Users/Shared/cvmfs/pilot.eessi-hpc.org | |
- name: Test repository access | |
run: ls /Users/Shared/cvmfs/pilot.eessi-hpc.org/ | |
release: | |
needs: [build-linux-packages, build-macos-package, test-deb-package, test-rpm-package, test-macos-package, test-tar-package] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Deb package | |
uses: actions/download-artifact@v2 | |
with: | |
name: Deb package | |
- name: Download RPM package | |
uses: actions/download-artifact@v2 | |
with: | |
name: RPM package | |
- name: Download tar package | |
uses: actions/download-artifact@v2 | |
with: | |
name: Tar package | |
- name: Download macOS package | |
uses: actions/download-artifact@v2 | |
with: | |
name: macOS package | |
- name: Find filenames of downloaded packages | |
id: find_filenames | |
shell: bash | |
run: | | |
rpmfile="$(ls -1 cvmfs-config-eessi*.rpm)" | |
debfile="$(ls -1 cvmfs-config-eessi*.deb)" | |
pkgfile="$(ls -1 cvmfs-config-eessi*.pkg)" | |
tarfile="$(ls -1 cvmfs-config-eessi*.tar)" | |
echo ::set-output name=rpmfile::${rpmfile} | |
echo ::set-output name=debfile::${debfile} | |
echo ::set-output name=pkgfile::${pkgfile} | |
echo ::set-output name=tarfile::${tarfile} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Filesystem Layer ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload RPM as release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.find_filenames.outputs.rpmfile }} | |
asset_name: ${{ steps.find_filenames.outputs.rpmfile }} | |
asset_content_type: application/x-rpm | |
- name: Upload Deb as release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.find_filenames.outputs.debfile }} | |
asset_name: ${{ steps.find_filenames.outputs.debfile }} | |
asset_content_type: application/x-deb | |
- name: Upload Pkg as release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.find_filenames.outputs.pkgfile }} | |
asset_name: ${{ steps.find_filenames.outputs.pkgfile }} | |
asset_content_type: application/x-newton-compatible-pkg | |
- name: Upload Tar as release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.find_filenames.outputs.tarfile }} | |
asset_name: ${{ steps.find_filenames.outputs.tarfile }} | |
asset_content_type: application/x-tar |