summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci-release.yml109
-rw-r--r--.github/workflows/codeql-analysis.yml2
2 files changed, 110 insertions, 1 deletions
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml
new file mode 100644
index 00000000..7a15a083
--- /dev/null
+++ b/.github/workflows/ci-release.yml
@@ -0,0 +1,109 @@
+name: release
+
+on:
+ release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
+ types: [published]
+
+jobs:
+ build:
+ name: Build for ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.compiler }})
+ runs-on: ubuntu-20.04
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [linux, freebsd, darwin]
+ compiler: [gcc]
+ archiver: [tar]
+ arch: [amd64]
+ include:
+ - os: windows # include build for windows directly
+ compiler: gcc
+ archiver: zip
+ arch: amd64
+ - compiler: musl-gcc # more info: <https://musl.libc.org/>
+ archiver: tar
+ arch: amd64
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.15.5
+
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Install musl
+ if: matrix.compiler == 'musl-gcc'
+ run: sudo apt-get install -y musl-tools
+
+ - name: Download dependencies
+ run: go mod download # `-x` means "verbose" mode
+
+ - name: Generate compiler values
+ id: values
+ run: |
+ echo "::set-output name=version::`echo ${GITHUB_REF##*/} | sed -e 's/^[vV ]*//'`"
+ echo "::set-output name=timestamp::`date +%FT%T%z`"
+ echo "::set-output name=binary-name::rr`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`"
+
+ - name: Compile binary file
+ env:
+ GOOS: ${{ matrix.os }}
+ GOARCH: ${{ matrix.arch }}
+ CC: ${{ matrix.compiler }}
+ LDFLAGS: >-
+ -s
+ -X github.com/spiral/roadrunner/cmd/rr/cmd.Version=${{ steps.values.outputs.version }}
+ -X github.com/spiral/roadrunner/cmd/rr/cmd.BuildTime=${{ steps.values.outputs.timestamp }}
+ run: |
+ go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/rr/main.go
+ stat "./${{ steps.values.outputs.binary-name }}"
+
+ - name: Generate distributive directory name
+ id: dist-dir
+ run: >
+ echo "::set-output name=name::roadrunner-${{ steps.values.outputs.version }}-$(
+ [ ${{ matrix.os }} != '' ] && echo '${{ matrix.os }}' || echo 'unknown'
+ )$(
+ [ ${{ matrix.compiler }} = 'musl-gcc' ] && echo '-musl'
+ )-${{ matrix.arch }}"
+
+ - name: Generate distributive archive name
+ id: dist-arch
+ run: >
+ echo "::set-output name=name::${{ steps.dist-dir.outputs.name }}.$(
+ case ${{ matrix.archiver }} in
+ zip) echo 'zip';;
+ tar) echo 'tar.gz';;
+ *) exit 10;
+ esac
+ )"
+
+ - name: Create distributive
+ run: |
+ mkdir ${{ steps.dist-dir.outputs.name }}
+ mv "./${{ steps.values.outputs.binary-name }}" ./${{ steps.dist-dir.outputs.name }}/
+ cp ./README.md ./CHANGELOG.md ./LICENSE ./${{ steps.dist-dir.outputs.name }}/
+
+ - name: Pack distributive using tar
+ if: matrix.archiver == 'tar'
+ run: tar -zcf "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
+
+ - name: Pack distributive using zip
+ if: matrix.archiver == 'zip'
+ run: zip -r -q "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
+
+ - uses: actions/upload-artifact@v2
+ with:
+ name: ${{ steps.dist-dir.outputs.name }}
+ path: ${{ steps.dist-arch.outputs.name }}
+ if-no-files-found: error
+ retention-days: 30
+
+ - name: Upload binaries to release
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: ${{ steps.dist-arch.outputs.name }}
+ asset_name: ${{ steps.dist-arch.outputs.name }}
+ tag: ${{ github.ref }}
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 1c90e4a4..75e40110 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -47,7 +47,7 @@ jobs:
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
+ # By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main