Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
akash-akya committed Sep 19, 2024
1 parent 6ca7adc commit e2f5535
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 25 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
ELIXIR_VERSION: "1.14.0"
jobs:
lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Lint OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
Expand All @@ -23,7 +23,7 @@ jobs:

- name: Cache Dependencies
id: mix-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
deps
Expand All @@ -42,26 +42,25 @@ jobs:
- run: mix deps.get
- run: mix deps.unlock --check-unused
- run: mix format --check-formatted
- run: (cd go_src/ && test -z $(gofmt -l .))
- run: mix compile --warnings-as-errors
- run: mix credo --strict
- run: mix dialyzer --plt

linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Linux OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
include:
- elixir: 1.12.x
otp: 23.x
- elixir: 1.13.x
otp: 24.x
- elixir: 1.14.x
otp: 25.x
otp: 24.x
- elixir: 1.15.x
otp: 26.x
otp: 25.x
- elixir: 1.16.x
otp: 26.x
- elixir: 1.17.x
otp: 27.x
steps:
- uses: erlef/setup-beam@v1
with:
Expand All @@ -71,7 +70,7 @@ jobs:

- name: Cache Dependencies
id: mix-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
deps
Expand All @@ -89,7 +88,7 @@ jobs:
- run: mix test --trace

macos:
runs-on: macos-11
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
Expand All @@ -100,23 +99,23 @@ jobs:
- run: nix develop --command mix test --trace

windows:
runs-on: windows-2019
runs-on: windows-latest
name: Windows OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
include:
- elixir: "1.14"
otp: "25"
- elixir: "1.17"
otp: "27"
steps:
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Dependencies
id: mix-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
deps
Expand Down
6 changes: 3 additions & 3 deletions go_src/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func execute(workdir string, args []string, stderrConfig string) error {
return err
}

func runPipeline(proc *exec.Cmd, writerDone chan struct{}, stdinClose chan struct{}, kill chan<- bool, stderrConfig string){
func runPipeline(proc *exec.Cmd, writerDone chan struct{}, stdinClose chan struct{}, kill chan<- bool, stderrConfig string) {
cmdInput := make(chan []byte, 1)
cmdOutputDemand := make(chan Packet)
cmdInputDemand := make(chan Packet)
Expand Down Expand Up @@ -183,7 +183,7 @@ func stdoutWriter(pid int, cmdStdout <-chan []byte, cmdInputDemand <-chan Packet

if len(data) > BufferSize {
fatal("Invalid payloadLen")
} else if (len(data) == 0) {
} else if len(data) == 0 {
// if we are getting EOF then we are done here
// there won't be anymore command coming
writePacketToStdout(OutputEOF, make([]byte, 0))
Expand Down Expand Up @@ -229,7 +229,7 @@ func safeExit(proc *exec.Cmd, procErr <-chan error, kill <-chan bool, timeout ti
case err := <-procErr:
logger.Printf("Cmd completed with err: %v", err)
return err
case <- kill:
case <-kill:
if err := proc.Process.Kill(); err != nil {
logger.Fatal("failed to kill process: ", err)
return err
Expand Down
1 change: 1 addition & 0 deletions go_src/exit_status.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !plan9
// +build !plan9

package main
Expand Down
4 changes: 2 additions & 2 deletions go_src/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
"os/exec"
"flag"
"fmt"
"os"
"os/exec"
)

// Version of the odu
Expand Down Expand Up @@ -53,7 +53,7 @@ func main() {
// This shouldn't really happen in practice because we check for
// program existence in Elixir, before launching odu
logger.Printf("Command exited with error: %v", exitError)
} else {
} else {
logger.Printf("Command exited with unknown errors", err)
}

Expand Down
2 changes: 1 addition & 1 deletion go_src/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func startCommandPipeline(proc *exec.Cmd, input <-chan []byte, inputDemand chan<
return output
}

func writeToCommandStdin(cmdInput io.WriteCloser, input <- chan []byte, inputDemand chan<- Packet) {
func writeToCommandStdin(cmdInput io.WriteCloser, input <-chan []byte, inputDemand chan<- Packet) {
var data []byte
var ok bool

Expand Down
12 changes: 10 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule ExCmd.MixProject do
start_permanent: Mix.env() == :prod,
deps: deps(),
compilers: Mix.compilers() ++ [:odu],
aliases: aliases(),

# Ensure dialyzer sees mix modules
dialyzer: [plt_add_apps: [:mix]],
Expand Down Expand Up @@ -53,10 +54,17 @@ defmodule ExCmd.MixProject do
]
end

defp deps do
defp aliases do
[
{:gen_state_machine, "~> 3.0"},
format: [
"format",
"cmd --cd go_src/ go fmt"
]
]
end

defp deps do
[
# development & test
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev], runtime: false},
Expand Down
1 change: 0 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.34.1", "9751a0419bc15bc7580c73fde506b17b07f6402a1e5243be9e0f05a68c723368", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "d441f1a86a235f59088978eff870de2e815e290e44a8bd976fe5d64470a4c9d2"},
"file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"},
"gen_state_machine": {:hex, :gen_state_machine, "3.0.0", "1e57f86a494e5c6b14137ebef26a7eb342b3b0070c7135f2d6768ed3f6b6cdff", [:mix], [], "hexpm", "0a59652574bebceb7309f6b749d2a41b45fdeda8dbb4da0791e355dd19f0ed15"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
Expand Down
Binary file modified priv/odu_darwin_amd64
Binary file not shown.

0 comments on commit e2f5535

Please sign in to comment.