diff options
author | LKedward <laurence.kedward@bristol.ac.uk> | 2020-11-18 15:44:19 +0000 |
---|---|---|
committer | LKedward <laurence.kedward@bristol.ac.uk> | 2020-11-18 15:44:19 +0000 |
commit | 254a08ec19875564cc8149b2713e2e6f34844330 (patch) | |
tree | a27a06bf83ebdc1c6a4d75e19d5b940030cb9446 /.github | |
parent | cf0576774bb504bac4b0648bb05fbcb2b90d11a0 (diff) | |
download | fpm-254a08ec19875564cc8149b2713e2e6f34844330.tar.gz fpm-254a08ec19875564cc8149b2713e2e6f34844330.zip |
Move release workflow into existing CI to reuse build/test workflow
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/CI.yml | 50 | ||||
-rw-r--r-- | .github/workflows/release_binaries.yml | 138 |
2 files changed, 49 insertions, 139 deletions
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 03fcf84..22aa6e5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,6 @@ name: CI -on: [push, pull_request] +on: [push, pull_request, release] env: CI: "ON" # We can detect this in the build system and other vendors implement it @@ -23,16 +23,22 @@ jobs: - os: ubuntu-latest STACK_CACHE: "/home/runner/.stack/" STACK_CACHE_VERSION: "" + BOOTSTRAP_FILE: "/home/runner/.local/bin/fpm" + XSUFFIX: "" - os: macos-latest STACK_CACHE: | /Users/runner/.stack/snapshots /Users/runner/.stack/setup-exe-src STACK_CACHE_VERSION: "v2" + BOOTSTRAP_FILE: "/Users/runner/.local/bin/fpm" + XSUFFIX: "" - os: windows-latest STACK_CACHE: | C:\Users\runneradmin\AppData\Roaming\stack C:\Users\runneradmin\AppData\Local\Programs\stack STACK_CACHE_VERSION: "v2" + BOOTSTRAP_FILE: C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe + XSUFFIX: ".exe" env: FC: gfortran @@ -104,3 +110,45 @@ jobs: if: contains(matrix.os, 'windows') run: | ci\run_tests.bat + + # ----- Upload binaries if creating a release ----- + - name: Check that fpm --version matches release tag + if: github.event_name == 'release' && contains(matrix.os, 'ubuntu') + run: | + cd fpm + fpm run -- "--version" | grep $(echo ${{ github.ref }} | cut -d/ -f3) + + - name: Stage file for upload (Linux / macOS) + if: github.event_name == 'release' && (contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')) + run: | + cd fpm + fpm run --runner cp -- fpm-${{ matrix.os }}-x86_64-debug + + - name: Stage file for upload (Windows) + if: github.event_name == 'release' && contains(matrix.os, 'windows') + shell: cmd + run: | + cd fpm + fpm run --runner copy -- fpm-${{ matrix.os }}-x86_64-debug + + - name: Upload dev trunk binary release + if: github.event_name == 'release' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: fpm/fpm-${{ matrix.os }}-x86_64-debug + asset_name: fpm-${{ matrix.os }}-x86_64-debug${{ matrix.XSUFFIX }} + tag: ${{ github.ref }} + overwrite: true + prerelease: true + + - name: Upload dev trunk binary release (bootstrap fpm) + if: github.event_name == 'release' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.BOOTSTRAP_FILE }} + asset_name: fpm-bootstrap-${{ matrix.os }}-x86_64-debug${{ matrix.XSUFFIX }} + tag: ${{ github.ref }} + overwrite: true + prerelease: true
\ No newline at end of file diff --git a/.github/workflows/release_binaries.yml b/.github/workflows/release_binaries.yml deleted file mode 100644 index e7a54b6..0000000 --- a/.github/workflows/release_binaries.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Release binaries - -on: release - -jobs: - Build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - gcc_v: [9] # Version of GFortran we want to use. - include: - - os: ubuntu-latest - STACK_CACHE: "/home/runner/.stack/" - STACK_CACHE_VERSION: "" - BOOTSTRAP_FILE: "/home/runner/.local/bin/fpm" - - os: macos-latest - STACK_CACHE: | - /Users/runner/.stack/snapshots - /Users/runner/.stack/setup-exe-src - STACK_CACHE_VERSION: "v2" - BOOTSTRAP_FILE: "/Users/runner/.local/bin/fpm" - - os: windows-latest - STACK_CACHE: | - C:\Users\runneradmin\AppData\Roaming\stack - C:\Users\runneradmin\AppData\Local\Programs\stack - STACK_CACHE_VERSION: "v2" - BOOTSTRAP_FILE: C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe - - env: - FC: gfortran - GCC_V: ${{ matrix.gcc_v }} - - steps: - - name: Checkout code - uses: actions/checkout@v1 - - - name: Install GFortran macOS - if: contains(matrix.os, 'macos') - run: | - ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran - which gfortran-${GCC_V} - which gfortran - - - name: Install GFortran Linux - if: contains(matrix.os, 'ubuntu') - run: | - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ - --slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V} - - - name: Get Time - id: time - uses: nanzm/get-time-action@v1.0 - with: - format: 'YYYY-MM' - - - name: Setup github actions cache - id: cache - uses: actions/cache@v2 - with: - path: ${{matrix.STACK_CACHE}} - key: ${{ runner.os }}-${{ steps.time.outputs.time }}${{matrix.STACK_CACHE_VERSION}} - - - name: Build Haskell fpm - run: | - cd bootstrap - stack build - stack install - - - name: put fpm to PATH (macOS) - if: contains(matrix.os, 'macos') - run: | - cp /Users/runner/.local/bin/fpm /usr/local/bin - - - name: put fpm to PATH (Windows) - if: contains(matrix.os, 'windows') - run: | - copy "C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe" "C:\Program Files\Git\usr\bin" - - - name: put fpm to PATH (Linux) - if: contains(matrix.os, 'ubuntu') - run: | - sudo cp /home/runner/.local/bin/fpm /usr/local/bin - - - name: Run tests on Haskell fpm - run: | - cd bootstrap - stack test - - - name: Build and run Fortran fpm (Linux / macOS) - if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') - run: | - ci/run_tests.sh - - - name: Build and run Fortran fpm (Windows) - if: contains(matrix.os, 'windows') - run: | - ci\run_tests.bat - - - name: Check that fpm --version matches release tag - if: contains(matrix.os, 'ubuntu') - run: | - cd fpm - fpm run -- "--version" | grep $(echo ${{ github.ref }} | cut -d/ -f3) - - - name: Stage file for upload (Linux / macOS) - if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') - run: | - cd fpm - fpm run --runner cp -- fpm-${{ matrix.os }}-x86_64-debug - - - name: Stage file for upload (Windows) - if: contains(matrix.os, 'windows') - shell: cmd - run: | - cd fpm - fpm run --runner copy -- fpm-${{ matrix.os }}-x86_64-debug - - - name: Upload dev trunk binary release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: fpm/fpm-${{ matrix.os }}-x86_64-debug - asset_name: fpm-${{ matrix.os }}-x86_64-debug - tag: ${{ github.ref }} - overwrite: true - prerelease: true - - - name: Upload dev trunk binary release (bootstrap fpm) - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.BOOTSTRAP_FILE }} - asset_name: fpm-bootstrap-${{ matrix.os }}-x86_64-debug - tag: ${{ github.ref }} - overwrite: true - prerelease: true
\ No newline at end of file |