amplify-cli-action
amplify-cli-action copied to clipboard
Use node12 instead of Docker to make it work in MacOS environment
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
@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:
- does everything needed on amplify side, populates a test infrastructure (
add-env). (ubuntu-latest) - runs fastlane, etc, builds your Xcode app, runs integration tests (macos-latest)
- deprovisions test infrustructure (
delete-env)
What do you think? Though I am unaware how to implement dependent jobs within the same workflow
@ambientlight good point about dependent jobs! will try to do that. that might work. thanks
@edvinasbartkus: sure, I will keep this open until I have more feedback on reimplementing this in node12
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.
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!
@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!
Just ran into this, any updates?
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.