WIP #816
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: Release | |
on: | |
push: | |
branches: | |
- '*' | |
paths: | |
- '**' | |
- '!website/**' | |
env: | |
NOCACHE: "Cache-Control: no-cache, no-store" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: "0" | |
HEPH_PROFILES: "release,ci" | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: magnetikonline/action-golang-cache@v4 | |
with: | |
go-version: ~1.22 | |
cache-key-suffix: -build | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/heph-cache | |
key: heph-cache-build-${{ github.run_id }} | |
restore-keys: | | |
heph-cache-build- | |
- name: Bootstrap Build | |
run: go build -v -o heph github.com/hephbuild/heph/cmd/heph | |
- name: Build all OS/ARCH | |
run: | | |
mkdir -p dist | |
./heph r //:cp_builds $(pwd)/dist | |
ls ./dist | |
- name: Upload assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: heph | |
path: dist/* | |
- name: Set version | |
id: version | |
run: | | |
VERSION=$(cat $(./heph run --print-out //:version)) | |
echo $VERSION | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
# - name: Setup tmate session | |
# if: ${{ failure() }} | |
# run: | | |
# curl -L https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz | tar -xJ --strip-components 1 | |
# ./tmate -F | |
upload_gcs: | |
name: Upload binaries | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: heph | |
path: dist | |
- name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v0' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Copy to bucket | |
id: upload | |
run: | | |
VERSION=${{needs.build.outputs.version}} | |
echo $VERSION | |
[ -z "$VERSION" ] && echo "Empty version" && exit 1 | |
gsutil -h "${NOCACHE}" rsync -r './dist' gs://heph-build/${VERSION} | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [ build, upload_gcs, test ] | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v0' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Copy to bucket | |
run: | | |
VERSION=${{needs.build.outputs.version}} | |
echo $VERSION > ./latest_version | |
gsutil -h "${NOCACHE}" cp './latest_version' gs://heph-build/latest_version | |
gsutil -h "${NOCACHE}" cp './install.sh' gs://heph-build/install.sh | |
gsutil -h "${NOCACHE}" cp './hephw' gs://heph-build/hephw | |
test: | |
name: Test | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
env: | |
HEPH_PROFILES: "ci" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: magnetikonline/action-golang-cache@v4 | |
with: | |
go-version: ~1.22 | |
cache-key-suffix: -test | |
- uses: actions/download-artifact@v3 | |
with: | |
name: heph | |
path: dist | |
- name: Setup heph bin | |
run: | | |
chmod +x dist/* | |
mkdir -p /home/runner/.local/bin | |
cp dist/heph_linux_amd64 /home/runner/.local/bin/heph | |
echo "HEPH_DIST_ROOT=$(pwd)/dist" >> $GITHUB_ENV | |
echo "HEPH_DIST_NOVERSION=1" >> $GITHUB_ENV | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/heph-cache | |
key: heph-cache-test-${{ github.run_id }} | |
restore-keys: | | |
heph-cache-test- | |
- name: Go Tests | |
run: "heph run //:test_go" | |
- name: Light E2E Test | |
run: "heph run //:test_light_e2e" | |
- name: Light E2E ReTest | |
run: "heph run //:test_light_e2e" | |
- name: E2E Test | |
run: "heph run //:test_e2e" | |
- name: intg Test | |
run: "heph run //:test_intg" | |
- name: intg ReTest | |
run: "heph run //:test_intg" | |
- name: Cleanup .heph | |
run: | | |
rm -rf .heph/cache/test |