Skip to content

Commit 731e473

Browse files
committed
Add GitHub workflow
1 parent c17f5ca commit 731e473

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build and test
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches:
7+
- '*'
8+
tags:
9+
- '*'
10+
11+
# Must set Settings -> Actions -> General -> Workflow permissions to
12+
# "Read and write permissions"
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
arch: ["", "i686"]
24+
flavor: ["", "fortran", "mini"]
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Apply i686 patch
30+
if: matrix.arch == 'i686'
31+
run: patch -p1 -i src/variant-i686.patch
32+
33+
- name: Apply Fortran patch
34+
if: matrix.flavor == 'fortran'
35+
run: patch -p1 -i src/variant-fortran.patch
36+
37+
- name: Apply Mini patch
38+
if: matrix.flavor == 'mini'
39+
run: patch -p1 -i src/variant-mini.patch
40+
41+
- name: Generate ZIP name and version string
42+
id: filename
43+
env:
44+
ARCH: ${{ matrix.arch }}
45+
FLAVOR: ${{ matrix.flavor }}
46+
run: |
47+
GIT_VERSION="$(git describe --tags --always)"
48+
echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT
49+
echo "zipname=w64devkit${ARCH:+-$ARCH}${FLAVOR:+-$FLAVOR}-${GIT_VERSION:1}" >> $GITHUB_OUTPUT
50+
51+
- name: Build
52+
run: |
53+
docker build -t w64devkit .
54+
docker run --rm w64devkit > ${{ steps.filename.outputs.zipname }}.zip
55+
56+
# https://github.com/actions/upload-artifact#zipped-artifact-downloads
57+
- name: Prepare artifact
58+
run: |
59+
unzip ${{ steps.filename.outputs.zipname }}.zip
60+
61+
- name: Upload artifact
62+
uses: actions/upload-artifact@v2
63+
with:
64+
name: ${{ steps.filename.outputs.zipname }}
65+
path: w64devkit/*
66+
67+
- name: Create Release
68+
if: startsWith(github.ref, 'refs/tags/')
69+
uses: softprops/action-gh-release@v1
70+
with:
71+
name: ${{ steps.filename.outputs.version }}
72+
files: w64devkit-*.zip
73+
draft: true

0 commit comments

Comments
 (0)