JackDotJS / node-studio

Node-based music production tool, built with Tauri.
MIT License
7 stars 1 forks source link

GitHub Actions Electron Builds #17

Closed asoji closed 1 year ago

asoji commented 1 year ago

Starts GitHub Actions on every new commit and creates an artifact build. Seems to be working perfectly, so hey.

bdotsamir commented 1 year ago

pull request stealer :^)

JackDotJS commented 1 year ago

i asked him to work on this since you and robert on discord couldnt figure it out lol

asoji commented 1 year ago

pull request stealer :^)

:c

JackDotJS commented 1 year ago

anyway @asoji could you add a couple things:

  1. have builds run only once per day on a fixed schedule
    • is it also possible to force it to run before the scheduled time, which can then be skipped?
  2. if possible, have it so the machine doesnt waste time compiling if the last compiled commit is the same as before (that way i dont have to worry about wasting minutes on github's server whenever i inevitably put this project on hold for a month or two)
asoji commented 1 year ago

anyway @asoji could you add a couple things:

1. have builds run only once per day on a fixed schedule

   * is it also possible to force it to run _before_ the scheduled time, which can then be skipped?

yeah i can run it on a fixed schedule using a cron job. just depends when you want me to do it [time is all in UTC so, fun], as for skipping it, genuinely not sure tbh, github docs probably can explain this better than i ever can.

2. if possible, have it so the machine doesnt waste time compiling if the last compiled commit is the same as before (that way i dont have to worry about wasting minutes on github's server whenever i inevitably put this project on hold for a month or two)

i'm not sure how to do that, but you can put [skip ci] in your commit title to skip it

bdotsamir commented 1 year ago

not sure why you want literal nightly builds? might be worth it to just run it every time there's a commit. that eliminates the whole two month inactivity thing and checking to make sure the last build is the same as the build it's about to run

asoji commented 1 year ago

yeah imo it's best to just.. leave it so it makes a new build everytime you commit instead of literal nightly

JackDotJS commented 1 year ago

yeah i can run it on a fixed schedule using a cron job. just depends when you want me to do it [time is all in UTC so, fun], as for skipping it, genuinely not sure tbh, github docs probably can explain this better than i ever can.

9 AM UTC should be fine, that's about 2 AM my time which about the latest i push anything lol

i'm not sure how to do that, but you can put [skip ci] in your commit title to skip it

i meant, checking to see if the server has already compiled with the latest commit. so if there's a whole day with no commits, no time is wasted compiling the code again

not sure why you want literal nightly builds? might be worth it to just run it every time there's a commit. that eliminates the whole two month inactivity thing and checking to make sure the last build is the same as the build it's about to run

im worried about using fuck tons of server time cus i've been pushing a lot of work recently so i dont want it to run like 50 times a day, but at the same time i dont wanna have to resort to building manually so

idk

JackDotJS commented 1 year ago

maybe im just paranoid lmao

actually how long does it take to compile through a workflow anyway...?

asoji commented 1 year ago

as far as i know, github only cares about time usage if it's a private repo

also it only takes ~2 minutes per build, so like, really not much time at all. maybe in the grand scheme of things, but this is a small project.

asoji commented 1 year ago

as far as i know, github only cares about time usage if it's a private repo

so yep image

JackDotJS commented 1 year ago

GitHub Actions usage is free for both public repositories and self-hosted runners. For private repositories, each GitHub account receives a certain amount of free minutes and storage, depending on the product used with the account. Any usage beyond the included amounts is controlled by spending limits.

ok so as long as the repo is public, we dont have to worry about it...?

bdotsamir commented 1 year ago

i also run my own build server i use for a couple of other projects if you're interested and/or worried about usage time never mind looks like the usage thing is fine for public repos. offer still stands for the future tho

asoji commented 1 year ago

GitHub Actions usage is free for both public repositories and self-hosted runners. For private repositories, each GitHub account receives a certain amount of free minutes and storage, depending on the product used with the account. Any usage beyond the included amounts is controlled by spending limits.

ok so as long as the repo is public, we dont have to worry about it...?

yep!

JackDotJS commented 1 year ago

damn well that solves all sorts of problems LOL

well in that case i think i only have one other question: is there an easy way to link to the latest builds made by the workflow...? having a simple, static url would be perfect

asoji commented 1 year ago

damn well that solves all sorts of problems LOL

well in that case i think i only have one other question: is there an easy way to link to the latest builds made by the workflow...? having a simple, static url would be perfect

natively in github, there is not unfortunately, but i can add another action to the existing one that might be able to grab the latest.

asoji commented 1 year ago

actually wait, using this you can [but keep in mind, it's a community tool]

JackDotJS commented 1 year ago

natively in github, there is not unfortunately, but i can add another action to the existing one that might be able to grab the latest.

and how would that work?

asoji commented 1 year ago

at least from what i can find, https://nightly.link/ seems to be the only one that has a consistently updated one, and wont PR everytime you make a commit [which yknow, gets very annoying]

for example making a link like this: https://nightly.link/asoji/node-studio/workflows/electron/github-actions-test/NightlyNodeStudio-win32-x64.zip

JackDotJS commented 1 year ago

at least from what i can find, https://nightly.link/ seems to be the only one that has a consistently updated one, and wont PR everytime you make a commit [which yknow, gets very annoying]

for example making a link like this: https://nightly.link/asoji/node-studio/workflows/electron/github-actions-test/NightlyNodeStudio-win32-x64.zip

is there a way this could be done without community tools...? i wanna see all our options

asoji commented 1 year ago

at least from what i can find, https://nightly.link/ seems to be the only one that has a consistently updated one, and wont PR everytime you make a commit [which yknow, gets very annoying] for example making a link like this: https://nightly.link/asoji/node-studio/workflows/electron/github-actions-test/NightlyNodeStudio-win32-x64.zip

is there a way this could be done without community tools...? i wanna see all our options

imo the easiest way would probably be to automatically create a release everytime you make a new commit [which i can just add to the electron.yml]

in terms of github actions making a latest artifact link https://github.com/marketplace/actions/workflow-artifact-pull-request-comment

JackDotJS commented 1 year ago

is it safe to just link to the page where the artifact can be downloaded? e.g https://github.com/asoji/node-studio/actions/runs/2674498582

asoji commented 1 year ago

yes but do you really want to link a new one every time

i guess the other solution is just tell people to go to https://github.com/asoji/node-studio/actions and click on any of the latest actions, and click on the artifact to download it

JackDotJS commented 1 year ago

wait does that page change every fuckin time?

JackDotJS commented 1 year ago

image

JackDotJS commented 1 year ago

WHY CAN'T THIS BE SIMPLE

asoji commented 1 year ago

oh believe me, i wish it was fucking simple.

but in fact, it's just.. augh... i heard it's gonna get changed soon to support latest but still, this is github time we're talking about.

https://github.com/actions/upload-artifact/issues/50 https://github.com/actions/upload-artifact/issues/27 https://github.com/actions/upload-artifact/issues/21 https://github.community/t/link-to-latest-artifacts/16712

asoji commented 1 year ago

wait does that page change every fuckin time?

also did you not see the runId at the end there image

JackDotJS commented 1 year ago

i thought that was like the version of the workflow idfk

JackDotJS commented 1 year ago

this is certified Dumb(TM)

asoji commented 1 year ago

so uh, are we gonna merge this or [sorry if im coming off as impatient]

JackDotJS commented 1 year ago

RIGHT YES SORRY

fudckinn uhh one last thing: does this current workflow mean it'll build for every pull request as well...? i'm not sure if that's desirable, at least for this use case.

asoji commented 1 year ago

i can remove that right now, but yes.

JackDotJS commented 1 year ago

it'd be cool to have a separate workflow just for PRs just to check for successful builds, among other potential checks

but we can worry about that later x)

JackDotJS commented 1 year ago

if there's nothing else u need to do with this PR i think i can merge it now

asoji commented 1 year ago

yeah, you nerds can worry about that, this PR is just to get actions into place. whenever you're ready, feel free to merge. thanks for letting me contribute!

JackDotJS commented 1 year ago

one last thing (i promise) for a potential future PR: how difficult would it be to include build processes for other operating systems?

i'm not too worried about linux, but macOS is not something i'm excited to work with

asoji commented 1 year ago

one last thing (i promise) for a potential future PR: how difficult would it be to include build processes for other operating systems?

i'm not too worried about linux, but macOS is not something i'm excited to work with

basically just [i assume]

  build_on_linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@master
      with:
        node-version: 17
    - name: install dependencies
      run: npm install
    - name: build
      run: npm run build
    - uses: actions/upload-artifact@v3
      with:
        name: NightlyNodeStudio-linux
        path: build/node-studio-linux

  build_on_mac:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@master
      with:
        node-version: 17
    - name: install dependencies
      run: npm install
    - name: build
      run: npm run build
    - uses: actions/upload-artifact@v3
      with:
        name: NightlyNodeStudio-macOS
        path: build/node-studio-macOS
asoji commented 1 year ago

FTR THAT PATH IS MOST LIKELY INCORRECT, I HAVE [OBVIOUSLY] NOT TESTED IT

JackDotJS commented 1 year ago

ye let's try that out sometime later x)