-
Notifications
You must be signed in to change notification settings - Fork 249
[cicd] Unify lint, add caching #1549
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1c3a5b1
[cicd] Unify lint, add caching
mikeland73 44c631a
Improve caching and use artifacts
mikeland73 e68691d
Set retention to 5 days
mikeland73 bb51199
Add devbox to path
mikeland73 dd0bf27
Requested changes
mikeland73 d75588f
Fix
mikeland73 2cfc1bf
Update comment
mikeland73 c367219
Bump timout
mikeland73 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,32 @@ env: | |
DEVBOX_DEBUG: 1 | ||
|
||
jobs: | ||
build-devbox: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Mount golang cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg | ||
key: go-devbox-build-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
- name: Build devbox | ||
run: go build -o dist/devbox ./cmd/devbox | ||
- name: Upload devbox artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: devbox-${{ runner.os }}-${{ runner.arch }} | ||
path: ./dist/devbox | ||
retention-days: 7 | ||
|
||
typos: | ||
name: Spell Check with Typos | ||
if: github.ref != 'refs/heads/main' | ||
|
@@ -55,6 +81,7 @@ jobs: | |
- uses: crate-ci/[email protected] | ||
|
||
golangci-lint: | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
|
@@ -70,6 +97,7 @@ jobs: | |
cache: false | ||
|
||
# This can be reanabled once released version supports runx | ||
# and we can remove needs: build-devbox | ||
# - name: Install devbox | ||
# uses: jetpack-io/[email protected] | ||
# with: | ||
|
@@ -84,16 +112,19 @@ jobs: | |
~/go/pkg | ||
key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
|
||
# Use main devbox for now to ensure it supports runx | ||
- run: go run ./cmd/devbox run fmt | ||
|
||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
- name: Download devbox | ||
uses: actions/download-artifact@v3 | ||
with: | ||
args: "--out-${NO_FUTURE}format colored-line-number --timeout=10m" | ||
skip-cache: true | ||
name: devbox-${{ runner.os }}-${{ runner.arch }} | ||
- name: Add devbox to path | ||
run: | | ||
chmod +x ./devbox | ||
sudo mv ./devbox /usr/local/bin/ | ||
|
||
- run: devbox run lint | ||
|
||
test: | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
is-main: | ||
|
@@ -117,7 +148,7 @@ jobs: | |
os: macos-latest | ||
|
||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 37 || 25 }} | ||
timeout-minutes: 37 | ||
steps: | ||
- name: Maximize build disk space | ||
uses: easimon/maximize-build-space@v8 | ||
|
@@ -133,8 +164,13 @@ jobs: | |
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Build devbox | ||
run: go install ./cmd/devbox | ||
- name: Mount golang cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg | ||
key: go-devbox-tests-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
- name: Install additional shells (dash, zsh) | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
|
@@ -171,17 +207,21 @@ jobs: | |
go test -v -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./... | ||
|
||
auto-nix-install: # ensure Devbox installs nix and works properly after installation. | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- name: Download devbox | ||
uses: actions/download-artifact@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Build devbox | ||
run: go install ./cmd/devbox | ||
name: devbox-${{ runner.os }}-${{ runner.arch }} | ||
- name: Add devbox to path | ||
run: | | ||
chmod +x ./devbox | ||
sudo mv ./devbox /usr/local/bin/ | ||
- name: Install nix and devbox packages | ||
run: | | ||
export NIX_INSTALLER_NO_CHANNEL_ADD=1 | ||
|
@@ -198,18 +238,22 @@ jobs: | |
# Run a sanity test to make sure Devbox can install and remove packages with | ||
# the last 3 Nix releases. | ||
test-nix-versions: | ||
needs: build-devbox | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
nix-version: [2.15.1, 2.16.1, 2.17.0, 2.18.0] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- name: Download devbox | ||
uses: actions/download-artifact@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Build devbox | ||
run: go install ./cmd/devbox | ||
name: devbox-${{ runner.os }}-${{ runner.arch }} | ||
- name: Add devbox to path | ||
run: | | ||
chmod +x ./devbox | ||
sudo mv ./devbox /usr/local/bin/ | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v4 | ||
with: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be faster to build all platforms on a single machine and set GOOS/GOARCH?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a bit slower no? In this case they can run in parallel?