|
| 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"] |
| 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: Generate ZIP name and version string |
| 38 | + id: filename |
| 39 | + env: |
| 40 | + ARCH: ${{ matrix.arch }} |
| 41 | + FLAVOR: ${{ matrix.flavor }} |
| 42 | + run: | |
| 43 | + GIT_VERSION="$(git describe --tags --always)" |
| 44 | + echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT |
| 45 | + echo "zipname=w64devkit${ARCH:+-$ARCH}${FLAVOR:+-$FLAVOR}-${GIT_VERSION:1}" >> $GITHUB_OUTPUT |
| 46 | +
|
| 47 | + - name: Build |
| 48 | + run: | |
| 49 | + docker build -t w64devkit . |
| 50 | + docker run --rm w64devkit > ${{ steps.filename.outputs.zipname }}.zip |
| 51 | +
|
| 52 | + # https://github.com/actions/upload-artifact#zipped-artifact-downloads |
| 53 | + - name: Prepare artifact |
| 54 | + run: | |
| 55 | + unzip ${{ steps.filename.outputs.zipname }}.zip |
| 56 | +
|
| 57 | + - name: Upload artifact |
| 58 | + uses: actions/upload-artifact@v2 |
| 59 | + with: |
| 60 | + name: ${{ steps.filename.outputs.zipname }} |
| 61 | + path: w64devkit/* |
| 62 | + |
| 63 | + - name: Create Release |
| 64 | + if: startsWith(github.ref, 'refs/tags/') |
| 65 | + uses: softprops/action-gh-release@v1 |
| 66 | + with: |
| 67 | + name: ${{ steps.filename.outputs.version }} |
| 68 | + files: w64devkit-*.zip |
| 69 | + draft: true |
0 commit comments