try to fix build for releases as well #1153
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
tags: [ 'v*' ] | |
branches: [ 'master' ] | |
pull_request: | |
branches: [ 'master' ] | |
jobs: | |
build: | |
timeout-minutes: 15 | |
# need to be newer than `ubuntu-20.04` because of scalafmt native binary | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'ci skip')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: bleep-build/bleep-setup-action@0.0.1 | |
- uses: coursier/cache-action@v6 | |
with: | |
extraFiles: bleep.yaml | |
- name: Scalafmt Check | |
run: bleep fmt --check | |
- name: Run tests | |
env: | |
CI: true | |
run: | | |
bleep compile | |
bleep setup-dev-script bleep-cli@jvm3 | |
bleep config compile-server stop-all | |
./bleep-cli@jvm3.sh --dev test | |
build-native-image: | |
name: Native image build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
file_name: bleep | |
artifact_name: bleep-x86_64-pc-linux | |
- os: macos-latest | |
file_name: bleep | |
artifact_name: bleep-x86_64-apple-darwin | |
- os: windows-latest | |
file_name: bleep.exe | |
artifact_name: bleep-x86_64-pc-win32 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: bleep-build/bleep-setup-action@0.0.1 | |
- uses: coursier/cache-action@v6 | |
with: | |
extraFiles: bleep.yaml | |
- name: Build native image (non-windows) | |
# stop compile server after build since the new version may use a newer version of bloop | |
run: | | |
bleep compile bleep-cli@jvm3 | |
bleep setup-dev-script bleep-cli@jvm3 | |
bleep config compile-server stop-all | |
./bleep-cli@jvm3.sh --dev native-image ${{ matrix.file_name }} | |
if: runner.os != 'Windows' | |
- name: Test binary after build (non-windows) | |
env: | |
CI: true | |
run: | | |
./${{ matrix.file_name }} --dev test --no-color jvm3 | |
./${{ matrix.file_name }} selftest | |
if: runner.os != 'Windows' | |
# as is normal, everything involving windows is terrible. | |
# - powershell doesn't work, for one: https://github.com/dirs-dev/directories-jvm/issues/49 | |
# - with `shell: cmd` only one command can be run at a time, so this is split into three | |
# - some windows development stuff needs to be available, that's what setup-graalvm accomplishes below. todo: figure out how bleep can download it itself | |
- name: Build native image 1 (windows) | |
run: bleep config compile-server auto-shutdown-enable | |
shell: cmd | |
if: runner.os == 'Windows' | |
- name: Build native image 2 (windows) | |
uses: graalvm/setup-graalvm@v1 | |
if: runner.os == 'Windows' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
version: '22.3.1' | |
java-version: '17' | |
components: 'native-image' | |
- name: Build native image 3 (windows) | |
run: bleep native-image ${{ matrix.file_name }} | |
shell: cmd | |
if: runner.os == 'Windows' | |
- name: Test binary after build 1 (windows) | |
shell: cmd | |
env: | |
CI: true | |
# todo: fix tests on windows | |
run: .\${{ matrix.file_name }} --dev compile --no-color jvm3 | |
if: runner.os == 'Windows' | |
- name: Test binary after build 2 (windows) | |
shell: cmd | |
env: | |
CI: true | |
# todo: fix tests on windows | |
run: .\${{ matrix.file_name }} selftest | |
if: runner.os == 'Windows' | |
- name: Temporarily save package | |
uses: actions/upload-artifact@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ matrix.artifact_name }} | |
path: ${{ matrix.file_name }} | |
retention-days: 1 | |
release: | |
timeout-minutes: 15 | |
runs-on: ubuntu-20.04 | |
needs: [ build, build-native-image ] | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
path: artifacts | |
- name: Display structure of downloaded files | |
run: find artifacts | |
- name: Release | |
run: | | |
chmod +x ./artifacts/bleep-x86_64-pc-linux/bleep | |
./artifacts/bleep-x86_64-pc-linux/bleep --dev publish | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
- name: Prepare files | |
run: | | |
export VERSION=${{ steps.get_version.outputs.version-without-v }} | |
bash .github/prepare-release.sh | |
- name: Upload-to-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
name: "${{ steps.get_version.outputs.version-without-v }}" | |
prerelease: true | |
generate_release_notes: true | |
files: | | |
work/release/* |