Skip to content

Commit edb3fcd

Browse files
authored
Separate upload stage in CI testing (#564)
1 parent df8c9b4 commit edb3fcd

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

.github/workflows/CI.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@ jobs:
2727
- os: ubuntu-latest
2828
os-arch: linux-x86_64
2929
release-flags: --flag '--static -g -fbacktrace -O3'
30-
sha256sum: sha256sum
3130

3231
- os: macos-latest
3332
os-arch: macos-x86_64
3433
release-flags: --flag '-g -fbacktrace -O3'
35-
sha256sum: shasum -a 256
3634

3735
- os: windows-latest
3836
os-arch: windows-x86_64
3937
release-flags: --flag '--static -g -fbacktrace -O3'
4038
exe: .exe
41-
sha256sum: sha256sum
4239

4340
env:
4441
FC: gfortran
@@ -72,7 +69,7 @@ jobs:
7269
shell: bash
7370
run: |
7471
mv $(which fpm) fpm-bootstrap${{ matrix.exe }}
75-
echo "BOOTSTRAP=$PWD/fpm-bootstrap" | cat >> $GITHUB_ENV
72+
echo "BOOTSTRAP=$PWD/fpm-bootstrap" >> $GITHUB_ENV
7673
7774
- name: Build Fortran fpm (bootstrap)
7875
shell: bash
@@ -102,21 +99,21 @@ jobs:
10299
run: |
103100
${{ env.BOOTSTRAP }} run --runner cp -- fpm-debug${{ matrix.exe }}
104101
rm -v ${{ env.BOOTSTRAP }}
105-
echo "FPM=$PWD/fpm-debug" | cat >> $GITHUB_ENV
102+
echo "FPM=$PWD/fpm-debug" >> $GITHUB_ENV
106103
107104
- name: Get version (normal)
108105
if: github.event_name != 'release'
109106
shell: bash
110107
run: |
111108
VERSION=$(git rev-parse --short HEAD)
112-
echo "VERSION=$VERSION" | cat >> $GITHUB_ENV
109+
echo "VERSION=$VERSION" >> $GITHUB_ENV
113110
114111
- name: Get version (release)
115112
if: github.event_name == 'release'
116113
shell: bash
117114
run: |
118115
VERSION=$(echo ${{ github.ref }} | cut -dv -f2)
119-
echo "VERSION=$VERSION" | cat >> $GITHUB_ENV
116+
echo "VERSION=$VERSION" >> $GITHUB_ENV
120117
FPM_VERSION=$(${{ env.FPM }} --version | grep -o '${{ env.REGEX }}')
121118
[ "$VERSION" = "$FPM_VERSION" ]
122119
env:
@@ -154,27 +151,47 @@ jobs:
154151
run: |
155152
${{ env.FPM }} run ${{ matrix.release-flags }} --runner cp -- ${{ env.EXE }}
156153
rm -v ${{ env.FPM }}
157-
echo "FPM_RELEASE=$PWD/${{ env.EXE }}" | cat >> $GITHUB_ENV
154+
echo "FPM_RELEASE=${{ env.EXE }}" >> $GITHUB_ENV
158155
env:
159156
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}${{ matrix.exe }}
160157

161158
- name: Run release version
162159
shell: bash
163160
run: |
164-
ci/run_tests.sh "${{ env.FPM_RELEASE }}"
161+
ci/run_tests.sh "$PWD/${{ env.FPM_RELEASE }}"
165162
166-
- name: Stage release files for upload
167-
if: github.event_name == 'release'
168-
shell: bash
163+
- name: Upload artifact
164+
uses: actions/upload-artifact@v2
165+
with:
166+
name: ${{ env.FPM_RELEASE }}
167+
path: ${{ env.FPM_RELEASE }}
168+
169+
upload-artifacts:
170+
if: github.event_name == 'release'
171+
runs-on: ubuntu-latest
172+
needs:
173+
- build
174+
175+
steps:
176+
- name: Download Artifacts
177+
uses: actions/download-artifact@v2
178+
with:
179+
path: ${{ github.workspace }} # This will download all files
180+
181+
- name: Create SHA256 checksums
169182
run: |
170-
${{ matrix.sha256sum }} ${{ env.FPM_RELEASE }} > ${{ env.FPM_RELEASE }}.sha256
183+
for output in fpm-*/fpm-*; do
184+
pushd $(dirname "$output")
185+
sha256sum $(basename "$output") | tee $(basename "$output").sha256
186+
popd
187+
done
171188
172189
- name: Upload assets
173190
if: github.event_name == 'release'
174191
uses: svenstaro/upload-release-action@v2
175192
with:
176193
repo_token: ${{ secrets.GITHUB_TOKEN }}
177-
file: fpm-*
194+
file: fpm-*/fpm-*
178195
file_glob: true
179196
tag: ${{ github.ref }}
180197
overwrite: true

0 commit comments

Comments
 (0)