From 0aeceaeaf10aca20bc8a6dfc165b5c22ea9d825d Mon Sep 17 00:00:00 2001 From: rsdy
Date: Tue, 31 May 2022 15:26:37 +0100 Subject: [PATCH 1/5] Build for M1 --- .github/workflows/rust.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1d10e40..840e498 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -36,6 +36,7 @@ jobs: name: [ linux, macos, + macos-m1, windows ] @@ -52,6 +53,12 @@ jobs: target: x86_64-apple-darwin cross: false + - name: macos-m1 + os: macos-latest + asset_name: 0s-macos-aarch64 + target: aarch64-apple-darwin + cross: true + - name: windows os: windows-latest asset_name: 0s-windows-x86_64.exe @@ -59,7 +66,7 @@ jobs: cross: false rust: - - 1.60.0 # MSRV + - 1.61.0 # MSRV runs-on: ${{ matrix.os }} steps: From f4f8af84699e022c5afaaa72451ae36719248160 Mon Sep 17 00:00:00 2001 From: rsdy
Date: Tue, 31 May 2022 15:44:50 +0100 Subject: [PATCH 2/5] Package builds into tarballs --- .github/workflows/rust.yml | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 840e498..671d72d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -43,19 +43,19 @@ jobs: include: - name: linux os: ubuntu-latest - asset_name: 0s-linux-x86_64-static + asset_name: 0s-linux-x86_64-static.tar.gz target: x86_64-unknown-linux-musl cross: true - name: macos os: macos-latest - asset_name: 0s-macos-x86_64 + asset_name: 0s-macos-x86_64.tar.gz target: x86_64-apple-darwin cross: false - name: macos-m1 os: macos-latest - asset_name: 0s-macos-aarch64 + asset_name: 0s-macos-aarch64.tar.gz target: aarch64-apple-darwin cross: true @@ -105,6 +105,26 @@ jobs: name: ${{ matrix.asset_name }} path: "output/bin/0s${{ matrix.os == 'windows-latest' && '.exe' || '' }}" + package: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + path: bin + + - name: Package artifacts + run: | + set -e + cd bin + for dir in 0s-linux* 0s-macos*; do + (cd $dir; + tar czf archive.tar.gz 0s; + rm 0s; + ) + done + release: runs-on: ubuntu-latest needs: [build, security_audit] @@ -114,6 +134,18 @@ jobs: uses: actions/download-artifact@v3 with: path: bin + + - name: Package artifacts + run: | + set -e + cd bin + for dir in 0s-linux* 0s-macos*; do + (cd $dir; + tar czf archive.tar.gz 0s; + rm 0s; + ) + done + - name: Attach binaries to release uses: actions/github-script@v6 with: From 29f0684477958291581d4315505fb4d4d27a4cf8 Mon Sep 17 00:00:00 2001 From: rsdy
Date: Tue, 31 May 2022 15:48:50 +0100 Subject: [PATCH 3/5] Don't test on foreign architecture --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 671d72d..51345e7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -79,6 +79,7 @@ jobs: target: ${{ matrix.target }} - name: Test + if: matrix.target != 'aarch64-apple-darwin' uses: actions-rs/cargo@v1 with: use-cross: ${{ matrix.cross }} From 86c4d3df3c776ea104c4cab4ac26097343a25326 Mon Sep 17 00:00:00 2001 From: rsdy
Date: Tue, 31 May 2022 16:12:59 +0100 Subject: [PATCH 4/5] Generate some output --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 51345e7..60a8917 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -121,7 +121,9 @@ jobs: cd bin for dir in 0s-linux* 0s-macos*; do (cd $dir; + echo $dir tar czf archive.tar.gz 0s; + sha256sum archive.tar.gz rm 0s; ) done From b6cea592e414bad4353bd521d9abc38ff15fb329 Mon Sep 17 00:00:00 2001 From: rsdy
Date: Wed, 1 Jun 2022 15:04:02 +0100 Subject: [PATCH 5/5] Package linux/macos artifacts for homebrew --- .github/workflows/rust.yml | 55 ++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 60a8917..652d45b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,6 +8,9 @@ on: release: types: [ published ] +env: + version: ${{ github.event.release.tag_name || github.head_ref }} + jobs: security_audit: runs-on: ubuntu-latest @@ -43,25 +46,25 @@ jobs: include: - name: linux os: ubuntu-latest - asset_name: 0s-linux-x86_64-static.tar.gz + asset_name: 0s-${{ github.event.release.tag_name || github.head_ref }}-linux-x86_64 target: x86_64-unknown-linux-musl cross: true - name: macos os: macos-latest - asset_name: 0s-macos-x86_64.tar.gz + asset_name: 0s-${{ github.event.release.tag_name || github.head_ref }}-macos-x86_64 target: x86_64-apple-darwin cross: false - name: macos-m1 os: macos-latest - asset_name: 0s-macos-aarch64.tar.gz + asset_name: 0s-${{ github.event.release.tag_name || github.head_ref }}-macos-aarch64 target: aarch64-apple-darwin cross: true - name: windows os: windows-latest - asset_name: 0s-windows-x86_64.exe + asset_name: 0s-${{ github.event.release.tag_name || github.head_ref }}-windows-x86_64.exe target: x86_64-pc-windows-msvc cross: false @@ -106,28 +109,6 @@ jobs: name: ${{ matrix.asset_name }} path: "output/bin/0s${{ matrix.os == 'windows-latest' && '.exe' || '' }}" - package: - runs-on: ubuntu-latest - needs: [build] - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - path: bin - - - name: Package artifacts - run: | - set -e - cd bin - for dir in 0s-linux* 0s-macos*; do - (cd $dir; - echo $dir - tar czf archive.tar.gz 0s; - sha256sum archive.tar.gz - rm 0s; - ) - done - release: runs-on: ubuntu-latest needs: [build, security_audit] @@ -142,10 +123,11 @@ jobs: run: | set -e cd bin - for dir in 0s-linux* 0s-macos*; do + for dir in 0s-*-linux-* 0s-*-macos-*; do (cd $dir; - tar czf archive.tar.gz 0s; - rm 0s; + echo $dir + tar czf $dir.tar.gz 0s; + sha256sum $dir.tar.gz ) done @@ -162,15 +144,24 @@ jobs: const artifacts = await fs.readdir('bin/'); for (dir of artifacts) { - console.log(`Uploading ${dir}/0s for release ${release_id}`); - const files = await fs.readdir(`bin/${dir}`); for (file of files) { + if (file === '0s') { + continue; + } + + var file_name = file; + if (file === '0s.exe') { + file_name = `${dir}.exe`; + } + + console.log(`Uploading ${dir}/${file} as ${file_name} for release ${release_id}`); + await github.rest.repos.uploadReleaseAsset({ owner, repo, release_id, - name: path.basename(dir), + name: file_name, data: await fs.readFile(`bin/${dir}/${file}`), });