Keep the order of jobs in the workflow file when parsing (#33)

Keep the order of jobs in the workflow file when parsing, and it will make it possible for Gitea to show jobs in the original order on UI.

Reviewed-on: https://gitea.com/gitea/act/pulls/33
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Jason Song
2023-03-28 11:38:40 +08:00
parent 568f053723
commit 342ad6a51a
5 changed files with 90 additions and 26 deletions

View File

@@ -57,7 +57,10 @@ func TestParse(t *testing.T) {
}
encoder := yaml.NewEncoder(builder)
encoder.SetIndent(2)
_ = encoder.Encode(v)
require.NoError(t, encoder.Encode(v))
id, job := v.Job()
assert.NotEmpty(t, id)
assert.NotNil(t, job)
}
assert.Equal(t, string(want), builder.String())
})