Skip to content

Commit 32f7d73

Browse files
authored
Merge pull request #71 from veracode/develop
Gen IR version: 0.5.0
2 parents 8fde502 + 2b92a34 commit 32f7d73

220 files changed

Lines changed: 11070 additions & 3940 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/SwiftLint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: SwiftLint
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.swift'
7+
8+
jobs:
9+
# Runs swiftlint on any pull request to main (note: this runs for _all_ files, not only the changed files in the PR!)
10+
SwiftLint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: cirruslabs/swiftlint-action@v1
15+
with:
16+
version: latest
17+
args: "--strict"

.github/workflows/build.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ on:
77

88
jobs:
99
build:
10-
runs-on: macos-12
11-
# This doesn't seem to work, even when the internet seems to indicate it should...
12-
env:
13-
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
10+
runs-on: macos-latest
1411
steps:
15-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1613

1714
- name: 🔨 Build
1815
run: |
19-
sudo xcode-select -s /Applications/Xcode_14.2.app/
16+
sudo xcode-select -s /Applications/Xcode_15.4.app/
2017
swift build

.github/workflows/release.yml

Lines changed: 0 additions & 123 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ output/
1616
*.xcarchive/
1717
*.bc
1818
*.dia
19-
_build/
19+
_build/
20+
**/.build/

.swiftlint.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
excluded:
2-
- .build/
32
- .swiftpm/
43
- .vscode/
5-
- PBXProjParser/.build/ # https://github.com/realm/SwiftLint/issues/2329 doesn't support recursive globs yet
6-
- GenIRLogging/.build/
4+
- "**/.build/*"
5+
- .build/
6+
- TestAssets/
7+
- PIF/.build/
8+
- '**/Package.swift'
9+
- Package.swift
10+
- PIF/Sources/pif-parser/pif-parser.swift
11+
12+
disabled_rules:
13+
- todo
14+
- nesting
715

816
line_length:
9-
warning: 150
17+
warning: 200
1018
ignores_comments: true
19+
20+
missing_docs:
21+
warning:
22+
- public
23+
24+
opt_in_rules:
25+
- missing_docs

Documentation/branching_model.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Gen IR Branching Model
2+
3+
![Branching Model](images/branching_model.svg)
4+
5+
Gen IR uses the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branching model. This model is tried, tested, and has remained so over 10+ years for a project of this type.
6+
7+
Modifications to the model:
8+
9+
- No `hotfix` branch for now. We can just follow the regular release flow
10+
- Unstable releases are tagged on `develop`
11+
- These should be set as `prelease` in the GitHub Release!
12+
13+
## Versioning
14+
15+
We use the [SemVar 2.0.0](https://semvar.org) versioning scheme.
16+
17+
Releases should increment this (see [Releasing an Update](releasing_an_update.md))
18+
19+
## New Feature Development
20+
21+
- Create a new branch off `develop` and name it appropriately
22+
- `git checkout develop && git pull && git checkout -b sensibly_named_branch`
23+
- Add your new feature commits
24+
- Create a merge request to the `develop` branch
25+
26+
## New Release
27+
28+
- Create a branch off `develop` and name it `release/<version>`
29+
- Test, QA, fix
30+
- Merge to `main` and create a release
31+
- Merge to `develop`, remove the `develop` tag and retag the new commit with `develop`

Documentation/images/branching_model.svg

Lines changed: 4 additions & 0 deletions
Loading

Documentation/releasing_an_update.md

Lines changed: 84 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,96 @@
33
When you have an update for `gen-ir`, there's a couple things that need to happen:
44

55
- Release a version in the `gen-ir` repo
6-
- Update the version in the `homebrew-tap` repo, so brew picks up the update
6+
- Update the version(s) in the `homebrew-tap` repo, so brew picks up the update(s)
77

8-
## Releasing a gen-ir version
8+
## Releasing a Gen IR version
99

10-
To release a new version of `gen-ir`, create a Pull Request with your changes, ensuring the `build` pipeline finishes successfully, then attach one of the following labels to the PR.
10+
As mentioned in the [Branching Model](branching_model.md), features should be merged into the `develop` branch. You should never merge a feature directly to `main`.
1111

12-
- `merge-bump-major`
13-
- This will merge the PR & bump a major version (i.e. 1.0.0 to 2.0.0)
14-
- `merge-bump-minor`
15-
- This will merge the PR & bump a minor version (i.e. 1.0.0 to 1.1.0)
16-
- `merge-bump-patch`
17-
- This will merge the PR & bump a patch version (i.e. 1.0.0 to 1.0.1)
18-
- `merge-no-bump`
19-
- This will merge the PR with no version bump
12+
To release a new version of `gen-ir`, create a release branch and open a merge request from the release branch (see the [Branching Model](branching_model.md)) to `main` at the commit point you're wanting to release and to `develop`. Allow any automated check, peer reviews, and - when approved - merge the request.
2013

21-
This will merge the PR, bump the version, fix the version in the `Versions.swift` file, push the commit to main, tag the _new_ commit with the version number, and perform a GitHub release with that tag.
14+
Then, on your local machine:
2215

23-
Now, navigate to the release and note the tag name & revision for the next part
16+
- Change to `main` and pull the changes
17+
- `git checkout main && git pull`
18+
- Create the new tag for the release:
19+
- `git tag -a 1.0.0 -m "Gen IR version: 1.0.0`
20+
- `git push --tags`
21+
- Change to `develop` and pull the changes
22+
- `git checkout develop && git pull`
23+
- Recreate the new `develop` tag for the release:
24+
- `git tag -d develop && git push --delete origin develop`
25+
- `git tag -a develop -m "Gen IR Develop version: <commit hash>`
26+
- `git push --tags`
2427

25-
## Updating Homebrew Tap
28+
Then, in the GitHub UI:
2629

27-
The formula for the tap lives in the [veracode/homebrew-taps](https://github.com/veracode/homebrew-tap) repo. This needs to be updated in order to propagate a new version to users.
30+
- Go to the [Releases](https://github.com/veracode/gen-ir/releases) page
31+
- Click `Draft a new release`
32+
- Set the title to the version name
33+
- From the drop down list, choose your newly created tag
34+
- Click the `Generate release notes` button to create a change log
35+
- Ensure `Set as the latest release` is checked
36+
- Click the `Publish` button
2837

29-
- Create a new branch: `gen_ir_<version>`
30-
- Update the `gen-ir` formulae url.tag & url.revision keys to match the release the previous step made
31-
- Open a PR with these changes _and these changes only!_.
32-
- If any other changes are detected, or more than one commit is made, homebrew's automation will fail
33-
- When checks pass, add the `pr-pull` label to the PR
34-
- Automation will make a new release
38+
- Click `Draft a new release`
39+
- Set the title to `develop`
40+
- From the drop down list, choose your newly created `develop` tag
41+
- Click the `Generate release notes` button to create a change log
42+
- Ensure `Set as pre-release` is checked
43+
- Click the `Publish` button
3544

36-
Users can now run `brew update && brew upgrade` to update `gen-ir` and `brew install gen-ir` will install the latest version.
45+
A release has been made, congratulations. However there's additional steps for distributing the release via `brew`.
46+
47+
## Distributing a release
48+
49+
Gen IR uses a Homebrew Tap for distribution. In order for the Tap to see the new release, you need to update the [Gen IR Formula](https://github.com/veracode/homebrew-tap/blob/main/Formula/gen-ir.rb).
50+
51+
> Note: You may have to update more than one formula! If you're releasing a new major or minor version, you'll need to ensure versioning of the formula is correct. See the section [Versioning Tap Releases](#versioning-tap-releases) for more information.
52+
53+
First, if you haven't already, checkout the `veracode/homebrew-tap` repo:
54+
55+
```shell
56+
git clone [email protected]:veracode/homebrew-tap.git
57+
```
58+
59+
Then, do the following to increment the formula:
60+
61+
- Create a new branch - replacing `<version>` with the released version:
62+
- `git checkout -b gen_ir_<version>`
63+
- Update the `gen-ir.rb` formula:
64+
- Change `url.tag`'s value to the tag's name
65+
- Change `url.revision` to the commit hash pointed to by the tag
66+
- Open a merge request with _only these changes!_
67+
- If you have more than one commit, or change more than this single file - homebrews automation will refuse to merge the request.
68+
- When the `test-bot` check passes, add the `pr-pull` label to the request
69+
- Automation will make the new release
70+
71+
Users can now run `brew update && brew upgrade gen-ir` to update to the latest version.
72+
73+
## Versioning Tap Releases
74+
75+
It is likely that you will need to do One More Thing, which is to ensure the formula is versioned correctly.
76+
77+
Gen IR has the following policy on versions:
78+
79+
- Gen IR will maintain formulae for one version behind _and_ any current prerelease versions
80+
- Any versioned formulae **must** use `keg_only :versioned_formula`
81+
- This means brew will _only_ install into the Cellar, and will not link into the brew prefix
82+
- Gen IR _will not_ maintain formulae for patch versions
83+
84+
So, if you have released a new major or minor version you should:
85+
86+
- Create a new versioned formula for the previous release to yours
87+
- Remove any now-deprecated formula(e)
88+
89+
### Creating Versioned Formulae
90+
91+
Using the history of the `homebrew-tap` find the version of the Gen IR formula you're looking for, then copy the file to the `Formula` folder renaming it like so: `gen-ir@<version>`
92+
93+
Edit the file to:
94+
95+
- change the name of the class to add the version, for example version 0.3.11 becomes: `GenIrAT0311`.
96+
- add the `keg_only :versioned_formula` tag after the `bottle`.
97+
98+
> Note: it is a good idea to run `brew style Formulae/gen-ir@<version>.rb` before you push the commit! Brew is _very_ particular about the layout of a formula and the test-bot will fail if your key isn't in the right spot.

PBXProjParser/Package.resolved

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)