Fix upload file namespace #3
This file contains hidden or 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: Continuous release (static Linux) | |
| on: | |
| push: | |
| branches: | |
| - master # ONLY upload on master branch | |
| env: | |
| BUILD_DIR: _build | |
| PIP_PACKAGES: >- | |
| meson!=1.8.0 | |
| cmake | |
| ninja | |
| PIP_EXTRAS: >- | |
| pkgconfig | |
| numpy | |
| ase | |
| matplotlib | |
| LINUX_INTEL_COMPONENTS: >- | |
| intel-oneapi-compiler-fortran-2023.1.0 | |
| intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0 | |
| intel-oneapi-mkl-2023.1.0 | |
| intel-oneapi-mkl-devel-2023.1.0 | |
| jobs: | |
| build-static: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| build-type: [static] | |
| toolchain: | |
| # GNU static CMake build | |
| - { compiler: gcc, version: '12', build: cmake } | |
| # Intel static Meson build | |
| - { compiler: intel, version: '2023.1.0', build: meson } | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| # --- Compiler setup ---------------------------------------------------- | |
| - name: Install GCC (Linux) using setup-fortran | |
| if: ${{ contains(matrix.toolchain.compiler, 'gcc') }} | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.toolchain.compiler }} | |
| version: ${{ matrix.toolchain.version }} | |
| - name: Install libopenblas (Linux GNU builds only) | |
| if: ${{ contains(matrix.toolchain.compiler, 'gcc') }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libopenblas-dev | |
| - name: Prepare for Intel cache restore | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') }} | |
| run: | | |
| sudo mkdir -p /opt/intel | |
| sudo chown "$USER" /opt/intel | |
| - name: Cache Intel oneAPI install | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') }} | |
| id: cache-install | |
| uses: actions/cache@v4 | |
| with: | |
| path: /opt/intel/oneapi | |
| key: install-${{ matrix.toolchain.compiler }}-${{ matrix.toolchain.version }}-${{ matrix.os }} | |
| - name: Install Intel oneAPI (compiler + MKL) | |
| if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }} | |
| run: | | |
| KEY=GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| wget https://apt.repos.intel.com/intel-gpg-keys/$KEY | |
| sudo apt-key add $KEY | |
| rm $KEY | |
| echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | |
| sudo apt-get update | |
| sudo apt-get install -y $PKG | |
| env: | |
| PKG: ${{ env.LINUX_INTEL_COMPONENTS }} | |
| - name: Setup Intel oneAPI environment | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') }} | |
| run: | | |
| source /opt/intel/oneapi/setvars.sh | |
| printenv >> $GITHUB_ENV | |
| - name: Set compiler environment variables | |
| run: | | |
| if [ "${{ matrix.toolchain.compiler }}" = "gcc" ]; then | |
| echo "FC=gfortran" >> $GITHUB_ENV | |
| echo "CC=gcc" >> $GITHUB_ENV | |
| elif [ "${{ matrix.toolchain.compiler }}" = "intel" ]; then | |
| echo "FC=ifort" >> $GITHUB_ENV | |
| echo "CC=icx" >> $GITHUB_ENV | |
| fi | |
| echo "COMPILER_VERSION=${{ matrix.toolchain.version }}" >> $GITHUB_ENV | |
| # --- Dependencies & submodules --------------------------------------- | |
| - name: Git submodules checkout | |
| run: git submodule update --init | |
| - name: Install build dependencies | |
| run: | | |
| pip3 install ${{ env.PIP_PACKAGES }} ${{ env.PIP_EXTRAS }} | |
| # --- Configure -------------------------------------------------------- | |
| - name: Configure build (Meson, static-ish) | |
| if: ${{ matrix.toolchain.build == 'meson' }} | |
| run: > | |
| meson setup ${{ env.BUILD_DIR }} | |
| --buildtype=debugoptimized | |
| --prefix=$PWD/_dist | |
| --libdir=lib | |
| --warnlevel=0 | |
| - name: Configure build (CMake, static) | |
| if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'static' }} | |
| run: > | |
| cmake -B${{ env.BUILD_DIR }} | |
| -GNinja | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
| -DCMAKE_INSTALL_PREFIX=$PWD/_dist | |
| -DCMAKE_INSTALL_LIBDIR=lib | |
| -DWITH_TESTS=OFF | |
| -DSTATICBUILD=ON | |
| # --- Build / (optional) test / install -------------------------------- | |
| - name: Build project | |
| run: ninja -C ${{ env.BUILD_DIR }} | |
| - name: Install project | |
| run: | | |
| ninja -C ${{ env.BUILD_DIR }} install | |
| echo "CREST_PREFIX=$PWD/_dist" >> $GITHUB_ENV | |
| - name: Create package | |
| run: | | |
| mkdir crest | |
| cp COPYING crest/LICENSE | |
| cp COPYING.LESSER crest/LICENSE.LESSER | |
| cp _dist/bin/crest crest/ | |
| COMPILER_NAME="${{ matrix.toolchain.compiler }}" | |
| # Map GCC → gnu for backwards-compatible file names | |
| if [ "$COMPILER_NAME" = "gcc" ]; then | |
| COMPILER_NAME="gnu" | |
| fi | |
| OUTPUT="crest-${COMPILER_NAME}-${{ matrix.toolchain.version }}-${{ matrix.os }}.tar" | |
| tar cvf "$OUTPUT" crest | |
| xz -T0 "$OUTPUT" | |
| echo "CREST_OUTPUT=${OUTPUT}.xz" >> $GITHUB_ENV | |
| - name: Upload package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.CREST_OUTPUT }} | |
| path: ${{ env.CREST_OUTPUT }} | |
| continuous-delivery: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-static | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RELEASE_TAG: latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install github-release | |
| run: | | |
| go install github.com/github-release/github-release@latest | |
| echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
| echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
| - name: Set GitHub user/repo | |
| run: | | |
| echo "GITHUB_USER=$( echo ${{ github.repository }} | cut -d/ -f1 )" >> $GITHUB_ENV | |
| echo "GITHUB_REPO=$( echo ${{ github.repository }} | cut -d/ -f2 )" >> $GITHUB_ENV | |
| - name: Move/Create continuous tag | |
| run: | | |
| git tag --force ${{ env.RELEASE_TAG }} ${{ github.sha }} | |
| git push --tags --force | |
| - name: Get Time | |
| run: echo "TIME=$(date -u '+%Y/%m/%d, %H:%M')" >> $GITHUB_ENV | |
| - name: Check continuous release status | |
| run: | | |
| if ! github-release info -t ${{ env.RELEASE_TAG }} > /dev/null 2>&1; then | |
| echo "RELEASE_COMMAND=release" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_COMMAND=edit" >> $GITHUB_ENV | |
| fi | |
| - name: Setup continuous release | |
| run: > | |
| github-release ${{ env.RELEASE_COMMAND }} | |
| --tag ${{ env.RELEASE_TAG }} | |
| --name "Continuous release version" | |
| --description "$DESCRIPTION" | |
| --pre-release | |
| env: | |
| DESCRIPTION: | | |
| Created on ${{ env.TIME }} UTC by @${{ github.actor }} with commit ${{ github.sha }}. | |
| This is an automated distribution of the latest CREST version. | |
| This version is only minimally tested and may be unstable or even crash. | |
| Use with caution! | |
| https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create SHA256 checksums | |
| run: | | |
| cd artifacts | |
| for f in crest-*.tar.xz; do | |
| sha256sum "$f" > "$f.sha256.txt" | |
| done | |
| - name: Upload CREST tarballs to release | |
| run: | | |
| cd artifacts | |
| for f in crest-*.tar.xz; do | |
| github-release upload \ | |
| --tag ${{ env.RELEASE_TAG }} \ | |
| --replace \ | |
| --name "$f" \ | |
| --file "$f" | |
| done | |
| - name: Upload SHA256 checksums to release | |
| run: | | |
| cd artifacts | |
| for f in crest-*.tar.xz.sha256.txt; do | |
| github-release upload \ | |
| --tag ${{ env.RELEASE_TAG }} \ | |
| --replace \ | |
| --name "$f" \ | |
| --file "$f" | |
| done | |