diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build-test.yml | 61 | ||||
-rw-r--r-- | .github/workflows/release.yml | 99 |
2 files changed, 160 insertions, 0 deletions
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..fff479c --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,61 @@ +name: Build test + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + host: [windows-latest, ubuntu-latest, macos-latest] + os: [win, linux, osx] + arch: [x86, x64, arm] + sc: [no-self-contained, self-contained] + exclude: + - os: linux + arch: x86 + - os: osx + arch: x86 + - os: osx + arch: arm + runs-on: ${{ matrix.host }} + env: + APP_NAME: nestiler + PROJECT_PATH: . + OUTPUT_DIR: output + CONFIGURATION: Release + OUTPUT_SUBDIR: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.sc }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Checkout submodules + run: git submodule update --init --recursive + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + - name: Build + env: + SC_OPS: ${{ matrix.sc == 'self-contained' && '--self-contained true -p:PublishTrimmed=True' || '--no-self-contained' }} + run: dotnet publish ${{ env.PROJECT_PATH }} -c ${{ env.CONFIGURATION }} -r ${{ matrix.os }}-${{ matrix.arch }} -p:PublishSingleFile=true $SC_OPS -p:IncludeAllContentForSelfExtract=true -o ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}/${{ env.APP_NAME }} + - name: Simple test + if: | + (matrix.host == 'ubuntu-latest' && matrix.os == 'linux' && matrix.arch != 'arm') + || (matrix.host == 'macos-latest' && matrix.os == 'osx' && matrix.arch != 'arm') + || (matrix.host == 'windows-latest' && matrix.os == 'win' && matrix.arch != 'arm') + working-directory: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}/${{ env.APP_NAME }} + run: | + ./nestiler --help + - name: Upload artifact + if: | + (matrix.host == 'ubuntu-latest' && matrix.os == 'linux') + || (matrix.host == 'macos-latest' && matrix.os == 'osx') + || (matrix.host == 'windows-latest' && matrix.os == 'win') + uses: actions/upload-artifact@v2 + with: + name: ${{ env.OUTPUT_SUBDIR }} + path: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..454b3cb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,99 @@ +name: Create release + +on: + workflow_dispatch: + +jobs: + create-release: + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: false + - name: Output Release URL File + run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt + - name: Save Release URL File for publish + uses: actions/upload-artifact@v1 + with: + name: release_url + path: release_url.txt + + publish: + needs: create-release + runs-on: ubuntu-latest + env: + APP_NAME: nestiler + PROJECT_PATH: . + OUTPUT_DIR: output + CONFIGURATION: Release + OUTPUT_SUBDIR: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.sc }} + OUTPUT_FILE: nestiler-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.sc == 'self-contained' && '-self-contained' || '' }}.${{ matrix.os == 'win' && 'zip' || 'tar.gz' }} + strategy: + matrix: + os: [win, linux, osx] + arch: [x86, x64, arm] + sc: [no-self-contained, self-contained] + exclude: + - os: linux + arch: x86 + - os: osx + arch: x86 + - os: osx + arch: arm + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Checkout submodules + run: git submodule update --init --recursive + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + - name: Build + env: + SC_OPS: ${{ matrix.sc == 'self-contained' && '--self-contained true -p:PublishTrimmed=True' || '--no-self-contained' }} + run: dotnet publish ${{ env.PROJECT_PATH }} -c ${{ env.CONFIGURATION }} -r ${{ matrix.os }}-${{ matrix.arch }} -p:PublishSingleFile=true $SC_OPS -p:IncludeAllContentForSelfExtract=true -o ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}/${{ env.APP_NAME }} + - name: Simple test + if: | + (matrix.host == 'ubuntu-latest' && matrix.os == 'linux' && matrix.arch != 'arm') + || (matrix.host == 'macos-latest' && matrix.os == 'osx' && matrix.arch != 'arm') + || (matrix.host == 'windows-latest' && matrix.os == 'win' && matrix.arch != 'arm') + working-directory: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}/${{ env.APP_NAME }} + run: | + ./famicom-dumper list-mappers + - name: Archive + working-directory: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }} + env: + CMD: ${{ matrix.os == 'win' && 'zip -r9' || 'tar -czvf' }} + run: | + ${{ env.CMD }} ../../${{ env.OUTPUT_FILE }} ${{ env.APP_NAME }} + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + - name: Get Release File Name & Upload URL + id: get_release_info + env: + TAG_REF_NAME: ${{ github.ref }} + REPOSITORY_NAME: ${{ github.repository }} + run: | + echo ::set-output name=file_name::${REPOSITORY_NAME##*/}-${TAG_REF_NAME##*/v} # RepositoryName-v1.0.0 + value=`cat release_url/release_url.txt` + echo ::set-output name=upload_url::$value + - name: Upload + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MIME: ${{ matrix.os == 'win' && 'zip' || 'tar.gz' }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ${{ env.OUTPUT_FILE }} + asset_name: ${{ env.OUTPUT_FILE }} + asset_content_type: ${{ env.MIME }} |