From 5fa3b65206d29f9d3ba3b6a9c84bc3e38da88991 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 13:15:25 +1000 Subject: [PATCH 1/7] refresh-manifests checks all platforms before committing manifests Closes #70 Closes #71 --- .github/workflows/refresh-manifests.yml | 80 ++++++++++++++----------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index b9db7e4d..5c727170 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -6,14 +6,10 @@ on: workflow_dispatch: jobs: - refresh-manifests: - name: "Refresh manifests and sync channels" + refresh-and-upload-manifests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.0.2 - with: - persist-credentials: false - ref: master + - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v20 with: nix_path: nixpkgs=channel:nixos-unstable @@ -21,48 +17,36 @@ jobs: with: name: fuellabs authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Refresh manifests - timeout-minutes: 60 - run: nix run .#refresh-manifests - - name: Check and commit changes - id: commit - continue-on-error: true - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add manifests - git commit -m "manifest: update" - - name: Validate nix files changed - if: steps.commit.outcome == 'success' + - run: nix run .#refresh-manifests + timeout-minutes: 120 + - name: validate changed nix files run: | - files=( $(git diff --name-only HEAD HEAD^ '*.nix') ) + files=( $(git diff --name-only '*.nix') ) echo "${#files[*]} nix files changed: ${files[*]}" if [[ "${#files[*]}" -ne 0 ]]; then nix-instantiate --parse "${files[@]}" >/dev/null fi - - name: Build fuel - run: nix build --print-build-logs --no-update-lock-file .#fuel - - name: Build fuel-nightly - run: nix build --print-build-logs --no-update-lock-file .#fuel-nightly - - name: Develop fuel-dev - run: nix develop --print-build-logs --no-update-lock-file .#fuel-dev - - name: Push changes - if: steps.commit.outcome == 'success' - uses: ad-m/github-push-action@master + - uses: actions/upload-artifact@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: master + name: manifests + path: manifests/ - refresh-cache: - name: "Refresh cache for all platforms" - needs: refresh-manifests + download-manifests-and-nix-build: + needs: refresh-and-upload-manifests strategy: + fail-fast: false matrix: - package: [fuel, fuel-beta-1, fuel-beta-2, fuel-beta-3, fuel-nightly, sway-vim] + package: [fuel, fuel-beta-1, fuel-beta-2, fuel-beta-3, fuel-nightly] os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 + - run: rm -r manifests + - uses: actions/download-artifact@v3 + with: + name: manifests + - name: stage manifests for nix build + run: git add manifests - uses: cachix/install-nix-action@v20 with: nix_path: nixpkgs=channel:nixos-unstable @@ -71,3 +55,27 @@ jobs: name: fuellabs authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }} + + download-manifests-and-commit: + needs: [refresh-and-upload-manifests, download-manifests-and-build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + ref: master + - run: rm -r ./manifests + - uses: actions/download-artifact@v3 + with: + name: manifests + - name: Check and commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add manifests + git commit -m "manifest: update" + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master From 077f9b4c75ed73dadaa45fbdba86334ccced96be Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 13:30:10 +1000 Subject: [PATCH 2/7] Temp commit to enable refresh-manifests workflow on PRs for testing --- .github/workflows/ci.yml | 2 +- .github/workflows/refresh-manifests.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fab565fb..5e1b26ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: "fuel" on: - pull_request: + #pull_request: push: branches: - master diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index 5c727170..db3a445f 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -4,6 +4,7 @@ on: schedule: - cron: '0 0 * * *' # Midnight UTC workflow_dispatch: + pull_request: jobs: refresh-and-upload-manifests: From 11b3595c9fded77810e39dcf482ce7f9bbe53d37 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 13:35:20 +1000 Subject: [PATCH 3/7] Fix incorrect job name in needs field --- .github/workflows/refresh-manifests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index db3a445f..14bffda5 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -58,7 +58,7 @@ jobs: - run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }} download-manifests-and-commit: - needs: [refresh-and-upload-manifests, download-manifests-and-build] + needs: [refresh-and-upload-manifests, download-manifests-and-nix-build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From ad25afea3ba452b26f8af7716d1584a608668aa9 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 14:20:25 +1000 Subject: [PATCH 4/7] Make git add verbose. Add nix flake show. Temporarily disable refresh-manifests while testing. --- .github/workflows/refresh-manifests.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index 14bffda5..294aae11 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -18,15 +18,15 @@ jobs: with: name: fuellabs authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix run .#refresh-manifests - timeout-minutes: 120 - - name: validate changed nix files - run: | - files=( $(git diff --name-only '*.nix') ) - echo "${#files[*]} nix files changed: ${files[*]}" - if [[ "${#files[*]}" -ne 0 ]]; then - nix-instantiate --parse "${files[@]}" >/dev/null - fi + # - run: nix run .#refresh-manifests + # timeout-minutes: 120 + # - name: validate changed nix files + # run: | + # files=( $(git diff --name-only '*.nix') ) + # echo "${#files[*]} nix files changed: ${files[*]}" + # if [[ "${#files[*]}" -ne 0 ]]; then + # nix-instantiate --parse "${files[@]}" >/dev/null + # fi - uses: actions/upload-artifact@v3 with: name: manifests @@ -46,8 +46,10 @@ jobs: - uses: actions/download-artifact@v3 with: name: manifests + path: manifests/ - name: stage manifests for nix build - run: git add manifests + run: git add -v manifests + - run: nix flake show - uses: cachix/install-nix-action@v20 with: nix_path: nixpkgs=channel:nixos-unstable From c3cafd1d90f9ba3722695d1da401d3068211a080 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 14:29:30 +1000 Subject: [PATCH 5/7] Fix nix flake show invocation --- .github/workflows/refresh-manifests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index 294aae11..ad9ff510 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -49,7 +49,6 @@ jobs: path: manifests/ - name: stage manifests for nix build run: git add -v manifests - - run: nix flake show - uses: cachix/install-nix-action@v20 with: nix_path: nixpkgs=channel:nixos-unstable @@ -57,6 +56,7 @@ jobs: with: name: fuellabs authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: nix flake show - run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }} download-manifests-and-commit: From d3d00c242e7aff567318347a7398c0a7708ac738 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 15:16:53 +1000 Subject: [PATCH 6/7] Remove nix flake show job. Fix manifests download artifact path. --- .github/workflows/refresh-manifests.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index ad9ff510..604882f8 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -18,15 +18,15 @@ jobs: with: name: fuellabs authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - # - run: nix run .#refresh-manifests - # timeout-minutes: 120 - # - name: validate changed nix files - # run: | - # files=( $(git diff --name-only '*.nix') ) - # echo "${#files[*]} nix files changed: ${files[*]}" - # if [[ "${#files[*]}" -ne 0 ]]; then - # nix-instantiate --parse "${files[@]}" >/dev/null - # fi + - run: nix run .#refresh-manifests + timeout-minutes: 120 + - name: validate changed nix files + run: | + files=( $(git diff --name-only '*.nix') ) + echo "${#files[*]} nix files changed: ${files[*]}" + if [[ "${#files[*]}" -ne 0 ]]; then + nix-instantiate --parse "${files[@]}" >/dev/null + fi - uses: actions/upload-artifact@v3 with: name: manifests @@ -56,7 +56,6 @@ jobs: with: name: fuellabs authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix flake show - run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }} download-manifests-and-commit: @@ -71,6 +70,7 @@ jobs: - uses: actions/download-artifact@v3 with: name: manifests + path: manifests/ - name: Check and commit changes run: | git config --local user.email "action@github.com" From 9e0897007fbba7843b5318a16453113f075d464a Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 2 Jun 2023 16:09:12 +1000 Subject: [PATCH 7/7] Return workflow triggers to normal after testing --- .github/workflows/ci.yml | 2 +- .github/workflows/refresh-manifests.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e1b26ef..fab565fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: "fuel" on: - #pull_request: + pull_request: push: branches: - master diff --git a/.github/workflows/refresh-manifests.yml b/.github/workflows/refresh-manifests.yml index 604882f8..567837ac 100644 --- a/.github/workflows/refresh-manifests.yml +++ b/.github/workflows/refresh-manifests.yml @@ -4,7 +4,6 @@ on: schedule: - cron: '0 0 * * *' # Midnight UTC workflow_dispatch: - pull_request: jobs: refresh-and-upload-manifests: