Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use node12 instead of Docker to make it work in MacOS environment #3

Open
edvinasbartkus opened this issue Feb 13, 2020 · 8 comments
Open
Labels
enhancement New feature or request

Comments

@edvinasbartkus
Copy link

If I try to use this step with macos-latest, I get the following (I want to run integration tests for iOS app):

##[error]Container action is only supported on Linux

Maybe it's possible to use node12 instead of Dockerfile, like in https://github.com/actions/setup-node/blob/master/action.yml#L20

@ambientlight
Copy link
Owner

ambientlight commented Feb 13, 2020

@edvinasbartkus: was unaware of this limitation, will investigate, thanks.

Also curious if this alternative might work for you (I haven't attempted anything similar so I have no idea how and if that will works):

We split the worklow in 3 dependent jobs:

  1. does everything needed on amplify side, populates a test infrastructure (add-env). (ubuntu-latest)
  2. runs fastlane, etc, builds your Xcode app, runs integration tests (macos-latest)
  3. deprovisions test infrustructure (delete-env)

What do you think? Though I am unaware how to implement dependent jobs within the same workflow

@edvinasbartkus
Copy link
Author

@ambientlight good point about dependent jobs! will try to do that. that might work. thanks

@ambientlight ambientlight added the enhancement New feature or request label Feb 13, 2020
@ambientlight
Copy link
Owner

ambientlight commented Feb 13, 2020

@edvinasbartkus: sure, I will keep this open until I have more feedback on reimplementing this in node12

@danrivett
Copy link

I'm also very interested in this because I'm attempting to run e2e tests for an iOS app that integrates with an AWS AppSync backend (incidentally using @edvinasbartkus's great guide here would you believe).

The intention I have is to use a common CI environment initially so I won't be creating and destroying CloudFormation stacks, but I will need to do the equivalent of amplify env pull to create the appropriate aws-exports.js file.

I was hoping instead to use your github action so later as it looks great, but if it can't run on MacOS because of the use of Docker, that's a non-starter for now.

I know I could just run amplify env pull --yes manually like your action does, but if you ever decided to reimplement in node12 I'd definitely be very interested in using it.

@danrivett
Copy link

danrivett commented Apr 25, 2020

Also for reference (at least for others like myself who wasn't aware):

  • Here is the GitHub documentation describing different types of GitHub Action implementations.
  • And specifically the documentation on how to create a "JavaScript action" as GitHub describes it (even though node seems to be documented application to run it in as Edvinas mentioned).

For this particular action we rely on the amplify-cli and I don't believe we can or would install it like we do in a Docker container, instead as it itself is a node application we can add it as a node dependency and then invoke it as a child process such as explained here on good old Stackoverflow.

There may be a better way, but at least doing it that way means we're less reliant on the internals of amplify-cli and can invoke it very close to how we would from the command line.

An alternative could be to follow a similar approach to this GitHub Action - peter-evans/create-pull-request - which supports running on Mac. It ends up running Python via exec.exec so perhaps you could install the amplify-cli locally and then exec.exec npx amplify ... but not sure if that's better or not 🤷‍♂️

Anyway just thought I'd add this as I was curious so did some digging, and some of it may help.

Comments, improvements, and corrections are most welcome!

@ambientlight
Copy link
Owner

ambientlight commented Apr 25, 2020

@danrivett: yes sure, I do see a good point, I have looked into it few month back, reimplementing in node is not complex actually, and this amplify action is quite trivial to begin with, hopefully will be able to find a timeframe to do this soon, thanks for the references!

@aprilmintacpineda
Copy link

Just ran into this, any updates?

@johnf
Copy link
Contributor

johnf commented Jun 12, 2021

I had a go at this, which you can see at https://github.com/johnf/amplify-cli-action

The javascript code is done and simple. The tricky part is getting amplify to actually run.

You can't install global packages and getting amplify to run out of the node_modules directory where it is installed got a bit tricky.
I gave up at that stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants